<commit_before>package org.broadinstitute.dsde.vault.services.analysis

import javax.ws.rs.Path

import akka.actor.Props
import com.wordnik.swagger.annotations._
import org.broadinstitute.dsde.vault.{BossClientService, DmClientService}
import org.broadinstitute.dsde.vault.model.AnalysisJsonProtocol.impAnalysisUpdate
import org.broadinstitute.dsde.vault.model._
import spray.http.MediaTypes._
import spray.httpx.SprayJsonSupport._
import spray.routing._

@Api(value = "/analyses", description = "Analysis Service", produces = "application/json", position = 1)
trait UpdateService extends HttpService {

  val routes = updateRoute

  @Path("/{ID}/outputs")
  @ApiOperation(
    value = "Updates Analysis objects with output files",
    nickname = "analysis_update",
    httpMethod = "POST",
    produces = "application/json",
    consumes = "application/json",
    notes = "Accepts a json packet as POST. Updates the Vault analysis object with the supplied output files. " +
      "Returns the Vault ID of the created object. If a custom header of type 'X-Force-Location' has a " +
      "case-insensitive value of 'true', then the file path locations will be used as the location of the file object.")
  @ApiImplicitParams(Array(
    new ApiImplicitParam(name = "id", required = true, dataType = "string", paramType = "path", value = "Analysis Vault ID"),
    new ApiImplicitParam(name = "body", required = true, dataType = "org.broadinstitute.dsde.vault.model.AnalysisUpdate", paramType = "body", value = "Analysis outputs to add")
  ))
  @ApiResponses(Array(
    new ApiResponse(code = 200, message = "OK"),
    new ApiResponse(code = 400, message = "Malformed Input"),
    new ApiResponse(code = 404, message = "Vault ID Not Found"),
    new ApiResponse(code = 500, message = "Vault Internal Error")
  ))
  def updateRoute =
    path("analyses" / Segment / "outputs") {
      id => {
        post {
          optionalHeaderValueByName("X-Force-Location") {
            forceLocation =>
            respondWithMediaType(`application/json`) {
              entity(as[AnalysisUpdate]) {
                update =>
                  requestContext => {
                    val bossService = actorRefFactory.actorOf(BossClientService.props(requestContext))
                    val dmService = actorRefFactory.actorOf(Props(new DmClientService(requestContext)))
                    val updateActor = actorRefFactory.actorOf(UpdateServiceHandler.props(requestContext, dmService, bossService))
                    updateActor ! UpdateServiceHandler.UpdateMessage(id, update, forceLocation)
                  }
              }
            }
          }
        }
      }
    }

}
<commit_msg>Lowercase to match other Swagger output<commit_after>package org.broadinstitute.dsde.vault.services.analysis

import javax.ws.rs.Path

import akka.actor.Props
import com.wordnik.swagger.annotations._
import org.broadinstitute.dsde.vault.{BossClientService, DmClientService}
import org.broadinstitute.dsde.vault.model.AnalysisJsonProtocol.impAnalysisUpdate
import org.broadinstitute.dsde.vault.model._
import spray.http.MediaTypes._
import spray.httpx.SprayJsonSupport._
import spray.routing._

@Api(value = "/analyses", description = "Analysis Service", produces = "application/json", position = 1)
trait UpdateService extends HttpService {

  val routes = updateRoute

  @Path("/{id}/outputs")
  @ApiOperation(
    value = "Updates Analysis objects with output files",
    nickname = "analysis_update",
    httpMethod = "POST",
    produces = "application/json",
    consumes = "application/json",
    notes = "Accepts a json packet as POST. Updates the Vault analysis object with the supplied output files. " +
      "Returns the Vault ID of the created object. If a custom header of type 'X-Force-Location' has a " +
      "case-insensitive value of 'true', then the file path locations will be used as the location of the file object.")
  @ApiImplicitParams(Array(
    new ApiImplicitParam(name = "id", required = true, dataType = "string", paramType = "path", value = "Analysis Vault ID"),
    new ApiImplicitParam(name = "body", required = true, dataType = "org.broadinstitute.dsde.vault.model.AnalysisUpdate", paramType = "body", value = "Analysis outputs to add")
  ))
  @ApiResponses(Array(
    new ApiResponse(code = 200, message = "OK"),
    new ApiResponse(code = 400, message = "Malformed Input"),
    new ApiResponse(code = 404, message = "Vault ID Not Found"),
    new ApiResponse(code = 500, message = "Vault Internal Error")
  ))
  def updateRoute =
    path("analyses" / Segment / "outputs") {
      id => {
        post {
          optionalHeaderValueByName("X-Force-Location") {
            forceLocation =>
            respondWithMediaType(`application/json`) {
              entity(as[AnalysisUpdate]) {
                update =>
                  requestContext => {
                    val bossService = actorRefFactory.actorOf(BossClientService.props(requestContext))
                    val dmService = actorRefFactory.actorOf(Props(new DmClientService(requestContext)))
                    val updateActor = actorRefFactory.actorOf(UpdateServiceHandler.props(requestContext, dmService, bossService))
                    updateActor ! UpdateServiceHandler.UpdateMessage(id, update, forceLocation)
                  }
              }
            }
          }
        }
      }
    }

}

{'fraction_non_alphanumeric': 0.10374212671359763, 'fraction_numerical': 0.004816598740274175, 'mean_word_length': 3.1150914634146343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5656175', 'n_tokens_mistral': 1514, 'n_tokens_neox': 1473, 'n_words': 387}