<commit_before>/*
 * Copyright (C) 2017  LREN CHUV for Human Brain Project
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package ch.chuv.lren.woken.api

import ch.chuv.lren.woken.api.swagger.SwaggerService
import ch.chuv.lren.woken.config.AppConfiguration
import ch.chuv.lren.woken.core.{ CoordinatorConfig, Core, CoreActors }
import ch.chuv.lren.woken.dao.FeaturesDAL
import ch.chuv.lren.woken.service.{ JobResultService, VariablesMetaService }
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route

/**
  * The REST API layer. It exposes the REST services, but does not provide any
  * web server interface.<br/>
  * Notice that it requires to be mixed in with ``core.CoreActors``, which provides access
  * to the top-level actors that make up the system.
  */
trait Api extends CoreActors with Core {

  val featuresDAL: FeaturesDAL
  val jobResultService: JobResultService
  val variablesMetaService: VariablesMetaService
  val appConfig: AppConfiguration
  val coordinatorConfig: CoordinatorConfig

  lazy val miningService =
    new MiningService(
      mainRouter,
      featuresDAL,
      appConfig,
      jobsConf
    )

  val routes: Route = SwaggerService.routes ~ miningService.routes ~
    pathPrefix("health") {
      get {
        // TODO: proper health check is required, check db connection, check cluster availability...
        complete("OK")
      }
    }

}

trait RestMessage<commit_msg>adds metadata routes to API<commit_after>/*
 * Copyright (C) 2017  LREN CHUV for Human Brain Project
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package ch.chuv.lren.woken.api

import ch.chuv.lren.woken.api.swagger.SwaggerService
import ch.chuv.lren.woken.config.AppConfiguration
import ch.chuv.lren.woken.core.{ CoordinatorConfig, Core, CoreActors }
import ch.chuv.lren.woken.dao.FeaturesDAL
import ch.chuv.lren.woken.service.{ JobResultService, VariablesMetaService }
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route

/**
  * The REST API layer. It exposes the REST services, but does not provide any
  * web server interface.<br/>
  * Notice that it requires to be mixed in with ``core.CoreActors``, which provides access
  * to the top-level actors that make up the system.
  */
trait Api extends CoreActors with Core {

  val featuresDAL: FeaturesDAL
  val jobResultService: JobResultService
  val variablesMetaService: VariablesMetaService
  val appConfig: AppConfiguration
  val coordinatorConfig: CoordinatorConfig

  lazy val miningService =
    new MiningService(
      mainRouter,
      featuresDAL,
      appConfig,
      jobsConf
    )

  lazy val metadataService =
    new MetadataApiService(mainRouter, appConfig)

  val routes: Route = SwaggerService.routes ~ miningService.routes ~ metadataService.routes ~
    pathPrefix("health") {
      get {
        // TODO: proper health check is required, check db connection, check cluster availability...
        complete("OK")
      }
    }

}

trait RestMessage
{'fraction_non_alphanumeric': 0.07372622681380606, 'fraction_numerical': 0.0023479690068091102, 'mean_word_length': 3.681318681318681, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5036950', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1187, 'n_words': 458}