<commit_before>/*
 * Copyright 2017 Human Brain Project MIP by LREN CHUV
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package eu.hbp.mip.woken.api

import eu.hbp.mip.woken.api.swagger.SwaggerService
import eu.hbp.mip.woken.config.AppConfiguration
import eu.hbp.mip.woken.core.{ CoordinatorConfig, Core, CoreActors }
import eu.hbp.mip.woken.dao.FeaturesDAL
import eu.hbp.mip.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 {
        complete("OK")
      }
    }

}

trait RestMessage
<commit_msg>added TODO to not forget about health check support<commit_after>/*
 * Copyright 2017 Human Brain Project MIP by LREN CHUV
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package eu.hbp.mip.woken.api

import eu.hbp.mip.woken.api.swagger.SwaggerService
import eu.hbp.mip.woken.config.AppConfiguration
import eu.hbp.mip.woken.core.{ CoordinatorConfig, Core, CoreActors }
import eu.hbp.mip.woken.dao.FeaturesDAL
import eu.hbp.mip.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 helf check is required, check db connection, check cluster availability...
        complete("OK")
      }
    }

}

trait RestMessage

{'fraction_non_alphanumeric': 0.07738562091503268, 'fraction_numerical': 0.004183006535947713, 'mean_word_length': 3.6488456865127583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4144124', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1090, 'n_words': 396}