aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Bertin <marvin.bertin@gmail.com>2017-10-10 11:54:20 -0700
committerMarvin Bertin <marvin.bertin@gmail.com>2017-10-10 11:54:20 -0700
commit19a70318ecee81872fffe23c03d83e725610911d (patch)
tree984510310c95856fcdcb463d9a242f9773795266
parent05aa114cfd22228f0457b6457ce441af5eabfc60 (diff)
parent4f83461cba1f78e607ca2a4edb6fa26f6e16e732 (diff)
downloadrest-query-19a70318ecee81872fffe23c03d83e725610911d.tar.gz
rest-query-19a70318ecee81872fffe23c03d83e725610911d.tar.bz2
rest-query-19a70318ecee81872fffe23c03d83e725610911d.zip
fix merge conflicts with master
-rw-r--r--build.sbt4
-rw-r--r--src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala25
-rw-r--r--src/main/scala/xyz/driver/pdsuicommon/domain/FuzzyValue.scala40
-rw-r--r--src/main/scala/xyz/driver/pdsuicommon/json/JsonSerializer.scala3
-rw-r--r--src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala3
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/DirectReport.scala27
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala8
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/EligibilityArm.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala8
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecord.scala30
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Patient.scala6
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala19
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/PatientEligibleTrial.scala23
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala10
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala10
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala31
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala32
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Trial.scala36
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala5
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala19
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala8
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala12
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala12
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala36
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala6
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala5
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala31
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala23
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityCreateArm.scala19
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiPartialEligibilityArm.scala7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala6
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala12
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala25
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala8
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala15
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabel.scala32
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabelDefiningCriteria.scala8
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterion.scala14
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterionList.scala9
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala18
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiCreateRecord.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiRecord.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala10
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/export.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patient.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientcriterion.scala7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienteligibletrial.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala9
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/record.scala38
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/trial.scala8
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/EligibilityArmService.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/EligibilityVerificationService.scala3
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/PatientCriterionService.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/TrialService.scala5
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeEligibilityVerificationService.scala3
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/rest/RestEligibilityVerificationService.scala5
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/rest/RestTrialService.scala9
-rw-r--r--src/test/scala/xyz/driver/pdsuicommon/parsers/PaginationParserSuite.scala68
-rw-r--r--src/test/scala/xyz/driver/pdsuicommon/parsers/SearchFilterParserSuite.scala89
-rw-r--r--src/test/scala/xyz/driver/pdsuicommon/parsers/SortingParserSuite.scala37
-rw-r--r--src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala7
-rw-r--r--src/test/scala/xyz/driver/pdsuicommon/utils/StringOpsSuite.scala2
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala2
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ArmFormatSuite.scala9
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala20
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentHistoryFormatSuite.scala3
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentIssueFormatSuite.scala3
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala13
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala30
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala3
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala2
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ListResponseSuite.scala19
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordFormatSuite.scala20
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordHistoryFormatSuite.scala3
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordIssueFormatSuite.scala4
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala20
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala17
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala13
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala8
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientIssueFormatSuite.scala9
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala32
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala8
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialHistoryFormatSuite.scala3
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialIssueFormatSuite.scala8
95 files changed, 537 insertions, 727 deletions
diff --git a/build.sbt b/build.sbt
index bebf2aa..d68a8f5 100644
--- a/build.sbt
+++ b/build.sbt
@@ -18,8 +18,8 @@ lazy val core = (project in file("."))
"io.github.cloudify" %% "spdf" % "1.4.0",
"org.davidbild" %% "tristate-core" % "0.2.0",
"org.davidbild" %% "tristate-play" % "0.2.0" exclude ("com.typesafe.play", "play-json"),
- "xyz.driver" %% "core" % "1.2.1",
- "xyz.driver" %% "domain-model" % "0.17.5",
+ "xyz.driver" %% "core" % "1.2.2",
+ "xyz.driver" %% "domain-model" % "0.17.8",
"ch.qos.logback" % "logback-classic" % "1.1.7",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.8.4",
"com.github.spullara.mustache.java" % "scala-extensions-2.11" % "0.9.4",
diff --git a/src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala b/src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala
index 0daa84d..dc03a52 100644
--- a/src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala
+++ b/src/main/scala/xyz/driver/pdsuicommon/db/SlickQueryBuilder.scala
@@ -1,6 +1,6 @@
package xyz.driver.pdsuicommon.db
-import java.sql.PreparedStatement
+import java.sql.{JDBCType, PreparedStatement}
import java.time.LocalDateTime
import slick.jdbc.{JdbcProfile, PositionedParameters, SQLActionBuilder, SetParameter}
@@ -38,6 +38,12 @@ object SlickQueryBuilder {
})
}
}
+
+ implicit object SetQueryParameter extends SetParameter[AnyRef] {
+ def apply(v: AnyRef, pp: PositionedParameters) = {
+ pp.setObject(v, JDBCType.BINARY.getVendorTypeNumber)
+ }
+ }
}
final case class SlickTableLink(keyColumnName: String, foreignTableName: String, foreignKeyColumnName: String)
@@ -175,6 +181,16 @@ sealed trait SlickQueryBuilderParameters {
} else sql
}
+ def concatenateParameters(sql: SQLActionBuilder, first: Boolean, tail: Seq[AnyRef]): SQLActionBuilder = {
+ if (tail.nonEmpty) {
+ if (!first) {
+ concatenateParameters(sql concat sql""",${tail.head}""", false, tail.tail)
+ } else {
+ concatenateParameters(sql"""(${tail.head}""", false, tail.tail)
+ }
+ } else sql concat sql")"
+ }
+
filter match {
case x if isEmpty(x) =>
sql""
@@ -196,7 +212,7 @@ sealed trait SlickQueryBuilderParameters {
// So, to handle NotEq for nullable fields we need to use more complex SQL expression.
// http://dev.mysql.com/doc/refman/5.7/en/working-with-null.html
val escapedColumn = escapeDimension(dimension)
- sql"(#${escapedColumn} is null or #${escapedColumn} != ${value.toString})"
+ sql"(#${escapedColumn} is null or #${escapedColumn} != $value)"
case Atom.Binary(dimension, op, value) =>
val operator = op match {
@@ -208,7 +224,7 @@ sealed trait SlickQueryBuilderParameters {
case Lt => sql"<"
case LtEq => sql"<="
}
- sql"#${escapeDimension(dimension)}" concat operator concat sql"""${value.toString}"""
+ sql"#${escapeDimension(dimension)}" concat operator concat sql"""$value"""
case Atom.NAry(dimension, op, values) =>
val sqlOp = op match {
@@ -217,8 +233,7 @@ sealed trait SlickQueryBuilderParameters {
}
val formattedValues = if (values.nonEmpty) {
- val condition = s"(${values.map(v => "'" + v.toString + "'").mkString(",")})"
- sql"#${condition}"
+ concatenateParameters(sql"", true, values)
} else sql"NULL"
sql"#${escapeDimension(dimension)}" concat sqlOp concat formattedValues
diff --git a/src/main/scala/xyz/driver/pdsuicommon/domain/FuzzyValue.scala b/src/main/scala/xyz/driver/pdsuicommon/domain/FuzzyValue.scala
deleted file mode 100644
index 36c3de7..0000000
--- a/src/main/scala/xyz/driver/pdsuicommon/domain/FuzzyValue.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-package xyz.driver.pdsuicommon.domain
-
-import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuicommon.utils.Utils
-
-sealed trait FuzzyValue
-
-object FuzzyValue {
- case object Yes extends FuzzyValue
- case object No extends FuzzyValue
- case object Maybe extends FuzzyValue
-
- private val yes = "Yes"
- private val no = "No"
- private val maybe = "Maybe"
-
- val All: Set[FuzzyValue] =
- Set(Yes, No, Maybe)
-
- def fromBoolean(x: Boolean): FuzzyValue =
- if (x) Yes else No
-
- implicit def toPhiString(x: FuzzyValue): PhiString =
- Unsafe(Utils.getClassSimpleName(x.getClass))
-
- val fromString: PartialFunction[String, FuzzyValue] = {
- case fuzzy =>
- fuzzy.toLowerCase.capitalize match {
- case `yes` => Yes
- case `no` => No
- case `maybe` => Maybe
- }
- }
-
- def valueToString(x: FuzzyValue): String = x match {
- case Yes => `yes`
- case No => `no`
- case Maybe => `maybe`
- }
-}
diff --git a/src/main/scala/xyz/driver/pdsuicommon/json/JsonSerializer.scala b/src/main/scala/xyz/driver/pdsuicommon/json/JsonSerializer.scala
index a53f1dd..9383a1c 100644
--- a/src/main/scala/xyz/driver/pdsuicommon/json/JsonSerializer.scala
+++ b/src/main/scala/xyz/driver/pdsuicommon/json/JsonSerializer.scala
@@ -3,7 +3,7 @@ package xyz.driver.pdsuicommon.json
import java.text.SimpleDateFormat
import com.fasterxml.jackson.annotation.JsonInclude
-import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.{DeserializationFeature, ObjectMapper}
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper
@@ -15,6 +15,7 @@ object JsonSerializer {
mapper.registerModule(new JavaTimeModule)
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"))
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
def serialize(value: Any): String = {
mapper.writeValueAsString(value)
diff --git a/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala b/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala
index 83c4e6f..6d2a068 100644
--- a/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala
+++ b/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala
@@ -15,6 +15,7 @@ import xyz.driver.pdsuidomain.formats.json.sprayformats.trial._
import xyz.driver.pdsuidomain.formats.json.sprayformats.trialhistory._
import xyz.driver.pdsuidomain.formats.json.sprayformats.trialissue._
import xyz.driver.core.swagger.CustomSwaggerJsonConverter._
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue
import xyz.driver.pdsuidomain.services.CriterionService.RichCriterion
import xyz.driver.pdsuidomain.services.ExtractedDataService.RichExtractedData
@@ -32,7 +33,7 @@ object CustomSwaggerJsonFormats {
)
val customTrialCurationProperties = immutable.Map[Class[_], Property](
classOf[Trial.Status] -> stringProperty(),
- classOf[Trial.Condition] -> stringProperty(),
+ classOf[CancerType] -> stringProperty(),
classOf[TrialHistory.Action] -> stringProperty(),
classOf[TrialHistory.State] -> stringProperty()
) ++ customCommonProperties
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/DirectReport.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/DirectReport.scala
index 42ac55b..f35c3fd 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/DirectReport.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/DirectReport.scala
@@ -2,31 +2,14 @@ package xyz.driver.pdsuidomain.entities
import java.time.LocalDate
+import xyz.driver.entities.assays.AssayType
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuicommon.domain.UuidId
-import xyz.driver.pdsuicommon.utils.Utils
-import xyz.driver.pdsuidomain.entities.DirectReport.ReportType
object DirectReport {
-
- sealed trait ReportType extends Product with Serializable {
- def oneOf(xs: ReportType*): Boolean = xs.contains(this)
-
- def oneOf(xs: Set[ReportType]): Boolean = xs.contains(this)
- }
-
- object ReportType {
- case object IHC extends ReportType
- case object DNA extends ReportType
- case object CFDNA extends ReportType
-
- val All = Set(IHC, DNA, CFDNA)
- implicit def toPhiString(x: ReportType): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass))
- }
-
implicit def toPhiString(x: DirectReport): PhiString = {
import x._
- phi"DirectReport(id=$id, patientId=$patientId, reportType=$reportType, date=${Unsafe(date)}, " +
+ phi"DirectReport(id=$id, patientId=$patientId, reportType=${Unsafe(reportType)}, date=${Unsafe(date)}, " +
phi"documentType=${Unsafe(documentType)}, providerType=${Unsafe(providerType)}, " +
phi"providerName=${Unsafe(providerName)})"
}
@@ -34,8 +17,8 @@ object DirectReport {
final case class DirectReport(id: UuidId[DirectReport],
patientId: UuidId[Patient],
- reportType: ReportType,
+ reportType: AssayType,
date: LocalDate,
- documentType: String,
- providerType: String,
+ documentType: DocumentType,
+ providerType: ProviderType,
providerName: String)
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
index 168eb38..258aa03 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
@@ -308,13 +308,7 @@ object DocumentType {
object Document {
- final case class Meta(predicted: Option[Boolean], startPage: Double, endPage: Double) {
-
- /**
- * Return a regular meta: this meta is considered as not predicted
- */
- def confirmed: Meta = copy(predicted = predicted.map(_ => false))
- }
+ final case class Meta(startPage: Double, endPage: Double)
class DocumentStatusSerializer extends JsonSerializer[Status] {
def serialize(value: Status, gen: JsonGenerator, serializers: SerializerProvider): Unit = {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/EligibilityArm.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/EligibilityArm.scala
index 329c15c..50b49ad 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/EligibilityArm.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/EligibilityArm.scala
@@ -2,9 +2,9 @@ package xyz.driver.pdsuidomain.entities
import java.time.LocalDateTime
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.domain.{LongId, StringId}
import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.Trial.Condition
final case class EligibilityArm(id: LongId[EligibilityArm],
name: String,
@@ -20,7 +20,7 @@ object EligibilityArm {
}
}
-final case class EligibilityArmDisease(eligibilityArmId: LongId[EligibilityArm], disease: Condition)
+final case class EligibilityArmDisease(eligibilityArmId: LongId[EligibilityArm], disease: CancerType)
object EligibilityArmDisease {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala
index fbd468f..352cf55 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala
@@ -1,7 +1,7 @@
package xyz.driver.pdsuidomain.entities
-import xyz.driver.entities.labels.{Label, LabelCategory}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, TextJson}
+import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue}
+import xyz.driver.pdsuicommon.domain.{LongId, TextJson}
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.entities.ExtractedData.Meta
@@ -37,7 +37,7 @@ object ExtractedDataLabel {
implicit def toPhiString(x: ExtractedDataLabel): PhiString = {
import x._
- phi"ExtractedDataLabel(id=$id, dataId=$dataId, labelId=$labelId, categoryId=$categoryId, value=$value)"
+ phi"ExtractedDataLabel(id=$id, dataId=$dataId, labelId=$labelId, categoryId=$categoryId, value=${Unsafe(value)})"
}
}
@@ -45,4 +45,4 @@ final case class ExtractedDataLabel(id: LongId[ExtractedDataLabel],
dataId: LongId[ExtractedData],
labelId: Option[LongId[Label]],
categoryId: Option[LongId[LabelCategory]],
- value: Option[FuzzyValue])
+ value: Option[LabelValue])
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecord.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecord.scala
index 9b33af4..ed35db4 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecord.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecord.scala
@@ -22,55 +22,45 @@ object MedicalRecord {
))
trait Meta {
@JsonProperty("type") def metaType: String
- def predicted: Option[Boolean]
-
- /**
- * Return a regular meta: this meta is considered as not predicted
- */
- def confirmed: Meta
}
object Meta {
- final case class Duplicate(predicted: Option[Boolean],
- startPage: Double,
+ final case class Duplicate(startPage: Double,
endPage: Double,
startOriginalPage: Double,
endOriginalPage: Option[Double])
extends Meta {
- override val metaType = "duplicate"
- override def confirmed: Duplicate = copy(predicted = predicted.map(_ => false))
+ override val metaType = "duplicate"
}
object Duplicate {
implicit def toPhiString(x: Duplicate): PhiString = {
import x._
- phi"Duplicate(predicted=${x.predicted}, startPage=${Unsafe(startPage)}, endPage=${Unsafe(endPage)}, " +
+ phi"Duplicate(startPage=${Unsafe(startPage)}, endPage=${Unsafe(endPage)}, " +
phi"startOriginalPage=${Unsafe(startOriginalPage)}, endOriginalPage=${Unsafe(endOriginalPage)}"
}
}
- final case class Reorder(predicted: Option[Boolean], items: Seq[Int]) extends Meta {
- override val metaType = "reorder"
- override def confirmed: Reorder = copy(predicted = predicted.map(_ => false))
+ final case class Reorder(items: Seq[Int]) extends Meta {
+ override val metaType = "reorder"
}
object Reorder {
implicit def toPhiString(x: Reorder): PhiString = {
import x._
- phi"Reorder(predicted=${x.predicted}, items=${Unsafe(items.toString)})"
+ phi"Reorder(items=${Unsafe(items.toString)})"
}
}
- final case class Rotation(predicted: Option[Boolean], items: Map[String, Int]) extends Meta {
- override val metaType = "rotation"
- override def confirmed: Rotation = copy(predicted = predicted.map(_ => false))
+ final case class Rotation(items: Map[String, Int]) extends Meta {
+ override val metaType = "rotation"
}
object Rotation {
implicit def toPhiString(x: Rotation): PhiString = {
import x._
- phi"Rotation(predicted=${x.predicted}, items=${Unsafe(items.toString)})"
+ phi"Rotation(items=${Unsafe(items.toString)})"
}
}
@@ -166,8 +156,6 @@ final case class MedicalRecord(id: LongId[MedicalRecord],
caseId: Option[CaseId],
physician: Option[String],
meta: Option[TextJson[List[Meta]]],
- predictedMeta: Option[TextJson[List[Meta]]],
- predictedDocuments: Option[TextJson[List[Document]]],
lastUpdate: LocalDateTime) {
import MedicalRecord.Status._
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Patient.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Patient.scala
index 6be0b88..598b11e 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Patient.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Patient.scala
@@ -2,6 +2,8 @@ package xyz.driver.pdsuidomain.entities
import java.time.{LocalDate, LocalDateTime}
+import xyz.driver.entities.common.FullName
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuicommon.utils.Utils
@@ -52,14 +54,14 @@ object Patient {
final case class Patient(id: UuidId[Patient],
status: Patient.Status,
- name: String,
+ name: FullName[Patient],
dob: LocalDate,
assignee: Option[StringId[User]],
previousStatus: Option[Patient.Status],
previousAssignee: Option[StringId[User]],
lastActiveUserId: Option[StringId[User]],
isUpdateRequired: Boolean,
- condition: String,
+ disease: CancerType,
orderId: PatientOrderId,
lastUpdate: LocalDateTime) {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala
index 469b21c..79a19ed 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala
@@ -2,7 +2,8 @@ package xyz.driver.pdsuidomain.entities
import java.time.LocalDateTime
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId}
+import xyz.driver.entities.labels.LabelValue
+import xyz.driver.pdsuicommon.domain.{LongId, StringId}
import xyz.driver.pdsuicommon.logging._
object PatientCriterion {
@@ -18,15 +19,15 @@ object PatientCriterion {
/**
* @see https://driverinc.atlassian.net/wiki/display/MTCH/EV+Business+Process
*/
- def getEligibilityStatus(criterionValue: Option[Boolean], primaryValue: Option[FuzzyValue]): Option[FuzzyValue] = {
+ def getEligibilityStatus(criterionValue: Option[Boolean], primaryValue: Option[LabelValue]): Option[LabelValue] = {
primaryValue match {
case None => None
- case Some(FuzzyValue.Maybe) => Some(FuzzyValue.Maybe)
- case Some(_) if criterionValue.isEmpty => Some(FuzzyValue.Maybe)
+ case Some(LabelValue.Maybe) => Some(LabelValue.Maybe)
+ case Some(_) if criterionValue.isEmpty => Some(LabelValue.Maybe)
case Some(status) =>
Some(
- FuzzyValue.fromBoolean(
- FuzzyValue.fromBoolean(
+ LabelValue.fromBoolean(
+ LabelValue.fromBoolean(
criterionValue.getOrElse(throw new IllegalArgumentException("Criterion should not be empty"))) == status
))
}
@@ -47,12 +48,12 @@ final case class PatientCriterion(id: LongId[PatientCriterion],
criterionText: String,
criterionValue: Option[Boolean],
criterionIsDefining: Boolean,
- eligibilityStatus: Option[FuzzyValue],
- verifiedEligibilityStatus: Option[FuzzyValue],
+ eligibilityStatus: Option[LabelValue],
+ verifiedEligibilityStatus: Option[LabelValue],
isVerified: Boolean,
isVisible: Boolean,
lastUpdate: LocalDateTime) {
- def isIneligibleForEv: Boolean = eligibilityStatus.contains(FuzzyValue.No) && isVerified
+ def isIneligibleForEv: Boolean = eligibilityStatus.contains(LabelValue.No) && isVerified
}
object PatientCriterionArm {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientEligibleTrial.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientEligibleTrial.scala
index 8ee5b3c..ff272a8 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientEligibleTrial.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientEligibleTrial.scala
@@ -1,6 +1,7 @@
package xyz.driver.pdsuidomain.entities
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId}
+import xyz.driver.entities.labels.LabelValue
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuicommon.logging._
object PatientTrialArm {
@@ -37,22 +38,22 @@ object PatientTrialArmGroup {
/**
* @see https://driverinc.atlassian.net/wiki/display/DMPD/EV+Business+Process
*/
- def getEligibilityStatusForRc(criterionList: TraversableOnce[PatientCriterion]): Option[FuzzyValue] = {
- def isEligible: Boolean = criterionList.forall(_.verifiedEligibilityStatus.contains(FuzzyValue.Yes))
- def isIneligible: Boolean = criterionList.exists(_.verifiedEligibilityStatus.contains(FuzzyValue.No))
+ def getEligibilityStatusForRc(criterionList: TraversableOnce[PatientCriterion]): Option[LabelValue] = {
+ def isEligible: Boolean = criterionList.forall(_.verifiedEligibilityStatus.contains(LabelValue.Yes))
+ def isIneligible: Boolean = criterionList.exists(_.verifiedEligibilityStatus.contains(LabelValue.No))
def isUnknown: Boolean = criterionList.forall(_.verifiedEligibilityStatus.isEmpty)
- if (isEligible) Some(FuzzyValue.Yes)
- else if (isIneligible) Some(FuzzyValue.No)
+ if (isEligible) Some(LabelValue.Yes)
+ else if (isIneligible) Some(LabelValue.No)
else if (isUnknown) None
- else Some(FuzzyValue.Maybe)
+ else Some(LabelValue.Maybe)
}
}
final case class PatientTrialArmGroup(id: LongId[PatientTrialArmGroup],
eligibleTrialId: UuidId[PatientEligibleTrial],
- eligibilityStatus: Option[FuzzyValue],
- verifiedEligibilityStatus: Option[FuzzyValue],
+ eligibilityStatus: Option[LabelValue],
+ verifiedEligibilityStatus: Option[LabelValue],
isVerified: Boolean)
object PatientTrialArmGroupView {
@@ -69,8 +70,8 @@ final case class PatientTrialArmGroupView(id: LongId[PatientTrialArmGroup],
patientId: UuidId[Patient],
trialId: StringId[Trial],
hypothesisId: UuidId[Hypothesis],
- eligibilityStatus: Option[FuzzyValue],
- verifiedEligibilityStatus: Option[FuzzyValue],
+ eligibilityStatus: Option[LabelValue],
+ verifiedEligibilityStatus: Option[LabelValue],
isVerified: Boolean) {
def applyTo(trialArmGroup: PatientTrialArmGroup) = {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala
index d10c7d2..4c0f4ef 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala
@@ -1,7 +1,7 @@
package xyz.driver.pdsuidomain.entities
-import xyz.driver.entities.labels.Label
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, UuidId}
+import xyz.driver.entities.labels.{Label, LabelValue}
+import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
import xyz.driver.pdsuicommon.logging._
object PatientLabel {
@@ -17,8 +17,8 @@ final case class PatientLabel(id: LongId[PatientLabel],
patientId: UuidId[Patient],
labelId: LongId[Label],
score: Int,
- primaryValue: Option[FuzzyValue],
- verifiedPrimaryValue: Option[FuzzyValue],
+ primaryValue: Option[LabelValue],
+ verifiedPrimaryValue: Option[LabelValue],
isImplicitMatch: Boolean,
isVisible: Boolean)
@@ -32,7 +32,7 @@ object PatientLabelEvidence {
final case class PatientLabelEvidence(id: LongId[PatientLabelEvidence],
patientLabelId: LongId[PatientLabel],
- value: FuzzyValue,
+ value: LabelValue,
evidenceText: String,
reportId: Option[UuidId[DirectReport]],
documentId: Option[LongId[Document]],
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
index 3311d96..6055921 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
@@ -2,28 +2,28 @@ package xyz.driver.pdsuidomain.entities
import java.time.LocalDate
-import xyz.driver.entities.labels.Label
+import xyz.driver.entities.labels.{Label, LabelValue}
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
object PatientLabelEvidenceView {
implicit def toPhiString(x: PatientLabelEvidenceView): PhiString = {
import x._
- phi"PatientLabelEvidenceView(id=$id, value=$value, documentId=$documentId, " +
+ phi"PatientLabelEvidenceView(id=$id, value=${Unsafe(value)}, documentId=$documentId, " +
phi"evidenceId=$evidenceId, reportId=$reportId, patientId=$patientId, labelId=$labelId, " +
phi"isImplicitMatch=$isImplicitMatch)"
}
}
final case class PatientLabelEvidenceView(id: LongId[PatientLabelEvidence],
- value: FuzzyValue,
+ value: LabelValue,
evidenceText: String,
documentId: Option[LongId[Document]],
evidenceId: Option[LongId[ExtractedData]],
reportId: Option[UuidId[DirectReport]],
- documentType: String,
+ documentType: DocumentType,
date: Option[LocalDate], // Document.startDate is optional
- providerType: String,
+ providerType: ProviderType,
patientId: UuidId[Patient],
labelId: LongId[Label],
isImplicitMatch: Boolean)
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala
deleted file mode 100644
index 689eaa4..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-package xyz.driver.pdsuidomain.entities
-
-import java.time.LocalDate
-
-import xyz.driver.entities.labels.Label
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, UuidId}
-import xyz.driver.pdsuicommon.logging._
-
-final case class RawPatientLabel(patientId: UuidId[Patient],
- labelId: LongId[Label],
- value: FuzzyValue,
- evidenceId: LongId[ExtractedData],
- evidenceText: String,
- disease: String,
- documentId: LongId[Document],
- requestId: RecordRequestId,
- documentType: DocumentType,
- providerType: ProviderType,
- startDate: LocalDate,
- endDate: Option[LocalDate])
-
-object RawPatientLabel {
-
- implicit def toPhiString(x: RawPatientLabel): PhiString = {
- import x._
- phi"RawPatientLabel(patientId=$patientId, labelId=$labelId, value=$value, evidenceId=${Unsafe(evidenceId)}, " +
- phi"evidenceText=${Unsafe(evidenceText)}, documentId=$documentId, requestId=${Unsafe(requestId)}, " +
- phi"documentType=${Unsafe(documentType)}, providerType=${Unsafe(providerType)}, " +
- phi"startDate=$startDate, endDate=$endDate)"
- }
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala
deleted file mode 100644
index bdbc4ea..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package xyz.driver.pdsuidomain.entities
-
-import java.time.LocalDateTime
-
-import xyz.driver.entities.labels.Label
-import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
-import xyz.driver.pdsuicommon.logging._
-
-final case class RawTrialLabel(nctId: StringId[Trial],
- trialId: UuidId[Trial],
- condition: String,
- lastReviewed: LocalDateTime,
- armName: String,
- armId: LongId[Arm],
- labelId: LongId[Label],
- value: Option[Boolean],
- criterionId: LongId[Criterion],
- criteria: String,
- criterionArmId: LongId[Arm],
- isCompound: Boolean,
- isDefining: Boolean)
-
-object RawTrialLabel {
-
- implicit def toPhiString(x: RawTrialLabel): PhiString = {
- import x._
- phi"RawTrialLabel(nctId=$nctId, trialId=$trialId, condition=${Unsafe(condition)}, lastReviewed=$lastReviewed, " +
- phi"armId=$armId, armName=${Unsafe(armName)}, labelId=$labelId, value=$value, " +
- phi"criterionId=$criterionId, criteria=${Unsafe(criteria)}, criterionArmId=$criterionArmId, " +
- phi"isCompound=$isCompound, isDefining=$isDefining)"
- }
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala
index f9aed6c..70114de 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala
@@ -3,9 +3,7 @@ package xyz.driver.pdsuidomain.entities
import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuicommon.logging._
-final case class SlotArmEligibilityArm(slotArmId: LongId[SlotArm],
- eligibilityArmId: LongId[EligibilityArm])
-
+final case class SlotArmEligibilityArm(slotArmId: LongId[SlotArm], eligibilityArmId: LongId[EligibilityArm])
object SlotArmEligibilityArm {
implicit def toPhiString(x: SlotArmEligibilityArm): PhiString = {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Trial.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Trial.scala
index bd86057..2aa7fe1 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Trial.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Trial.scala
@@ -58,24 +58,24 @@ object Trial {
}
final case class Locations(locations: List[String])
-
- sealed trait Condition
-
- object Condition {
-
- case object Breast extends Condition
- case object Lung extends Condition
- case object Prostate extends Condition
-
- def fromString(condition: String): Option[Condition] = condition match {
- case "Breast" => Some(Breast)
- case "Lung" => Some(Lung)
- case "Prostate" => Some(Prostate)
- case _ => None
- }
-
- val All: Set[Condition] = Set(Breast, Lung, Prostate)
- }
+//
+// sealed trait Condition
+//
+// object Condition {
+//
+// case object Breast extends Condition
+// case object Lung extends Condition
+// case object Prostate extends Condition
+//
+// def fromString(condition: String): Option[Condition] = condition match {
+// case "Breast" => Some(Breast)
+// case "Lung" => Some(Lung)
+// case "Prostate" => Some(Prostate)
+// case _ => None
+// }
+//
+// val All: Set[Condition] = Set(Breast, Lung, Prostate)
+// }
}
final case class Trial(id: StringId[Trial],
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala
index 2edd707..957e607 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala
@@ -3,7 +3,6 @@ package xyz.driver.pdsuidomain.entities.export.patient
import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.RawPatientLabel
final case class ExportPatientLabel(id: LongId[Label], evidences: List[ExportPatientLabelEvidence])
@@ -13,8 +12,4 @@ object ExportPatientLabel extends PhiLogging {
import x._
phi"ExportPatientLabel(id=$id, evidences=$evidences)"
}
-
- def fromRaw(labelId: LongId[Label], rawPatientLabels: List[RawPatientLabel]): ExportPatientLabel = {
- ExportPatientLabel(id = labelId, evidences = rawPatientLabels.map(ExportPatientLabelEvidence.fromRaw))
- }
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala
index fb40339..6472a6b 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala
@@ -1,11 +1,12 @@
package xyz.driver.pdsuidomain.entities.export.patient
+import xyz.driver.entities.labels.LabelValue
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{ExtractedData, RawPatientLabel}
+import xyz.driver.pdsuidomain.entities.ExtractedData
final case class ExportPatientLabelEvidence(id: LongId[ExtractedData],
- value: FuzzyValue,
+ value: LabelValue,
evidenceText: String,
document: ExportPatientLabelEvidenceDocument)
@@ -13,20 +14,8 @@ object ExportPatientLabelEvidence {
implicit def toPhiString(x: ExportPatientLabelEvidence): PhiString = {
import x._
- phi"ExportPatientLabelEvidence(id=${Unsafe(id)}, value=$value, " +
+ phi"ExportPatientLabelEvidence(id=${Unsafe(id)}, value=${Unsafe(value)}, " +
phi"evidenceText=${Unsafe(evidenceText)}, document=$document)"
}
- def fromRaw(x: RawPatientLabel) = ExportPatientLabelEvidence(
- id = x.evidenceId,
- value = x.value,
- evidenceText = x.evidenceText,
- document = ExportPatientLabelEvidenceDocument(
- x.documentId,
- x.requestId,
- x.documentType,
- x.providerType,
- x.startDate
- )
- )
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala
index 7003615..467170b 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala
@@ -19,12 +19,4 @@ object ExportPatientLabelEvidenceDocument extends PhiLogging {
phi"ExportPatientLabelEvidenceDocument(documentId=$documentId, requestId=$requestId, " +
phi"documentType=${Unsafe(documentType)}, providerType=${Unsafe(providerType)}, date=$date)"
}
-
- def fromRaw(x: RawPatientLabel) = ExportPatientLabelEvidenceDocument(
- documentId = x.documentId,
- requestId = x.requestId,
- documentType = x.documentType,
- providerType = x.providerType,
- date = x.startDate
- )
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala
index bd6173b..8fb2660 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala
@@ -2,9 +2,7 @@ package xyz.driver.pdsuidomain.entities.export.patient
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{Patient, RawPatientLabel}
-
-import scala.collection.breakOut
+import xyz.driver.pdsuidomain.entities.Patient
final case class ExportPatientWithLabels(patientId: UuidId[Patient],
labelVersion: Long,
@@ -16,12 +14,4 @@ object ExportPatientWithLabels {
import x._
phi"ExportPatientWithLabels(patientId=$patientId, version=${Unsafe(labelVersion)}, labels=$labels)"
}
-
- def fromRaw(patientId: UuidId[Patient], rawPatientRefs: List[RawPatientLabel]) = ExportPatientWithLabels(
- patientId = patientId,
- labelVersion = 1L, // TODO It is needed to replace this mock label version.
- labels = rawPatientRefs
- .groupBy(_.labelId)
- .map(Function.tupled(ExportPatientLabel.fromRaw))(breakOut)
- )
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala
index 1f06e0d..385bbbe 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala
@@ -3,7 +3,7 @@ package xyz.driver.pdsuidomain.entities.export.trial
import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{Arm, Criterion, RawTrialLabel}
+import xyz.driver.pdsuidomain.entities.{Arm, Criterion}
final case class ExportTrialLabelCriterion(criterionId: LongId[Criterion],
value: Option[Boolean],
@@ -20,14 +20,4 @@ object ExportTrialLabelCriterion {
phi"TrialLabelCriterion(criterionId=$criterionId, value=$value, labelId=$labelId, " +
phi"criteria=${Unsafe(criteria)}, isCompound=$isCompound, isDefining=$isDefining)"
}
-
- def fromRaw(x: RawTrialLabel, armIds: Set[LongId[Arm]]) = ExportTrialLabelCriterion(
- criterionId = x.criterionId,
- value = x.value,
- labelId = x.labelId,
- armIds = armIds,
- criteria = x.criteria,
- isCompound = x.isCompound,
- isDefining = x.isDefining
- )
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala
index cf55694..3a9434b 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala
@@ -4,13 +4,11 @@ import java.time.LocalDateTime
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{RawTrialLabel, Trial}
-
-import scala.collection.breakOut
+import xyz.driver.pdsuidomain.entities.Trial
final case class ExportTrialWithLabels(nctId: StringId[Trial],
trialId: UuidId[Trial],
- condition: String,
+ disease: String,
lastReviewed: LocalDateTime,
labelVersion: Long,
arms: List[ExportTrialArm],
@@ -20,35 +18,7 @@ object ExportTrialWithLabels {
implicit def toPhiString(x: ExportTrialWithLabels): PhiString = {
import x._
- phi"TrialWithLabels(nctId=$nctId, trialId=$trialId, condition=${Unsafe(condition)}, " +
+ phi"TrialWithLabels(nctId=$nctId, trialId=$trialId, disease=${Unsafe(disease)}, " +
phi"lastReviewed=$lastReviewed, labelVersion=${Unsafe(labelVersion)}, arms=$arms, criteria=$criteria)"
}
-
- def fromRaw(rawData: List[RawTrialLabel]): ExportTrialWithLabels = {
- val trials: Set[StringId[Trial]] = rawData.map(_.nctId)(breakOut)
-
- assert(trials.size == 1, "There are more than one trial in the rawData")
- val trial = rawData.head
-
- ExportTrialWithLabels(
- nctId = trial.nctId,
- trialId = trial.trialId,
- condition = trial.condition,
- lastReviewed = trial.lastReviewed,
- labelVersion = 1, // TODO It is needed to replace this mock label version.
- arms = rawData
- .groupBy(_.armId)
- .map {
- case (armId, rawTrials) =>
- ExportTrialArm(armId, rawTrials.head.armName)
- }(breakOut),
- criteria = rawData
- .groupBy(x => (x.criterionId, x.labelId))
- .map {
- case (_, rawTrialLabels) =>
- val armIds = rawTrialLabels.map(_.criterionArmId).toSet
- ExportTrialLabelCriterion.fromRaw(rawTrialLabels.head, armIds)
- }(breakOut)
- )
- }
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
index 7318ff6..f77c2e0 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
@@ -3,7 +3,7 @@ package xyz.driver.pdsuidomain.fakes.entities
import java.time.{LocalDate, LocalDateTime, LocalTime}
import xyz.driver.core.generators.{nextDouble, nextOption}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId}
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuidomain.entities.{Trial, TrialHistory}
import scala.util.Random
@@ -29,8 +29,6 @@ object common {
1 + Random.nextInt(28) // all months have at least 28 days
)
- def nextCondition = generators.oneOf[Trial.Condition](Trial.Condition.All)
-
def nextTrialAction = generators.oneOf[TrialHistory.Action](TrialHistory.Action.All)
def nextTrialState = generators.oneOf[TrialHistory.State](TrialHistory.State.All)
@@ -52,9 +50,6 @@ object common {
ranges.map(_._1) -> ranges.flatMap(_._2)
}
- def nextFuzzyValue(): FuzzyValue =
- generators.oneOf[FuzzyValue](FuzzyValue.All)
-
def nextStartAndEndPages: (Option[Double], Option[Double]) =
genBoundedRangeOption[Double](nextDouble(), nextDouble())
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala
index 7f3c410..a3ba562 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala
@@ -26,7 +26,7 @@ object export {
ExportTrialWithLabels(
nctId = nextStringId[Trial],
trialId = nextUuidId[Trial],
- condition = nextString(100),
+ disease = nextString(100),
lastReviewed = nextLocalDateTime,
labelVersion = nextInt(100).toLong,
arms = listOf(nextExportTrialArm()),
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
index 94eb029..0dadc41 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
@@ -40,12 +40,7 @@ object DocumentGen {
def nextDocumentMeta(): Document.Meta = {
val (startPage, endPage) = nextStartAndEndPage()
-
- Document.Meta(
- nextOption(nextBoolean()),
- startPage,
- endPage
- )
+ Document.Meta(startPage, endPage)
}
def nextDocumentMetaJson(): TextJson[Document.Meta] = {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
index 3fcc4cb..85bab8c 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
@@ -1,9 +1,9 @@
package xyz.driver.pdsuidomain.fakes.entities.rep
+import xyz.driver.core.generators
import xyz.driver.core.generators._
-import xyz.driver.entities.labels.Label
+import xyz.driver.entities.labels.{Label, LabelValue}
import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
-import xyz.driver.pdsuidomain.fakes.entities.common._
import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.entities.export.patient._
import xyz.driver.pdsuidomain.fakes.entities.common.{nextLocalDate, nextLongId}
@@ -26,7 +26,7 @@ object ExportPatientGen {
def nextExportPatientLabelEvidence(documentId: LongId[Document]): ExportPatientLabelEvidence = {
ExportPatientLabelEvidence(
id = nextLongId[ExtractedData],
- value = nextFuzzyValue(),
+ value = generators.oneOf[LabelValue](LabelValue.Yes, LabelValue.No, LabelValue.Maybe),
evidenceText = nextString(),
document = nextExportPatientLabelEvidenceDocument(documentId)
)
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala
index 8e77445..70ddd10 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala
@@ -1,7 +1,8 @@
package xyz.driver.pdsuidomain.fakes.entities.rep
+import xyz.driver.core.generators
import xyz.driver.core.generators._
-import xyz.driver.entities.labels.{Label, LabelCategory}
+import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue}
import xyz.driver.pdsuicommon.domain.{LongId, TextJson}
import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.entities.ExtractedData.Meta
@@ -85,7 +86,7 @@ object ExtractedDataGen {
dataId = nextLongId[ExtractedData],
labelId = nextOption(nextLongId[Label]),
categoryId = nextOption(nextLongId[LabelCategory]),
- value = nextOption(nextFuzzyValue())
+ value = nextOption(generators.oneOf[LabelValue](LabelValue.Yes, LabelValue.No, LabelValue.Maybe))
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala
index 2777116..254968a 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala
@@ -49,15 +49,10 @@ object MedicalRecordGen {
generators.oneOf[MedicalRecordHistory.Action](MedicalRecordHistory.Action.All)
def nextMedicalRecordMetaReorder(): MedicalRecord.Meta.Reorder = {
- val itemsNumber =
- maxItemsInCollectionNumber
- val items = scala.util.Random
- .shuffle(Seq.tabulate(itemsNumber)(identity))
-
- MedicalRecord.Meta.Reorder(
- predicted = nextOption(nextBoolean),
- items = items
- )
+ val itemsNumber = maxItemsInCollectionNumber
+ val items = scala.util.Random.shuffle(Seq.tabulate(itemsNumber)(identity))
+
+ MedicalRecord.Meta.Reorder(items)
}
def nextMedicalRecordMetaDuplicate(): MedicalRecord.Meta.Duplicate = {
@@ -67,7 +62,6 @@ object MedicalRecordGen {
nextInt(pageMaxNumber, startPageGen)
MedicalRecord.Meta.Duplicate(
- predicted = nextOption(nextBoolean),
startPage = startPageGen.toDouble,
endPage = endPageGen.toDouble,
startOriginalPage = startPageGen.toDouble,
@@ -76,17 +70,9 @@ object MedicalRecordGen {
}
def nextMedicalRecordMetaRotation(): MedicalRecord.Meta.Rotation = {
- val items =
- Array
- .tabulate(maxItemsInCollectionNumber)(
- index => nextString() -> index
- )
- .toMap
-
- MedicalRecord.Meta.Rotation(
- predicted = nextOption(nextBoolean()),
- items = items
- )
+ val items = Array.tabulate(maxItemsInCollectionNumber)(index => nextString() -> index).toMap
+
+ MedicalRecord.Meta.Rotation(items = items)
}
def nextMedicalRecordMeta(): MedicalRecord.Meta = {
@@ -94,7 +80,6 @@ object MedicalRecordGen {
}
def nextMedicalRecord(): MedicalRecord = {
- val id = nextLongId[MedicalRecord]
MedicalRecord(
id = nextLongId[MedicalRecord],
status = nextMedicalRecordStatus(),
@@ -108,8 +93,6 @@ object MedicalRecordGen {
caseId = nextOption(CaseId(generators.nextString())),
physician = nextOption(generators.nextString()),
meta = nextOption(nextMedicalRecordMetasJson()),
- predictedMeta = nextOption(nextMedicalRecordMetasJson()),
- predictedDocuments = nextOption(nextDocuments(id)),
lastUpdate = nextLocalDateTime
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala
index 86ea765..ade0115 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala
@@ -6,8 +6,8 @@ import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.services.CriterionService.RichCriterion
object trialcuration {
- import xyz.driver.core.generators
import common._
+ import xyz.driver.core.generators
import xyz.driver.pdsuidomain.entities.InterventionType._
def nextTrial(): Trial = Trial(
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala
index 4d6d0a2..71423e8 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala
@@ -2,10 +2,15 @@ package xyz.driver.pdsuidomain.formats.json.eligibilityarm
import play.api.libs.functional.syntax._
import play.api.libs.json._
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.{EligibilityArm, EligibilityArmDisease, EligibilityArmWithDiseases, Trial}
+import xyz.driver.pdsuidomain.entities.{EligibilityArm, EligibilityArmDisease, EligibilityArmWithDiseases}
-final case class ApiEligibilityArm(id: Long, name: String, originalName: String, trialId: String, diseases: Seq[String]) {
+final case class ApiEligibilityArm(id: Long,
+ name: String,
+ originalName: String,
+ trialId: String,
+ diseases: Seq[String]) {
def toDomain: EligibilityArmWithDiseases = {
val eligibilityArm = EligibilityArm(
@@ -16,11 +21,15 @@ final case class ApiEligibilityArm(id: Long, name: String, originalName: String,
deleted = None // if we have an ApiEligibilityArm object, the EligibilityArm itself has not been deleted
)
- EligibilityArmWithDiseases(eligibilityArm, this.diseases.map { disease =>
- val condition = Trial.Condition.fromString(disease)
- .getOrElse(throw new NoSuchElementException(s"unknown condition $disease"))
- EligibilityArmDisease(eligibilityArm.id, condition)
- })
+ EligibilityArmWithDiseases(
+ eligibilityArm,
+ this.diseases.map { disease =>
+ val condition = CancerType
+ .fromString(disease)
+ .getOrElse(throw new NoSuchElementException(s"unknown condition $disease"))
+ EligibilityArmDisease(eligibilityArm.id, condition)
+ }
+ )
}
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityCreateArm.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityCreateArm.scala
index 6cf71a2..087fed5 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityCreateArm.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityCreateArm.scala
@@ -1,8 +1,9 @@
package xyz.driver.pdsuidomain.formats.json.eligibilityarm
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.entities.{EligibilityArm, EligibilityArmDisease, EligibilityArmWithDiseases, Trial}
import play.api.libs.json.{Format, Json}
+import xyz.driver.entities.patient.CancerType
+import xyz.driver.pdsuicommon.domain.{LongId, StringId}
+import xyz.driver.pdsuidomain.entities.{EligibilityArm, EligibilityArmDisease, EligibilityArmWithDiseases}
final case class ApiCreateEligibilityArm(name: String, trialId: String, diseases: Seq[String]) {
@@ -14,11 +15,15 @@ final case class ApiCreateEligibilityArm(name: String, trialId: String, diseases
originalName = name
)
- EligibilityArmWithDiseases(eligibilityArm, diseases.map { disease =>
- val condition = Trial.Condition.fromString(disease)
- .getOrElse(throw new NoSuchElementException(s"unknown condition $disease"))
- EligibilityArmDisease(eligibilityArm.id, condition)
- })
+ EligibilityArmWithDiseases(
+ eligibilityArm,
+ diseases.map { disease =>
+ val condition = CancerType
+ .fromString(disease)
+ .getOrElse(throw new NoSuchElementException(s"unknown condition $disease"))
+ EligibilityArmDisease(eligibilityArm.id, condition)
+ }
+ )
}
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiPartialEligibilityArm.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiPartialEligibilityArm.scala
index 3d9445f..aca22ef 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiPartialEligibilityArm.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiPartialEligibilityArm.scala
@@ -1,7 +1,8 @@
package xyz.driver.pdsuidomain.formats.json.eligibilityarm
import play.api.libs.json.{Format, Json}
-import xyz.driver.pdsuidomain.entities.{EligibilityArmDisease, EligibilityArmWithDiseases, Trial}
+import xyz.driver.entities.patient.CancerType
+import xyz.driver.pdsuidomain.entities.{EligibilityArmDisease, EligibilityArmWithDiseases}
final case class ApiPartialEligibilityArm(name: String, diseases: Seq[String]) {
@@ -10,9 +11,9 @@ final case class ApiPartialEligibilityArm(name: String, diseases: Seq[String]) {
val armDiseases = diseases.map { disease =>
EligibilityArmDisease(
armWithDisease.eligibilityArm.id,
- Trial.Condition.fromString(disease).getOrElse(throw new NoSuchElementException(s"unknown condition $disease")))
+ CancerType.fromString(disease).getOrElse(throw new NoSuchElementException(s"unknown condition $disease")))
}
- EligibilityArmWithDiseases(arm ,armDiseases)
+ EligibilityArmWithDiseases(arm, armDiseases)
}
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala
index e0f23e3..c7a6de9 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala
@@ -3,7 +3,6 @@ package xyz.driver.pdsuidomain.formats.json.evidence
import java.time.LocalDate
import play.api.libs.json._
-import xyz.driver.pdsuicommon.domain.FuzzyValue
import xyz.driver.pdsuidomain.entities.PatientLabelEvidenceView
final case class ApiPatientLabelEvidence(id: Long,
@@ -22,13 +21,13 @@ object ApiPatientLabelEvidence {
def fromDomain(x: PatientLabelEvidenceView) = ApiPatientLabelEvidence(
id = x.id.id,
- value = FuzzyValue.valueToString(x.value),
+ value = x.value.toString,
evidenceText = x.evidenceText,
documentId = x.documentId.map(_.id),
evidenceId = x.evidenceId.map(_.id),
reportId = x.reportId.map(_.toString),
- documentType = x.documentType,
+ documentType = x.documentType.name,
date = x.date.get,
- providerType = x.providerType
+ providerType = x.providerType.name
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala
index d486749..edb0603 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala
@@ -1,11 +1,11 @@
package xyz.driver.pdsuidomain.formats.json.label
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId}
+import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuidomain.entities.{Criterion, CriterionLabel}
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json._
-import xyz.driver.entities.labels.{Label, LabelCategory}
+import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue}
/**
* @param value Yes|No
@@ -34,7 +34,7 @@ object ApiCriterionLabel {
labelId = x.labelId.map(_.id),
categoryId = x.categoryId.map(_.id),
value = x.value.map { x =>
- FuzzyValue.valueToString(FuzzyValue.fromBoolean(x))
+ LabelValue.fromBoolean(x).toString
},
isDefining = x.isDefining
)
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala
index f8161af..1497679 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala
@@ -1,11 +1,11 @@
package xyz.driver.pdsuidomain.formats.json.label
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId}
+import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuidomain.entities.{ExtractedData, ExtractedDataLabel}
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json._
-import xyz.driver.entities.labels.{Label, LabelCategory}
+import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue}
final case class ApiExtractedDataLabel(id: Option[Long], categoryId: Option[Long], value: Option[String]) {
@@ -14,7 +14,7 @@ final case class ApiExtractedDataLabel(id: Option[Long], categoryId: Option[Long
dataId = dataId,
labelId = id.map(LongId[Label]),
categoryId = categoryId.map(LongId[LabelCategory]),
- value = value.map(FuzzyValue.fromString)
+ value = value.flatMap(LabelValue.fromString)
)
}
@@ -27,8 +27,8 @@ object ApiExtractedDataLabel {
Format(Reads
.of[String]
.filter(ValidationError("unknown value"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}),
Writes.of[String]))
)(ApiExtractedDataLabel.apply, unlift(ApiExtractedDataLabel.unapply))
@@ -36,6 +36,6 @@ object ApiExtractedDataLabel {
def fromDomain(dataLabel: ExtractedDataLabel) = ApiExtractedDataLabel(
id = dataLabel.labelId.map(_.id),
categoryId = dataLabel.categoryId.map(_.id),
- value = dataLabel.value.map(FuzzyValue.valueToString)
+ value = dataLabel.value.map(_.toString)
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala
index db430ae..585d4ed 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala
@@ -7,6 +7,8 @@ import xyz.driver.pdsuicommon.domain.{StringId, UuidId}
import xyz.driver.pdsuidomain.entities.{Patient, PatientOrderId}
import play.api.libs.functional.syntax._
import play.api.libs.json.{Format, JsPath}
+import xyz.driver.entities.common.FullName
+import xyz.driver.entities.patient
final case class ApiPatient(id: String,
status: String,
@@ -17,24 +19,35 @@ final case class ApiPatient(id: String,
previousAssignee: Option[String],
lastActiveUser: Option[String],
lastUpdate: ZonedDateTime,
- condition: String,
+ disease: String,
orderId: UUID) {
private def extractStatus(status: String): Patient.Status =
PatientStatus.statusFromString
.applyOrElse(status, (s: String) => throw new NoSuchElementException(s"Unknown status $s"))
+ private def parseName(name: String): FullName[Patient] =
+ name.split(" ") match {
+ case Array() => throw new NoSuchElementException(s"Patient's name cannot be empty")
+ case Array(first) => FullName.fromStrings[Patient](first, "", "")
+ case Array(first, last) => FullName.fromStrings[Patient](first, "", last)
+ case Array(first, middle, last) => FullName.fromStrings[Patient](first, middle, last)
+ case _ => throw new NoSuchElementException(s"Patient's name is ambiguous")
+ }
+
def toDomain = Patient(
id = UuidId(this.id),
status = extractStatus(this.status),
- name = this.name,
+ name = parseName(this.name),
dob = this.dob,
assignee = this.assignee.map(StringId(_)),
previousStatus = this.previousStatus.map(extractStatus),
previousAssignee = this.previousAssignee.map(StringId(_)),
lastActiveUserId = this.lastActiveUser.map(StringId(_)),
isUpdateRequired = false,
- condition = this.condition,
+ disease = patient.CancerType
+ .fromString(this.disease)
+ .getOrElse(throw new IllegalArgumentException(s"Unknown cancer type ${this.disease}")),
orderId = PatientOrderId(this.orderId),
lastUpdate = this.lastUpdate.toLocalDateTime
)
@@ -53,21 +66,21 @@ object ApiPatient {
(JsPath \ "previousAssignee").formatNullable[String] and
(JsPath \ "lastActiveUser").formatNullable[String] and
(JsPath \ "lastUpdate").format[ZonedDateTime] and
- (JsPath \ "condition").format[String] and
+ (JsPath \ "disease").format[String] and
(JsPath \ "orderId").format[UUID]
)(ApiPatient.apply, unlift(ApiPatient.unapply))
def fromDomain(patient: Patient) = ApiPatient(
id = patient.id.toString,
status = PatientStatus.statusToString(patient.status),
- name = patient.name,
+ name = patient.name.toString(),
dob = patient.dob,
assignee = patient.assignee.map(_.id),
previousStatus = patient.previousStatus.map(PatientStatus.statusToString),
previousAssignee = patient.previousAssignee.map(_.id),
lastActiveUser = patient.lastActiveUserId.map(_.id),
lastUpdate = ZonedDateTime.of(patient.lastUpdate, ZoneId.of("Z")),
- condition = patient.condition,
+ disease = patient.disease.toString,
orderId = patient.orderId.id
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala
index 4136715..55c8149 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala
@@ -5,7 +5,7 @@ import java.util.UUID
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json._
-import xyz.driver.pdsuicommon.domain.FuzzyValue
+import xyz.driver.entities.labels.LabelValue
import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial
final case class ApiPatientEligibleTrial(id: Long,
@@ -30,8 +30,8 @@ object ApiPatientEligibleTrial {
Reads
.of[String]
.filter(ValidationError("unknown eligibility status"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}),
Writes.of[String]
)) and
@@ -45,7 +45,7 @@ object ApiPatientEligibleTrial {
trialTitle = eligibleTrialWithTrial.trial.title,
arms = eligibleTrialWithTrial.arms.map(_.armName),
hypothesisId = eligibleTrialWithTrial.group.hypothesisId.id,
- eligibleTrialWithTrial.group.verifiedEligibilityStatus.map(FuzzyValue.valueToString),
+ eligibleTrialWithTrial.group.verifiedEligibilityStatus.map(_.toString),
eligibleTrialWithTrial.group.isVerified
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala
index 91d0a0e..d92872c 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala
@@ -6,15 +6,14 @@ import org.davidbild.tristate.contrib.play.ToJsPathOpsFromJsPath
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json._
-import xyz.driver.pdsuicommon.domain.FuzzyValue
+import xyz.driver.entities.labels.LabelValue
final case class ApiPartialPatientLabel(primaryValue: Option[String], verifiedPrimaryValue: Tristate[String]) {
def applyTo(orig: PatientLabel): PatientLabel = {
orig.copy(
- primaryValue = primaryValue.map(FuzzyValue.fromString).orElse(orig.primaryValue),
- verifiedPrimaryValue =
- verifiedPrimaryValue.cata(x => Some(FuzzyValue.fromString(x)), None, orig.verifiedPrimaryValue)
+ primaryValue = primaryValue.flatMap(LabelValue.fromString).orElse(orig.primaryValue),
+ verifiedPrimaryValue = verifiedPrimaryValue.cata(x => LabelValue.fromString(x), None, orig.verifiedPrimaryValue)
)
}
}
@@ -26,8 +25,8 @@ object ApiPartialPatientLabel {
Format(Reads
.of[String]
.filter(ValidationError("unknown primary value"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}),
Writes.of[String])) and
(JsPath \ "verifiedPrimaryValue").formatTristate[String](
@@ -35,8 +34,8 @@ object ApiPartialPatientLabel {
Reads
.of[String]
.filter(ValidationError("unknown verified primary value"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}),
Writes.of[String]
))
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabel.scala
index fc8687b..cc8532d 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabel.scala
@@ -4,7 +4,7 @@ import xyz.driver.pdsuidomain.entities.PatientLabel
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json._
-import xyz.driver.pdsuicommon.domain.FuzzyValue
+import xyz.driver.entities.labels.LabelValue
final case class ApiPatientLabel(id: Long,
labelId: Long,
@@ -20,25 +20,33 @@ object ApiPatientLabel {
implicit val apiPatientLabelJsonFormat: Format[ApiPatientLabel] = (
(JsPath \ "id").format[Long] and
(JsPath \ "labelId").format[Long] and
- (JsPath \ "primaryValue").formatNullable[String](Format(Reads.of[String].filter(ValidationError("unknown value"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
- }), Writes.of[String])) and
- (JsPath \ "verifiedPrimaryValue").formatNullable[String](Format(Reads.of[String].filter(ValidationError("unknown value"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
- }), Writes.of[String])) and
+ (JsPath \ "primaryValue").formatNullable[String](
+ Format(Reads
+ .of[String]
+ .filter(ValidationError("unknown value"))({
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
+ }),
+ Writes.of[String])) and
+ (JsPath \ "verifiedPrimaryValue").formatNullable[String](
+ Format(Reads
+ .of[String]
+ .filter(ValidationError("unknown value"))({
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
+ }),
+ Writes.of[String])) and
(JsPath \ "score").format[Int] and
(JsPath \ "isImplicitMatch").format[Boolean] and
(JsPath \ "isVisible").format[Boolean] and
(JsPath \ "isVerified").format[Boolean]
- ) (ApiPatientLabel.apply, unlift(ApiPatientLabel.unapply))
+ )(ApiPatientLabel.apply, unlift(ApiPatientLabel.unapply))
def fromDomain(patientLabel: PatientLabel, isVerified: Boolean): ApiPatientLabel = ApiPatientLabel(
id = patientLabel.id.id,
labelId = patientLabel.labelId.id,
- primaryValue = patientLabel.primaryValue.map(FuzzyValue.valueToString),
- verifiedPrimaryValue = patientLabel.verifiedPrimaryValue.map(FuzzyValue.valueToString),
+ primaryValue = patientLabel.primaryValue.map(_.toString),
+ verifiedPrimaryValue = patientLabel.verifiedPrimaryValue.map(_.toString),
score = patientLabel.score,
isImplicitMatch = patientLabel.isImplicitMatch,
isVisible = patientLabel.isVisible,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabelDefiningCriteria.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabelDefiningCriteria.scala
index ae64c33..16b9cc9 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabelDefiningCriteria.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPatientLabelDefiningCriteria.scala
@@ -3,7 +3,7 @@ package xyz.driver.pdsuidomain.formats.json.patient.label
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json._
-import xyz.driver.pdsuicommon.domain.FuzzyValue
+import xyz.driver.entities.labels.LabelValue
import xyz.driver.pdsuidomain.entities.PatientLabel
final case class ApiPatientLabelDefiningCriteria(labelId: Long, value: Option[String])
@@ -16,14 +16,14 @@ object ApiPatientLabelDefiningCriteria {
Format(Reads
.of[String]
.filter(ValidationError("unknown value"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}),
Writes.of[String]))
)(ApiPatientLabelDefiningCriteria.apply, unlift(ApiPatientLabelDefiningCriteria.unapply))
def fromDomain(x: PatientLabel) = ApiPatientLabelDefiningCriteria(
labelId = x.labelId.id,
- value = x.verifiedPrimaryValue.map(FuzzyValue.valueToString)
+ value = x.verifiedPrimaryValue.map(_.toString)
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterion.scala
index 399bc7d..09538b8 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterion.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterion.scala
@@ -6,16 +6,16 @@ import org.davidbild.tristate.contrib.play.ToJsPathOpsFromJsPath
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json.{Format, JsPath, Reads, Writes}
-import xyz.driver.pdsuicommon.domain.FuzzyValue
+import xyz.driver.entities.labels.LabelValue
final case class ApiPartialPatientCriterion(eligibilityStatus: Option[String],
verifiedEligibilityStatus: Tristate[String]) {
def applyTo(orig: PatientCriterion): PatientCriterion = {
orig.copy(
- eligibilityStatus = eligibilityStatus.map(FuzzyValue.fromString).orElse(orig.eligibilityStatus),
+ eligibilityStatus = eligibilityStatus.flatMap(LabelValue.fromString).orElse(orig.eligibilityStatus),
verifiedEligibilityStatus =
- verifiedEligibilityStatus.cata(x => Some(FuzzyValue.fromString(x)), None, orig.verifiedEligibilityStatus)
+ verifiedEligibilityStatus.cata(x => LabelValue.fromString(x), None, orig.verifiedEligibilityStatus)
)
}
}
@@ -28,8 +28,8 @@ object ApiPartialPatientCriterion {
Reads
.of[String]
.filter(ValidationError("unknown eligibility status"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}),
Writes.of[String]
)) and
@@ -38,8 +38,8 @@ object ApiPartialPatientCriterion {
Reads
.of[String]
.filter(ValidationError("unknown verified eligibility status"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}),
Writes.of[String]
))
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterionList.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterionList.scala
index 4b08970..b7616a1 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterionList.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPartialPatientCriterionList.scala
@@ -1,10 +1,11 @@
package xyz.driver.pdsuidomain.formats.json.patient.trial
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId}
+import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuidomain.entities.PatientCriterion
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json.{Format, JsPath, Reads, Writes}
+import xyz.driver.entities.labels.LabelValue
import xyz.driver.pdsuidomain.services.PatientCriterionService.DraftPatientCriterion
final case class ApiPartialPatientCriterionList(id: Long,
@@ -13,7 +14,7 @@ final case class ApiPartialPatientCriterionList(id: Long,
def toDomain: DraftPatientCriterion = DraftPatientCriterion(
id = LongId[PatientCriterion](id),
- eligibilityStatus = eligibilityStatus.map(FuzzyValue.fromString),
+ eligibilityStatus = eligibilityStatus.flatMap(LabelValue.fromString),
isVerified = isVerified
)
}
@@ -26,8 +27,8 @@ object ApiPartialPatientCriterionList {
Reads
.of[String]
.filter(ValidationError("unknown eligibility status"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}),
Writes.of[String]
)) and
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala
index 6eeb40b..b9bf772 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala
@@ -2,12 +2,12 @@ package xyz.driver.pdsuidomain.formats.json.patient.trial
import java.time.{ZoneId, ZonedDateTime}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId}
+import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuidomain.entities.{PatientCriterion, PatientCriterionArm}
import play.api.data.validation.ValidationError
import play.api.libs.functional.syntax._
import play.api.libs.json.{Format, JsPath, Reads, Writes}
-import xyz.driver.entities.labels.Label
+import xyz.driver.entities.labels.{Label, LabelValue}
final case class ApiPatientCriterion(id: Long,
labelId: Long,
@@ -39,13 +39,13 @@ object ApiPatientCriterion {
(JsPath \ "criterionIsCompound").format[Boolean] and
(JsPath \ "arms").format[List[String]] and
(JsPath \ "eligibilityStatus").formatNullable[String](Format(Reads.of[String].filter(ValidationError("unknown status"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}), Writes.of[String])) and
(JsPath \ "verifiedEligibilityStatus").formatNullable[String](Format(
Reads.of[String].filter(ValidationError("unknown status"))({
- case x if FuzzyValue.fromString.isDefinedAt(x) => true
- case _ => false
+ case x if LabelValue.fromString(x).isDefined => true
+ case _ => false
}), Writes.of[String])) and
(JsPath \ "isVerified").format[Boolean] and
(JsPath \ "isVisible").format[Boolean] and
@@ -61,13 +61,13 @@ object ApiPatientCriterion {
criterionId = patientCriterion.criterionId.id,
criterionText = patientCriterion.criterionText,
criterionValue = patientCriterion.criterionValue.map { x =>
- FuzzyValue.valueToString(FuzzyValue.fromBoolean(x))
+ LabelValue.fromBoolean(x).toString
},
criterionIsDefining = patientCriterion.criterionIsDefining,
criterionIsCompound = patientCriterion.criterionValue.isEmpty,
arms = arms.map(_.armName),
- eligibilityStatus = patientCriterion.eligibilityStatus.map(FuzzyValue.valueToString),
- verifiedEligibilityStatus = patientCriterion.verifiedEligibilityStatus.map(FuzzyValue.valueToString),
+ eligibilityStatus = patientCriterion.eligibilityStatus.map(_.toString),
+ verifiedEligibilityStatus = patientCriterion.verifiedEligibilityStatus.map(_.toString),
isVerified = patientCriterion.isVerified,
isVisible = patientCriterion.isVisible,
lastUpdate = ZonedDateTime.of(patientCriterion.lastUpdate, ZoneId.of("Z"))
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiCreateRecord.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiCreateRecord.scala
index 2e5943e..1f8c683 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiCreateRecord.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiCreateRecord.scala
@@ -22,8 +22,6 @@ final case class ApiCreateRecord(disease: String, patientId: String, requestId:
caseId = None,
physician = None,
meta = None,
- predictedMeta = None,
- predictedDocuments = None,
lastUpdate = LocalDateTime.now()
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiRecord.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiRecord.scala
index e7b58cd..fc0a2e7 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiRecord.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/record/ApiRecord.scala
@@ -101,8 +101,6 @@ final case class ApiRecord(id: Long,
Some(TextJson(JsonSerializer.deserialize[List[MedicalRecord.Meta]](this.meta)))
}
},
- predictedMeta = None,
- predictedDocuments = None,
lastUpdate = this.lastUpdate.toLocalDateTime()
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala
index dbd0a43..61e0e7f 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala
@@ -3,7 +3,7 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats
import java.time.{LocalDate, LocalDateTime, ZoneId, ZonedDateTime}
import spray.json._
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId}
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
object common {
@@ -55,14 +55,6 @@ object common {
}
}
- implicit def fuzzyValueFormat: RootJsonFormat[FuzzyValue] = new RootJsonFormat[FuzzyValue] {
- override def write(value: FuzzyValue): JsString = JsString(FuzzyValue.valueToString(value))
- override def read(json: JsValue): FuzzyValue = json match {
- case JsString(value) => FuzzyValue.fromString(value)
- case _ => deserializationError(s"Expected value as FuzzyValue, but got $json")
- }
- }
-
implicit val integerFormat: RootJsonFormat[Integer] = new RootJsonFormat[Integer] {
override def write(obj: Integer): JsNumber = JsNumber(obj.intValue())
override def read(json: JsValue): Integer = json match {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala
index 6c33fe5..69e8b75 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala
@@ -26,7 +26,7 @@ object document {
"PN" -> RequiredType.PN
)
- implicit val documentMetaFormat: RootJsonFormat[Meta] = jsonFormat3(Meta.apply)
+ implicit val documentMetaFormat: RootJsonFormat[Meta] = jsonFormat2(Meta.apply)
implicit val documentTypeFormat: RootJsonFormat[DocumentType] = new RootJsonFormat[DocumentType] {
override def read(json: JsValue): DocumentType = json match {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/export.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/export.scala
index 39d5c59..85d614d 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/export.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/export.scala
@@ -5,6 +5,7 @@ import xyz.driver.entities.labels.Label
import xyz.driver.pdsuidomain.entities.{Arm, Criterion}
import xyz.driver.pdsuidomain.entities.export.patient._
import xyz.driver.pdsuidomain.entities.export.trial.{ExportTrialArm, ExportTrialLabelCriterion, ExportTrialWithLabels}
+import xyz.driver.formats.json.labels._
object export {
import DefaultJsonProtocol._
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala
index d6eadbd..5d5585a 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala
@@ -1,10 +1,11 @@
package xyz.driver.pdsuidomain.formats.json.sprayformats
import spray.json._
-import xyz.driver.entities.labels.{Label, LabelCategory}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, TextJson}
+import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue}
+import xyz.driver.pdsuicommon.domain.{LongId, TextJson}
import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.services.ExtractedDataService.RichExtractedData
+import xyz.driver.formats.json.labels._
object extracteddata {
import DefaultJsonProtocol._
@@ -44,7 +45,7 @@ object extracteddata {
val value = fields
.get("value")
- .map(_.convertTo[FuzzyValue])
+ .map(_.convertTo[LabelValue])
ExtractedDataLabel(
id = LongId(0),
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patient.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patient.scala
index 95c0674..2b0dfe5 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patient.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patient.scala
@@ -3,6 +3,8 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats
import spray.json._
import xyz.driver.core.json.EnumJsonFormat
import xyz.driver.pdsuidomain.entities._
+import xyz.driver.formats.json.common._
+import xyz.driver.formats.json.patient._
object patient {
import DefaultJsonProtocol._
@@ -38,7 +40,7 @@ object patient {
"previousAssignee" -> patient.previousAssignee.toJson,
"lastActiveUser" -> patient.lastActiveUserId.toJson,
"lastUpdate" -> patient.lastUpdate.toJson,
- "condition" -> patient.condition.toJson,
+ "disease" -> patient.disease.toJson,
"orderId" -> patient.orderId.toJson
)
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientcriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientcriterion.scala
index affb346..7e8c220 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientcriterion.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientcriterion.scala
@@ -1,9 +1,10 @@
package xyz.driver.pdsuidomain.formats.json.sprayformats
import spray.json._
-import xyz.driver.pdsuicommon.domain.FuzzyValue
+import xyz.driver.entities.labels.LabelValue
import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.services.PatientCriterionService.{DraftPatientCriterion, RichPatientCriterion}
+import xyz.driver.formats.json.labels._
object patientcriterion {
import DefaultJsonProtocol._
@@ -14,13 +15,13 @@ object patientcriterion {
val eligibilityStatus = if (fields.contains("eligibilityStatus")) {
fields
.get("eligibilityStatus")
- .map(_.convertTo[FuzzyValue])
+ .map(_.convertTo[LabelValue])
} else orig.eligibilityStatus
val verifiedEligibilityStatus = if (fields.contains("verifiedEligibilityStatus")) {
fields
.get("verifiedEligibilityStatus")
- .map(_.convertTo[FuzzyValue])
+ .map(_.convertTo[LabelValue])
} else orig.verifiedEligibilityStatus
orig.copy(
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala
index 0520ef2..746c7b4 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala
@@ -2,6 +2,7 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats
import spray.json._
import xyz.driver.pdsuidomain.entities.PatientLabel
+import xyz.driver.formats.json.labels._
object patientdefiningcriteria {
import DefaultJsonProtocol._
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienteligibletrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienteligibletrial.scala
index 041d9da..342d3a8 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienteligibletrial.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienteligibletrial.scala
@@ -3,6 +3,7 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats
import spray.json._
import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial
+import xyz.driver.formats.json.labels._
object patienteligibletrial {
import DefaultJsonProtocol._
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala
index b36949e..57dca1e 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala
@@ -1,9 +1,12 @@
package xyz.driver.pdsuidomain.formats.json.sprayformats
import spray.json._
-import xyz.driver.pdsuicommon.domain.FuzzyValue
+import xyz.driver.entities.labels.LabelValue
import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel
+import xyz.driver.formats.json.labels._
+import xyz.driver.pdsuidomain.formats.json.sprayformats.record._
+import xyz.driver.pdsuidomain.formats.json.sprayformats.document._
object patientlabel {
import DefaultJsonProtocol._
@@ -13,12 +16,12 @@ object patientlabel {
case JsObject(fields) =>
val primaryValue = fields
.get("primaryValue")
- .map(_.convertTo[Option[FuzzyValue]])
+ .map(_.convertTo[Option[LabelValue]])
.getOrElse(orig.primaryValue)
val verifiedPrimaryValue = fields
.get("verifiedPrimaryValue")
- .map(_.convertTo[Option[FuzzyValue]])
+ .map(_.convertTo[Option[LabelValue]])
.getOrElse(orig.verifiedPrimaryValue)
orig.copy(
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/record.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/record.scala
index 8eef44a..65687c1 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/record.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/record.scala
@@ -67,7 +67,6 @@ object record {
override def write(obj: Duplicate) =
JsObject(
"type" -> "duplicate".toJson,
- "predicted" -> obj.predicted.toJson,
"startPage" -> obj.startPage.toJson,
"endPage" -> obj.endPage.toJson,
"startOriginalPage" -> obj.startOriginalPage.toJson,
@@ -76,10 +75,6 @@ object record {
override def read(json: JsValue): Duplicate = json match {
case JsObject(fields) =>
- val predicted = fields
- .get("predicted")
- .map(_.convertTo[Boolean])
-
val startPage = fields
.get("startPage")
.map(_.convertTo[Double])
@@ -101,7 +96,6 @@ object record {
.map(_.convertTo[Double])
Duplicate(
- predicted = predicted,
startPage = startPage,
endPage = endPage,
startOriginalPage = startOriginalPage,
@@ -114,27 +108,16 @@ object record {
implicit val reorderMetaFormat: RootJsonFormat[Reorder] = new RootJsonFormat[Reorder] {
override def write(obj: Reorder) =
- JsObject(
- "type" -> "reorder".toJson,
- "predicted" -> obj.predicted.toJson,
- "items" -> obj.items.toJson
- )
+ JsObject("type" -> "reorder".toJson, "items" -> obj.items.toJson)
override def read(json: JsValue): Reorder = json match {
case JsObject(fields) =>
- val predicted = fields
- .get("predicted")
- .map(_.convertTo[Boolean])
-
val items = fields
.get("items")
.map(_.convertTo[Seq[Int]])
.getOrElse(deserializationError(s"Reorder meta json object does not contain `items` field: $json"))
- Reorder(
- predicted = predicted,
- items = items
- )
+ Reorder(items)
case _ => deserializationError(s"Expected JsObject as Reorder meta of medical record, but got $json")
}
@@ -142,27 +125,16 @@ object record {
implicit val rotateMetaFormat: RootJsonFormat[Rotation] = new RootJsonFormat[Rotation] {
override def write(obj: Rotation) =
- JsObject(
- "type" -> "rotation".toJson,
- "predicted" -> obj.predicted.toJson,
- "items" -> obj.items.toJson
- )
+ JsObject("type" -> "rotation".toJson, "items" -> obj.items.toJson)
override def read(json: JsValue): Rotation = json match {
case JsObject(fields) =>
- val predicted = fields
- .get("predicted")
- .map(_.convertTo[Boolean])
-
val items = fields
.get("items")
.map(_.convertTo[Map[String, Int]])
.getOrElse(deserializationError(s"Rotation meta json object does not contain `items` field: $json"))
- Rotation(
- predicted = predicted,
- items = items
- )
+ Rotation(items = items)
case _ => deserializationError(s"Expected JsObject as Rotation meta of medical record, but got $json")
}
@@ -233,8 +205,6 @@ object record {
caseId = None,
physician = None,
meta = None,
- predictedMeta = None,
- predictedDocuments = None,
lastUpdate = LocalDateTime.now()
)
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/trial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/trial.scala
index aeec90f..b25ed1d 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/trial.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/trial.scala
@@ -9,8 +9,8 @@ import xyz.driver.pdsuidomain.entities._
object trial {
import DefaultJsonProtocol._
- import common._
import Trial._
+ import common._
implicit val trialStatusFormat = new EnumJsonFormat[Status](
"New" -> Status.New,
@@ -24,12 +24,6 @@ object trial {
"Archived" -> Status.Archived
)
- implicit val conditionFormat = new EnumJsonFormat[Condition](
- "Breast" -> Condition.Breast,
- "Lung" -> Condition.Lung,
- "Prostate" -> Condition.Prostate
- )
-
implicit val trialWriter: RootJsonWriter[Trial] = new RootJsonWriter[Trial] {
override def write(obj: Trial) =
JsObject(
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala
index fbf506b..133a2c8 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala
@@ -2,11 +2,11 @@ package xyz.driver.pdsuidomain.formats.json.trial
import java.time.{ZoneId, ZonedDateTime}
import java.util.UUID
-import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
-import xyz.driver.pdsuidomain.entities.Trial
import play.api.libs.functional.syntax._
import play.api.libs.json._
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
+import xyz.driver.pdsuidomain.entities.Trial
final case class ApiTrial(id: String,
externalId: UUID,
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/EligibilityArmService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/EligibilityArmService.scala
index e250e8f..1e0f65e 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/EligibilityArmService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/EligibilityArmService.scala
@@ -127,7 +127,7 @@ trait EligibilityArmService {
filter: SearchFilterExpr = SearchFilterExpr.Empty,
sorting: Option[Sorting] = None,
pagination: Option[Pagination] = None)(
- implicit requestContext: AuthenticatedRequestContext): Future[GetListReply]
+ implicit requestContext: AuthenticatedRequestContext): Future[GetListReply]
def create(slotArmId: LongId[SlotArm], draftEligibilityArm: EligibilityArmWithDiseases)(
implicit requestContext: AuthenticatedRequestContext): Future[CreateReply]
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/EligibilityVerificationService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/EligibilityVerificationService.scala
index 7395400..c09dd9a 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/EligibilityVerificationService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/EligibilityVerificationService.scala
@@ -4,6 +4,7 @@ import xyz.driver.core.Id
import xyz.driver.core.rest.AuthorizedServiceRequestContext
import xyz.driver.entities.patient.{CancerType, Patient}
import xyz.driver.entities.users.AuthUserInfo
+import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuidomain.entities.eligibility.{MatchedPatient, MismatchRankedLabels}
import xyz.driver.pdsuidomain.entities.Arm
@@ -14,6 +15,6 @@ trait EligibilityVerificationService {
def getMatchedPatients()(implicit ctx: AuthorizedServiceRequestContext[AuthUserInfo]): ListT[Future, MatchedPatient]
- def getMismatchRankedLabels(patientId: Id[Patient], cancerType: CancerType, excludedArms: Seq[Id[Arm]])(
+ def getMismatchRankedLabels(patientId: Id[Patient], cancerType: CancerType, excludedArms: Seq[LongId[Arm]])(
implicit ctx: AuthorizedServiceRequestContext[AuthUserInfo]): Future[MismatchRankedLabels]
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/PatientCriterionService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/PatientCriterionService.scala
index a07eed8..4d0e188 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/PatientCriterionService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/PatientCriterionService.scala
@@ -2,7 +2,7 @@ package xyz.driver.pdsuidomain.services
import java.time.LocalDateTime
-import xyz.driver.entities.labels.Label
+import xyz.driver.entities.labels.{Label, LabelValue}
import xyz.driver.pdsuicommon.auth.AuthenticatedRequestContext
import xyz.driver.pdsuicommon.db._
import xyz.driver.pdsuicommon.domain._
@@ -15,7 +15,7 @@ import scala.concurrent.Future
object PatientCriterionService {
final case class DraftPatientCriterion(id: LongId[PatientCriterion],
- eligibilityStatus: Option[FuzzyValue],
+ eligibilityStatus: Option[LabelValue],
isVerified: Option[Boolean]) {
def applyTo(orig: PatientCriterion) = {
orig.copy(
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/TrialService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/TrialService.scala
index c6ab2d2..92233e4 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/TrialService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/TrialService.scala
@@ -5,6 +5,7 @@ import java.time.LocalDateTime
import akka.NotUsed
import akka.stream.scaladsl.Source
import akka.util.ByteString
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.auth.AuthenticatedRequestContext
import xyz.driver.pdsuicommon.db._
import xyz.driver.pdsuicommon.domain.StringId
@@ -108,10 +109,10 @@ trait TrialService {
def getById(id: StringId[Trial])(implicit requestContext: AuthenticatedRequestContext): Future[GetByIdReply]
- def getTrialWithLabels(trialId: StringId[Trial], condition: String)(
+ def getTrialWithLabels(trialId: StringId[Trial], cancerType: CancerType)(
implicit requestContext: AuthenticatedRequestContext): Future[GetTrialWithLabelsReply]
- def getTrialsWithLabels(condition: String)(
+ def getTrialsWithLabels(cancerType: CancerType)(
implicit requestContext: AuthenticatedRequestContext): Future[GetTrialsWithLabelsReply]
def getPdfSource(trialId: StringId[Trial])(
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeEligibilityVerificationService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeEligibilityVerificationService.scala
index 1e1a3ea..c9b5443 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeEligibilityVerificationService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeEligibilityVerificationService.scala
@@ -5,6 +5,7 @@ import xyz.driver.core.{Id, generators}
import xyz.driver.entities.patient
import xyz.driver.entities.patient.Patient
import xyz.driver.entities.users.AuthUserInfo
+import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuidomain.entities.eligibility.MismatchRankedLabels
import xyz.driver.pdsuidomain.entities.{Arm, eligibility}
import xyz.driver.pdsuidomain.services.EligibilityVerificationService
@@ -21,7 +22,7 @@ class FakeEligibilityVerificationService extends EligibilityVerificationService
override def getMismatchRankedLabels(patientId: Id[Patient],
cancerType: patient.CancerType,
- excludedArms: Seq[Id[Arm]])(
+ excludedArms: Seq[LongId[Arm]])(
implicit ctx: AuthorizedServiceRequestContext[AuthUserInfo]): Future[eligibility.MismatchRankedLabels] =
Future.successful(
MismatchRankedLabels(
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala
index 59f300b..cb7f8bc 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala
@@ -7,11 +7,12 @@ import akka.stream.scaladsl.Source
import akka.util.ByteString
import xyz.driver.core.generators
import xyz.driver.entities.labels.Label
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.auth.AuthenticatedRequestContext
import xyz.driver.pdsuicommon.db._
import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
-import xyz.driver.pdsuidomain.entities.{Arm, Criterion, Trial}
import xyz.driver.pdsuidomain.entities.export.trial.{ExportTrialArm, ExportTrialLabelCriterion, ExportTrialWithLabels}
+import xyz.driver.pdsuidomain.entities.{Arm, Criterion, Trial}
import xyz.driver.pdsuidomain.services.TrialService
import scala.concurrent.Future
@@ -56,11 +57,11 @@ class FakeTrialService extends TrialService {
implicit requestContext: AuthenticatedRequestContext): Future[GetListReply] =
Future.successful(GetListReply.EntityList(Seq(trial), 1, None))
- override def getTrialWithLabels(trialId: StringId[Trial], condition: String)(
+ override def getTrialWithLabels(trialId: StringId[Trial], cancerType: CancerType)(
implicit requestContext: AuthenticatedRequestContext): Future[GetTrialWithLabelsReply] =
Future.successful(GetTrialWithLabelsReply.Entity(nextExportTrialWithLabels()))
- override def getTrialsWithLabels(condition: String)(
+ override def getTrialsWithLabels(cancerType: CancerType)(
implicit requestContext: AuthenticatedRequestContext): Future[GetTrialsWithLabelsReply] =
Future.successful(GetTrialsWithLabelsReply.EntityList(generators.seqOf(nextExportTrialWithLabels())))
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestEligibilityVerificationService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestEligibilityVerificationService.scala
index f6879d0..8869106 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestEligibilityVerificationService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestEligibilityVerificationService.scala
@@ -8,6 +8,7 @@ import xyz.driver.core.rest.{AuthorizedServiceRequestContext, RestService, Servi
import xyz.driver.entities.patient
import xyz.driver.entities.patient.Patient
import xyz.driver.entities.users.AuthUserInfo
+import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuidomain.entities.eligibility.{MatchedPatient, MismatchRankedLabels}
import xyz.driver.pdsuidomain.entities.{Arm, eligibility}
import xyz.driver.pdsuidomain.services.EligibilityVerificationService
@@ -33,11 +34,11 @@ class RestEligibilityVerificationService(transport: ServiceTransport, baseUri: U
override def getMismatchRankedLabels(patientId: Id[Patient],
cancerType: patient.CancerType,
- excludedArms: Seq[Id[Arm]])(
+ excludedArms: Seq[LongId[Arm]])(
implicit ctx: AuthorizedServiceRequestContext[AuthUserInfo]): Future[eligibility.MismatchRankedLabels] = {
val query =
- Seq("disease" -> cancerType.toString.toUpperCase, "ineligible_arms" -> excludedArms.map(_.value).mkString(","))
+ Seq("disease" -> cancerType.toString.toUpperCase, "ineligible_arms" -> excludedArms.map(_.id).mkString(","))
val request = get(baseUri, s"/v1/patients/$patientId/labels", query)
optionalResponse[MismatchRankedLabels](transport.sendRequest(ctx)(request))
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestTrialService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestTrialService.scala
index 42f32fc..ea719e1 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestTrialService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestTrialService.scala
@@ -18,6 +18,7 @@ import xyz.driver.pdsuidomain.formats.json.trial.ApiTrial
import xyz.driver.pdsuidomain.services.TrialService
import spray.json.DefaultJsonProtocol._
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuidomain.formats.json.sprayformats.export._
class RestTrialService(transport: ServiceTransport, baseUri: Uri)(implicit protected val materializer: Materializer,
@@ -37,9 +38,9 @@ class RestTrialService(transport: ServiceTransport, baseUri: Uri)(implicit prote
}
}
- def getTrialWithLabels(trialId: StringId[Trial], disease: String)(
+ def getTrialWithLabels(trialId: StringId[Trial], cancerType: CancerType)(
implicit requestContext: AuthenticatedRequestContext): Future[GetTrialWithLabelsReply] = {
- val request = HttpRequest(HttpMethods.GET, endpointUri(baseUri, s"/v1/export/trial/$disease/$trialId"))
+ val request = HttpRequest(HttpMethods.GET, endpointUri(baseUri, s"/v1/export/trial/$cancerType/$trialId"))
for {
response <- transport.sendRequestGetResponse(requestContext)(request)
reply <- apiResponse[ExportTrialWithLabels](response)
@@ -48,9 +49,9 @@ class RestTrialService(transport: ServiceTransport, baseUri: Uri)(implicit prote
}
}
- def getTrialsWithLabels(disease: String)(
+ def getTrialsWithLabels(cancerType: CancerType)(
implicit requestContext: AuthenticatedRequestContext): Future[GetTrialsWithLabelsReply] = {
- val request = HttpRequest(HttpMethods.GET, endpointUri(baseUri, s"/v1/export/trial/$disease"))
+ val request = HttpRequest(HttpMethods.GET, endpointUri(baseUri, s"/v1/export/trial/$cancerType"))
for {
response <- transport.sendRequestGetResponse(requestContext)(request)
reply <- apiResponse[Seq[ExportTrialWithLabels]](response)
diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/PaginationParserSuite.scala b/src/test/scala/xyz/driver/pdsuicommon/parsers/PaginationParserSuite.scala
index 48fc99b..609c8c8 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/parsers/PaginationParserSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuicommon/parsers/PaginationParserSuite.scala
@@ -11,36 +11,40 @@ class PaginationParserSuite extends FreeSpecLike with MustMatchers {
"parse" - {
"pageSize" - {
"should parse positive value" in {
- val pagination = PaginationParser.parse(Seq(
- "pageSize" -> "10",
- "pageNumber" -> "1"
- ))
+ val pagination = PaginationParser.parse(
+ Seq(
+ "pageSize" -> "10",
+ "pageNumber" -> "1"
+ ))
pagination must success
pagination.get.pageSize mustBe 10
}
"should return a default value if there is no one" in {
- val pagination = PaginationParser.parse(Seq(
- "pageNumber" -> "1"
- ))
+ val pagination = PaginationParser.parse(
+ Seq(
+ "pageNumber" -> "1"
+ ))
pagination must success
pagination.get.pageSize mustBe 100
}
"should return a error for zero value" in {
- val pagination = PaginationParser.parse(Seq(
- "pageSize" -> "0",
- "pageNumber" -> "1"
- ))
+ val pagination = PaginationParser.parse(
+ Seq(
+ "pageSize" -> "0",
+ "pageNumber" -> "1"
+ ))
checkFailedValidationOnlyOn(pagination, "pageSize")
}
"should return a error for negative value" in {
- val pagination = PaginationParser.parse(Seq(
- "pageSize" -> "-10",
- "pageNumber" -> "1"
- ))
+ val pagination = PaginationParser.parse(
+ Seq(
+ "pageSize" -> "-10",
+ "pageNumber" -> "1"
+ ))
checkFailedValidationOnlyOn(pagination, "pageSize")
}
@@ -48,36 +52,40 @@ class PaginationParserSuite extends FreeSpecLike with MustMatchers {
"pageNumber" - {
"should parse positive value" in {
- val pagination = PaginationParser.parse(Seq(
- "pageSize" -> "1",
- "pageNumber" -> "1"
- ))
+ val pagination = PaginationParser.parse(
+ Seq(
+ "pageSize" -> "1",
+ "pageNumber" -> "1"
+ ))
pagination must success
pagination.get.pageSize mustBe 1
}
"should return a default value if there is no one" in {
- val pagination = PaginationParser.parse(Seq(
- "pageSize" -> "1"
- ))
+ val pagination = PaginationParser.parse(
+ Seq(
+ "pageSize" -> "1"
+ ))
pagination must success
pagination.get.pageNumber mustBe 1
}
"should return a error for zero value" in {
- val pagination = PaginationParser.parse(Seq(
- "pageSize" -> "1",
- "pageNumber" -> "0"
- ))
+ val pagination = PaginationParser.parse(
+ Seq(
+ "pageSize" -> "1",
+ "pageNumber" -> "0"
+ ))
checkFailedValidationOnlyOn(pagination, "pageNumber")
}
"should return a error for negative value" in {
- val pagination = PaginationParser.parse(Seq(
- "pageSize" -> "1",
- "pageNumber" -> "-1"
- ))
+ val pagination = PaginationParser.parse(
+ Seq(
+ "pageSize" -> "1",
+ "pageNumber" -> "-1"
+ ))
checkFailedValidationOnlyOn(pagination, "pageNumber")
}
diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/SearchFilterParserSuite.scala b/src/test/scala/xyz/driver/pdsuicommon/parsers/SearchFilterParserSuite.scala
index 5deaecb..02243aa 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/parsers/SearchFilterParserSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuicommon/parsers/SearchFilterParserSuite.scala
@@ -30,16 +30,20 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
"should convert column names to snake case" in {
import SearchFilterBinaryOperation._
- val filter = SearchFilterParser.parse(Seq(
- "filters" -> "status IN Summarized,ReviewCriteria,Flagged,Done",
- "filters" -> "previousStatus NOTEQ New",
- "filters" -> "previousStatus NOTEQ ReviewSummary"
- ))
-
- assert(filter === Success(SearchFilterExpr.Intersection(List(
- SearchFilterExpr.Atom.NAry(Dimension(None, "status"), In, Seq("Summarized", "ReviewCriteria", "Flagged", "Done")),
- SearchFilterExpr.Atom.Binary(Dimension(None, "previous_status"), NotEq, "New"),
- SearchFilterExpr.Atom.Binary(Dimension(None, "previous_status"), NotEq, "ReviewSummary")))))
+ val filter = SearchFilterParser.parse(
+ Seq(
+ "filters" -> "status IN Summarized,ReviewCriteria,Flagged,Done",
+ "filters" -> "previousStatus NOTEQ New",
+ "filters" -> "previousStatus NOTEQ ReviewSummary"
+ ))
+
+ assert(
+ filter === Success(SearchFilterExpr.Intersection(List(
+ SearchFilterExpr.Atom
+ .NAry(Dimension(None, "status"), In, Seq("Summarized", "ReviewCriteria", "Flagged", "Done")),
+ SearchFilterExpr.Atom.Binary(Dimension(None, "previous_status"), NotEq, "New"),
+ SearchFilterExpr.Atom.Binary(Dimension(None, "previous_status"), NotEq, "ReviewSummary")
+ ))))
}
"dimensions" - {
"with table name" in check {
@@ -50,11 +54,11 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
Prop.forAllNoShrink(dimensionGen) {
case (left, right) =>
val raw = s"$left.$right"
- val l = toSnakeCase(left)
- val r = toSnakeCase(right)
- SearchFilterParser.dimensionParser.parse(raw) match {
+ val l = toSnakeCase(left)
+ val r = toSnakeCase(right)
+ SearchFilterParser.dimensionParser.parse(raw) match {
case Parsed.Success(Dimension(Some(`l`), `r`), _) => true
- case _ => false
+ case _ => false
}
}
}
@@ -63,7 +67,7 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
val databaseS = Utils.toSnakeCase(s)
SearchFilterParser.dimensionParser.parse(s) match {
case Parsed.Success(Dimension(None, `databaseS`), _) => true
- case _ => false
+ case _ => false
}
}
}
@@ -81,10 +85,11 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
)
Prop.forAllNoShrink(testQueryGen) { query =>
- SearchFilterParser.parse(Seq("filters" -> query))
+ SearchFilterParser
+ .parse(Seq("filters" -> query))
.map {
case SearchFilterExpr.Atom.Binary(_, Eq | NotEq | Like, _) => true
- case x => throw new UnexpectedSearchFilterExprException(x)
+ case x => throw new UnexpectedSearchFilterExprException(x)
}
.successProp
}
@@ -96,7 +101,9 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
val testQueryGen = queryGen(
dimensionGen = Gen.identifier,
opGen = numericBinaryOpsGen,
- valueGen = nonEmptyString.filter { s => !s.matches("^\\d+$") }
+ valueGen = nonEmptyString.filter { s =>
+ !s.matches("^\\d+$")
+ }
)
Prop.forAllNoShrink(testQueryGen) { query =>
@@ -121,10 +128,11 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
)
Prop.forAllNoShrink(testQueryGen) { query =>
- SearchFilterParser.parse(Seq("filters" -> query))
+ SearchFilterParser
+ .parse(Seq("filters" -> query))
.map {
case _: SearchFilterExpr.Atom.Binary => true
- case x => throw new UnexpectedSearchFilterExprException(x)
+ case x => throw new UnexpectedSearchFilterExprException(x)
}
.successProp
}
@@ -140,7 +148,8 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
case Success(_) => ()
case Failure(t) => t.printStackTrace()
}
- assert(filter === Success(SearchFilterExpr.Atom.NAry(Dimension(None, "id"), In, Seq(Long.box(1), Long.box(5)))))
+ assert(
+ filter === Success(SearchFilterExpr.Atom.NAry(Dimension(None, "id"), In, Seq(Long.box(1), Long.box(5)))))
}
}
@@ -152,10 +161,11 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
)
Prop.forAllNoShrink(testQueryGen) { query =>
- SearchFilterParser.parse(Seq("filters" -> query))
+ SearchFilterParser
+ .parse(Seq("filters" -> query))
.map {
case SearchFilterExpr.Atom.NAry(_, SearchFilterNAryOperation.In, _) => true
- case x => throw new UnexpectedSearchFilterExprException(x)
+ case x => throw new UnexpectedSearchFilterExprException(x)
}
.successProp
}
@@ -189,16 +199,19 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
}
}
- private val CommonBinaryOps = Seq("eq", "noteq", "like")
+ private val CommonBinaryOps = Seq("eq", "noteq", "like")
private val NumericBinaryOps = Seq("gt", "gteq", "lt", "lteq")
- private val allBinaryOpsGen: Gen[String] = Gen.oneOf(CommonBinaryOps ++ NumericBinaryOps).flatMap(randomCapitalization)
- private val commonBinaryOpsGen: Gen[String] = Gen.oneOf(CommonBinaryOps).flatMap(randomCapitalization)
+ private val allBinaryOpsGen: Gen[String] =
+ Gen.oneOf(CommonBinaryOps ++ NumericBinaryOps).flatMap(randomCapitalization)
+ private val commonBinaryOpsGen: Gen[String] = Gen.oneOf(CommonBinaryOps).flatMap(randomCapitalization)
private val numericBinaryOpsGen: Gen[String] = Gen.oneOf(NumericBinaryOps).flatMap(randomCapitalization)
private val inValueCharsGen: Gen[Char] = arbitrary[Char].filter(_ != ',')
- private val nonEmptyString = arbitrary[String].filter { s => !s.safeTrim.isEmpty }
+ private val nonEmptyString = arbitrary[String].filter { s =>
+ !s.safeTrim.isEmpty
+ }
private val numericBinaryAtomValuesGen: Gen[String] = arbitrary[Long].map(_.toString)
private val inValueGen: Gen[String] = {
@@ -208,18 +221,22 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
Gen.containerOfN[Seq, String](size, inValueGen).map(_.mkString(","))
}
- private def queryGen(dimensionGen: Gen[String], opGen: Gen[String], valueGen: Gen[String]): Gen[String] = for {
- dimension <- dimensionGen
- op <- opGen
- value <- valueGen
- } yield s"$dimension $op $value"
+ private def queryGen(dimensionGen: Gen[String], opGen: Gen[String], valueGen: Gen[String]): Gen[String] =
+ for {
+ dimension <- dimensionGen
+ op <- opGen
+ value <- valueGen
+ } yield s"$dimension $op $value"
private def randomCapitalization(input: String): Gen[String] = {
Gen.containerOfN[Seq, Boolean](input.length, arbitrary[Boolean]).map { capitalize =>
- input.view.zip(capitalize).map {
- case (currChar, true) => currChar.toUpper
- case (currChar, false) => currChar
- }.mkString
+ input.view
+ .zip(capitalize)
+ .map {
+ case (currChar, true) => currChar.toUpper
+ case (currChar, false) => currChar
+ }
+ .mkString
}
}
diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/SortingParserSuite.scala b/src/test/scala/xyz/driver/pdsuicommon/parsers/SortingParserSuite.scala
index e46015c..f34f8e1 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/parsers/SortingParserSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuicommon/parsers/SortingParserSuite.scala
@@ -12,7 +12,7 @@ class SortingParserSuite extends FreeSpecLike with MustMatchers with Checkers {
"single dimension" - commonTests(singleSortingQueryGen)
"multiple dimensions in one query" - commonTests(multipleSortingQueryGen)
"multiple queries" in {
- val r = SortingParser.parse(Set("foo", "bar"), Seq("sort" -> "foo", "sort" ->"bar"))
+ val r = SortingParser.parse(Set("foo", "bar"), Seq("sort" -> "foo", "sort" -> "bar"))
r must failWith[ParseQueryArgException]
}
}
@@ -21,7 +21,7 @@ class SortingParserSuite extends FreeSpecLike with MustMatchers with Checkers {
"valid" in check {
val inputGen: Gen[(Set[String], String)] = for {
validDimensions <- dimensionsGen
- sorting <- queryGen(validDimensions)
+ sorting <- queryGen(validDimensions)
} yield (validDimensions, sorting)
Prop.forAllNoShrink(inputGen) {
@@ -33,7 +33,9 @@ class SortingParserSuite extends FreeSpecLike with MustMatchers with Checkers {
"invalid" in check {
val inputGen: Gen[(Set[String], String)] = for {
validDimensions <- dimensionsGen
- invalidDimensions <- dimensionsGen.filter { xs => xs.intersect(validDimensions).isEmpty }
+ invalidDimensions <- dimensionsGen.filter { xs =>
+ xs.intersect(validDimensions).isEmpty
+ }
sorting <- queryGen(invalidDimensions)
} yield (validDimensions, sorting)
@@ -46,12 +48,12 @@ class SortingParserSuite extends FreeSpecLike with MustMatchers with Checkers {
private val dimensionsGen: Gen[Set[String]] = for {
unPrefixedSize <- Gen.choose(0, 3)
- prefixedSize <- Gen.choose(0, 3)
+ prefixedSize <- Gen.choose(0, 3)
if (unPrefixedSize + prefixedSize) > 0
unPrefixedDimensions <- Gen.containerOfN[Set, String](unPrefixedSize, Gen.identifier)
- prefixes <- Gen.containerOfN[Set, String](prefixedSize, Gen.identifier)
+ prefixes <- Gen.containerOfN[Set, String](prefixedSize, Gen.identifier)
dimensions <- Gen.containerOfN[Set, String](prefixedSize, Gen.identifier)
} yield {
val prefixedDimensions = prefixes.zip(dimensions).map {
@@ -62,30 +64,33 @@ class SortingParserSuite extends FreeSpecLike with MustMatchers with Checkers {
private def multipleSortingQueryGen(validDimensions: Set[String]): Gen[String] = {
val validDimensionsSeq = validDimensions.toSeq
- val indexGen = Gen.oneOf(validDimensionsSeq.indices)
+ val indexGen = Gen.oneOf(validDimensionsSeq.indices)
val multipleDimensionsGen = Gen.nonEmptyContainerOf[Set, Int](indexGen).filter(_.size >= 2).map { indices =>
indices.map(validDimensionsSeq.apply)
}
for {
- dimensions <- multipleDimensionsGen
+ dimensions <- multipleDimensionsGen
isAscending <- Gen.containerOfN[Seq, Boolean](dimensions.size, arbitrary[Boolean])
} yield {
- isAscending.zip(dimensions)
+ isAscending
+ .zip(dimensions)
.map {
- case (true, dimension) => dimension
+ case (true, dimension) => dimension
case (false, dimension) => "-" + dimension
}
.mkString(",")
}
}
- private def singleSortingQueryGen(validDimensions: Set[String]): Gen[String] = for {
- isAscending <- arbitrary[Boolean]
- dimensions <- Gen.oneOf(validDimensions.toSeq)
- } yield isAscending match {
- case true => dimensions
- case false => "-" + dimensions
- }
+ private def singleSortingQueryGen(validDimensions: Set[String]): Gen[String] =
+ for {
+ isAscending <- arbitrary[Boolean]
+ dimensions <- Gen.oneOf(validDimensions.toSeq)
+ } yield
+ isAscending match {
+ case true => dimensions
+ case false => "-" + dimensions
+ }
}
diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala b/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala
index 4892b95..09b60ed 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala
+++ b/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala
@@ -22,8 +22,9 @@ object TestUtils {
left.isFailure && left.failed.get.getClass == ct.runtimeClass,
left match {
case Success(x) => s"$left did not fail"
- case Failure(e) => s"$left did fail with ${Utils.getClassSimpleName(e.getClass)}, " +
- s"not ${Utils.getClassSimpleName(ct.runtimeClass)}"
+ case Failure(e) =>
+ s"$left did fail with ${Utils.getClassSimpleName(e.getClass)}, " +
+ s"not ${Utils.getClassSimpleName(ct.runtimeClass)}"
},
left match {
case Success(_) => s"$left failed with ${Utils.getClassSimpleName(ct.runtimeClass)}"
@@ -33,7 +34,7 @@ object TestUtils {
}
}
- def failWith[ThrowableT <:Throwable](implicit ct: ClassTag[ThrowableT]) = new FailWith[ThrowableT]
+ def failWith[ThrowableT <: Throwable](implicit ct: ClassTag[ThrowableT]) = new FailWith[ThrowableT]
final implicit class TryPropOps(val self: Try[Any]) extends AnyVal {
diff --git a/src/test/scala/xyz/driver/pdsuicommon/utils/StringOpsSuite.scala b/src/test/scala/xyz/driver/pdsuicommon/utils/StringOpsSuite.scala
index 9bd4382..bd0bd2b 100644
--- a/src/test/scala/xyz/driver/pdsuicommon/utils/StringOpsSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuicommon/utils/StringOpsSuite.scala
@@ -30,4 +30,4 @@ class StringOpsSuite extends FreeSpecLike {
assert("foo".safeTrim == "foo")
}
}
-} \ No newline at end of file
+}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
index 9fc3388..7d8a418 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
@@ -82,7 +82,7 @@ class DocumentSuite extends BaseSuite {
startDate = Some(lastUpdate.toLocalDate.minusDays(2)),
endDate = None,
lastUpdate = lastUpdate,
- meta = Some(TextJson(Document.Meta(None, 1.1, 2.2)))
+ meta = Some(TextJson(Document.Meta(1.1, 2.2)))
)
}
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ArmFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ArmFormatSuite.scala
index e7d37a0..35b0fad 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ArmFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ArmFormatSuite.scala
@@ -17,19 +17,20 @@ class ArmFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = armFormat.write(arm)
- writtenJson should be("""{"id":10,"trialId":"NCT000001","name":"arm name","originalName":"orig arm name"}""".parseJson)
+ writtenJson should be(
+ """{"id":10,"trialId":"NCT000001","name":"arm name","originalName":"orig arm name"}""".parseJson)
val createArmJson = """{"trialId":"NCT000001","name":"arm name"}""".parseJson
- val parsedArm = armFormat.read(createArmJson)
+ val parsedArm = armFormat.read(createArmJson)
val expectedCreatedArm = arm.copy(
id = LongId(0),
originalName = "arm name"
)
parsedArm should be(expectedCreatedArm)
- val updateArmJson = """{"name":"new arm name"}""".parseJson
+ val updateArmJson = """{"name":"new arm name"}""".parseJson
val expectedUpdatedArm = arm.copy(name = "new arm name")
- val parsedUpdateArm = applyUpdateToArm(updateArmJson, arm)
+ val parsedUpdateArm = applyUpdateToArm(updateArmJson, arm)
parsedUpdateArm should be(expectedUpdatedArm)
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala
index cc1832c..e6dd4a1 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala
@@ -32,7 +32,7 @@ class DocumentFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = documentFormat.write(orig)
- writtenJson should be (
+ writtenJson should be(
"""{"id":1,"recordId":101,"physician":"physician","typeId":10,"provider":"provider 21","providerTypeId":21,
"requiredType":"OPN","institutionName":"institution name","startDate":null,"endDate":null,"status":"New","assignee":null,"previousStatus":null,
"previousAssignee":null,"lastActiveUser":null,"lastUpdate":"2017-08-10T18:00Z","meta":null}""".parseJson)
@@ -49,28 +49,24 @@ class DocumentFormatSuite extends FlatSpec with Matchers {
parsedCreatedDocument should be(expectedCreatedDocument)
val updateDocumentJson =
- """{"startDate":"2017-08-10","endDate":"2018-08-10","meta":{"predicted":true,"startPage":1.0,"endPage":2.0}}""".parseJson
+ """{"startDate":"2017-08-10","endDate":"2018-08-10","meta":{"startPage":1.0,"endPage":2.0}}""".parseJson
val expectedUpdatedDocument = orig.copy(
startDate = Some(LocalDate.parse("2017-08-10")),
endDate = Some(LocalDate.parse("2018-08-10")),
- meta = Some(TextJson(Document.Meta(predicted = Some(true), startPage = 1.0, endPage = 2.0)))
+ meta = Some(TextJson(Document.Meta(startPage = 1.0, endPage = 2.0)))
)
val parsedUpdatedDocument = applyUpdateToDocument(updateDocumentJson, orig)
parsedUpdatedDocument should be(expectedUpdatedDocument)
}
"Json format for Document.Meta" should "read and write correct JSON" in {
- val meta = Document.Meta(predicted = None, startPage = 1.0, endPage = 2.0)
+ val meta = Document.Meta(startPage = 1.0, endPage = 2.0)
val writtenJson = documentMetaFormat.write(meta)
- writtenJson should be ("""{"startPage":1.0,"endPage":2.0}""".parseJson)
+ writtenJson should be("""{"startPage":1.0,"endPage":2.0}""".parseJson)
- val metaJsonWithoutPredicted = """{"startPage":1.0,"endPage":2.0}""".parseJson
- val parsedMetaWithoutPredicted = documentMetaFormat.read(metaJsonWithoutPredicted)
- parsedMetaWithoutPredicted should be(meta)
-
- val metaJsonWithPredicted = """{"predicted":true,"startPage":1.0,"endPage":2.0}""".parseJson
- val parsedMetaWithPredicted = documentMetaFormat.read(metaJsonWithPredicted)
- parsedMetaWithPredicted should be(meta.copy(predicted = Some(true)))
+ val metaJson = """{"startPage":1.0,"endPage":2.0}""".parseJson
+ val parsedMeta = documentMetaFormat.read(metaJson)
+ parsedMeta should be(meta)
}
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentHistoryFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentHistoryFormatSuite.scala
index ddbda1d..5975919 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentHistoryFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentHistoryFormatSuite.scala
@@ -21,8 +21,7 @@ class DocumentHistoryFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = documentHistoryFormat.write(documentHistory)
- writtenJson should be(
- """{"id":10,"executor":"userId-001","documentId":1,"state":"Extract",
+ writtenJson should be("""{"id":10,"executor":"userId-001","documentId":1,"state":"Extract",
"action":"Start","created":"2017-08-10T18:00Z"}""".parseJson)
val parsedDocumentHistory = documentHistoryFormat.read(writtenJson)
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentIssueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentIssueFormatSuite.scala
index c4c9f7c..54cfe90 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentIssueFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentIssueFormatSuite.scala
@@ -29,7 +29,8 @@ class DocumentIssueFormatSuite extends FlatSpec with Matchers {
"text":"message text","archiveRequired":false,"startPage":1.0,"endPage":2.0}""".parseJson)
val createDocumentIssueJson = """{"text":"message text","startPage":1.0,"endPage":2.0}""".parseJson
- val expectedCreatedDocumentIssue = documentIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
+ val expectedCreatedDocumentIssue =
+ documentIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
val parsedCreateDocumentIssue = jsValueToDocumentIssue(createDocumentIssueJson, LongId(1), StringId("userId-001"))
parsedCreateDocumentIssue should be(expectedCreatedDocumentIssue)
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala
index a451905..402e893 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala
@@ -5,7 +5,8 @@ import java.util.UUID
import spray.json._
import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId}
+import xyz.driver.entities.labels.LabelValue
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuidomain.entities.{DocumentType, ProviderType, RecordRequestId}
class ExportFormatSuite extends FlatSpec with Matchers {
@@ -27,13 +28,13 @@ class ExportFormatSuite extends FlatSpec with Matchers {
evidences = List(
ExportPatientLabelEvidence(
id = LongId(11),
- value = FuzzyValue.Yes,
+ value = LabelValue.Yes,
evidenceText = "evidence text 11",
document = document
),
ExportPatientLabelEvidence(
id = LongId(12),
- value = FuzzyValue.No,
+ value = LabelValue.No,
evidenceText = "evidence text 12",
document = document
)
@@ -44,13 +45,13 @@ class ExportFormatSuite extends FlatSpec with Matchers {
evidences = List(
ExportPatientLabelEvidence(
id = LongId(12),
- value = FuzzyValue.Yes,
+ value = LabelValue.Yes,
evidenceText = "evidence text 12",
document = document
),
ExportPatientLabelEvidence(
id = LongId(13),
- value = FuzzyValue.Yes,
+ value = LabelValue.Yes,
evidenceText = "evidence text 13",
document = document
)
@@ -106,7 +107,7 @@ class ExportFormatSuite extends FlatSpec with Matchers {
val trialWithLabels = ExportTrialWithLabels(
nctId = StringId("NCT000001"),
trialId = UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
- condition = "Breast",
+ disease = "Breast",
lastReviewed = LocalDateTime.parse("2017-08-10T18:00:00"),
labelVersion = 1L,
arms = arms,
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala
index a4b8bab..1feca6a 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala
@@ -2,7 +2,8 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats
import spray.json._
import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, TextJson}
+import xyz.driver.entities.labels.LabelValue
+import xyz.driver.pdsuicommon.domain.{LongId, TextJson}
import xyz.driver.pdsuidomain.entities.ExtractedData.Meta
import xyz.driver.pdsuidomain.entities.{ExtractedData, ExtractedDataLabel}
import xyz.driver.pdsuidomain.services.ExtractedDataService.RichExtractedData
@@ -24,14 +25,14 @@ class ExtractedDataFormatSuite extends FlatSpec with Matchers {
dataId = extractedData.id,
labelId = None,
categoryId = None,
- value = Some(FuzzyValue.Yes)
+ value = Some(LabelValue.Yes)
),
ExtractedDataLabel(
id = LongId(2),
dataId = extractedData.id,
labelId = Some(LongId(12)),
categoryId = Some(LongId(1)),
- value = Some(FuzzyValue.No)
+ value = Some(LabelValue.No)
)
)
val origRichExtractedData = RichExtractedData(
@@ -40,7 +41,7 @@ class ExtractedDataFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = extractedDataFormat.write(origRichExtractedData)
- writtenJson should be (
+ writtenJson should be(
"""{"id":1,"documentId":101,"keywordId":201,"evidence":"evidence text","meta":null,
"labels":[{"id":null,"categoryId":null,"value":"Yes"},{"id":12,"categoryId":1,"value":"No"}]}""".parseJson)
@@ -64,27 +65,28 @@ class ExtractedDataFormatSuite extends FlatSpec with Matchers {
dataId = extractedData.id,
labelId = Some(LongId(20)),
categoryId = Some(LongId(1)),
- value = Some(FuzzyValue.Yes)
+ value = Some(LabelValue.Yes)
),
ExtractedDataLabel(
id = LongId(0),
dataId = extractedData.id,
labelId = Some(LongId(12)),
categoryId = Some(LongId(1)),
- value = Some(FuzzyValue.No)
+ value = Some(LabelValue.No)
)
)
val expectedUpdatedExtractedData = origRichExtractedData.copy(
extractedData = extractedData.copy(
evidenceText = Some("new evidence text"),
- meta = Some(TextJson(Meta(
- keyword = Meta.Keyword(page = 1, pageRatio = None, index = 2, sortIndex = "ASC"),
- evidence = Meta.Evidence(
- pageRatio = 1.0,
- start = Meta.TextLayerPosition(page = 1, index = 3, offset = 2),
- end = Meta.TextLayerPosition(page = 2, index = 3, offset = 10)
- )
- )))
+ meta = Some(
+ TextJson(Meta(
+ keyword = Meta.Keyword(page = 1, pageRatio = None, index = 2, sortIndex = "ASC"),
+ evidence = Meta.Evidence(
+ pageRatio = 1.0,
+ start = Meta.TextLayerPosition(page = 1, index = 3, offset = 2),
+ end = Meta.TextLayerPosition(page = 2, index = 3, offset = 10)
+ )
+ )))
),
labels = updatedExtractedDataLabels
)
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala
index 306fb17..76d90f5 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala
@@ -17,8 +17,7 @@ class HypothesisFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = hypothesisFormat.write(hypothesis)
- writtenJson should be(
- """{"id":"3b80b2e2-5372-4cf5-a342-6e4ebe10fafd","name":"hypothesis name",
+ writtenJson should be("""{"id":"3b80b2e2-5372-4cf5-a342-6e4ebe10fafd","name":"hypothesis name",
"treatmentType":"treatment type","description":"descr"}""".parseJson)
val parsedHypothesis = hypothesisFormat.read(writtenJson)
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala
index dad39c8..5891e1c 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala
@@ -60,7 +60,7 @@ class InterventionFormatSuite extends FlatSpec with Matchers {
"Json format for InterventionType" should "read and write correct JSON" in {
val interventionType = InterventionType.typeFromString("Surgery/Procedure")
- val writtenJson = interventionTypeFormat.write(interventionType)
+ val writtenJson = interventionTypeFormat.write(interventionType)
writtenJson should be(
"""{"id":9,"name":"Surgery/Procedure","deliveryMethods":["Radio-Frequency Ablation (RFA)",
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ListResponseSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ListResponseSuite.scala
index 52b2324..17d4cfb 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ListResponseSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ListResponseSuite.scala
@@ -10,10 +10,9 @@ import xyz.driver.pdsuidomain.entities.MedicalRecord.Status
import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.formats.json.sprayformats.record.recordFormat
-
class ListResponseSuite extends FlatSpec with Matchers {
- private val lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00")
+ private val lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00")
private val lastUpdateToLocal = "2017-08-10T18:00Z"
private def metaJsonObjectAsString(meta: ListResponse.Meta) = {
@@ -25,7 +24,6 @@ class ListResponseSuite extends FlatSpec with Matchers {
s"""{"itemsCount":$itemsCount,"pageNumber":$pageNumber,"pageSize":$pageSize$lastUpdate}"""
}
-
"Json format for ListResponse.Meta" should "read and write correct JSON" in {
val meta1 =
ListResponse.Meta(
@@ -38,15 +36,13 @@ class ListResponseSuite extends FlatSpec with Matchers {
val writtenJson1 =
ListResponse.listResponseMetaFormat.write(meta1)
- writtenJson1 should be(
- metaJsonObjectAsString(meta1).parseJson)
+ writtenJson1 should be(metaJsonObjectAsString(meta1).parseJson)
val parsedItem1: ListResponse.Meta =
ListResponse.listResponseMetaFormat.read(writtenJson1)
meta1 shouldBe parsedItem1
-
val meta2 =
ListResponse.Meta(
itemsCount = 1,
@@ -58,8 +54,7 @@ class ListResponseSuite extends FlatSpec with Matchers {
val writtenJson2 =
ListResponse.listResponseMetaFormat.write(meta2)
- writtenJson2 should be(
- metaJsonObjectAsString(meta2).parseJson)
+ writtenJson2 should be(metaJsonObjectAsString(meta2).parseJson)
val parsedItem2: ListResponse.Meta =
ListResponse.listResponseMetaFormat.read(writtenJson2)
@@ -67,7 +62,6 @@ class ListResponseSuite extends FlatSpec with Matchers {
meta2 shouldBe parsedItem2
}
-
"Json format for ListResponse" should "write correct JSON" in {
val orig = MedicalRecord(
@@ -80,8 +74,6 @@ class ListResponseSuite extends FlatSpec with Matchers {
lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
physician = Some("physician"),
meta = None,
- predictedMeta = None,
- predictedDocuments = None,
disease = "Breast",
requestId = RecordRequestId(UUID.fromString("7b54a75d-4197-4b27-9045-b9b6cb131be9")),
caseId = None,
@@ -103,11 +95,10 @@ class ListResponseSuite extends FlatSpec with Matchers {
val listResponse = ListResponse(Seq(orig), meta)
- val writtenJson = ListResponse.listResponseMetaWriter.write(listResponse)
+ val writtenJson = ListResponse.listResponseMetaWriter.write(listResponse)
val expectedJson = s"""{"items":[$recordJsonAsString],"meta":${metaJsonObjectAsString(meta)}}"""
- writtenJson should be(
- expectedJson.parseJson)
+ writtenJson should be(expectedJson.parseJson)
}
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordFormatSuite.scala
index 899e5c9..d9fb232 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordFormatSuite.scala
@@ -23,8 +23,6 @@ class MedicalRecordFormatSuite extends FlatSpec with Matchers {
lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"),
physician = Some("physician"),
meta = None,
- predictedMeta = None,
- predictedDocuments = None,
disease = "Breast",
requestId = RecordRequestId(UUID.fromString("7b54a75d-4197-4b27-9045-b9b6cb131be9")),
caseId = None,
@@ -32,7 +30,7 @@ class MedicalRecordFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = recordFormat.write(orig)
- writtenJson should be (
+ writtenJson should be(
"""{"id":1,"status":"New","assignee":null,"previousStatus":null,"previousAssignee":null,"lastActiveUser":null,
"lastUpdate":"2017-08-10T18:00Z","meta":[],"patientId":"748b5884-3528-4cb9-904b-7a8151d6e343","caseId":null,
"requestId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","disease":"Breast","physician":"physician"}""".parseJson)
@@ -52,23 +50,23 @@ class MedicalRecordFormatSuite extends FlatSpec with Matchers {
caseId = None,
physician = None,
meta = None,
- predictedMeta = None,
- predictedDocuments = None,
lastUpdate = LocalDateTime.now()
)
val parsedCreatedRecord = recordFormat.read(createRecordJson).copy(lastUpdate = expectedCreatedRecord.lastUpdate)
parsedCreatedRecord should be(expectedCreatedRecord)
val updateRecordJson =
- """{"meta":[{"type":"duplicate","predicted":true,"startPage":1.0,"endPage":2.0,"startOriginalPage":1.0},
+ """{"meta":[{"type":"duplicate","startPage":1.0,"endPage":2.0,"startOriginalPage":1.0},
{"type":"reorder","items":[1,2]},
{"type":"rotation","items":{"item1":1,"item2":2}}]}""".parseJson
val expectedUpdatedRecord = orig.copy(
- meta = Some(TextJson(List(
- Meta.Duplicate(predicted = Some(true), startPage = 1.0, endPage = 2.0, startOriginalPage = 1.0, endOriginalPage = None),
- Meta.Reorder(predicted = None, items = Seq(1, 2)),
- Meta.Rotation(predicted = None, items = Map("item1" -> 1, "item2" -> 2))
- )))
+ meta = Some(
+ TextJson(
+ List(
+ Meta.Duplicate(startPage = 1.0, endPage = 2.0, startOriginalPage = 1.0, endOriginalPage = None),
+ Meta.Reorder(Seq(1, 2)),
+ Meta.Rotation(Map("item1" -> 1, "item2" -> 2))
+ )))
)
val parsedUpdatedRecord = applyUpdateToMedicalRecord(updateRecordJson, orig)
parsedUpdatedRecord should be(expectedUpdatedRecord)
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordHistoryFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordHistoryFormatSuite.scala
index 5cd6c8d..a8634d9 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordHistoryFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordHistoryFormatSuite.scala
@@ -21,8 +21,7 @@ class MedicalRecordHistoryFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = recordHistoryFormat.write(recordHistory)
- writtenJson should be(
- """{"id":10,"executor":"userId-001","recordId":1,"state":"Clean",
+ writtenJson should be("""{"id":10,"executor":"userId-001","recordId":1,"state":"Clean",
"action":"Start","created":"2017-08-10T18:00Z"}""".parseJson)
val parsedRecordHistory = recordHistoryFormat.read(writtenJson)
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordIssueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordIssueFormatSuite.scala
index c23ca37..5fa740b 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordIssueFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/MedicalRecordIssueFormatSuite.scala
@@ -28,9 +28,9 @@ class MedicalRecordIssueFormatSuite extends FlatSpec with Matchers {
"""{"id":10,"recordId":1,"userId":"userId-001","lastUpdate":"2017-08-10T18:00Z","isDraft":false,
"text":"message text","archiveRequired":false,"startPage":1.0,"endPage":2.0}""".parseJson)
- val createRecordIssueJson = """{"text":"message text","startPage":1.0,"endPage":2.0}""".parseJson
+ val createRecordIssueJson = """{"text":"message text","startPage":1.0,"endPage":2.0}""".parseJson
val expectedCreatedRecordIssue = recordIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
- val parsedCreateRecordIssue = jsValueToRecordIssue(createRecordIssueJson, LongId(1), StringId("userId-001"))
+ val parsedCreateRecordIssue = jsValueToRecordIssue(createRecordIssueJson, LongId(1), StringId("userId-001"))
parsedCreateRecordIssue should be(expectedCreatedRecordIssue)
val updateRecordIssueJson =
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala
index 623b3a9..b254013 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala
@@ -4,7 +4,8 @@ import java.time.LocalDateTime
import spray.json._
import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId}
+import xyz.driver.entities.labels.LabelValue
+import xyz.driver.pdsuicommon.domain.{LongId, StringId}
import xyz.driver.pdsuidomain.entities.{PatientCriterion, PatientCriterionArm}
import xyz.driver.pdsuidomain.services.PatientCriterionService.{DraftPatientCriterion, RichPatientCriterion}
@@ -21,7 +22,7 @@ class PatientCriterionFormatSuite extends FlatSpec with Matchers {
criterionText = "criterion text",
criterionValue = Some(true),
criterionIsDefining = false,
- eligibilityStatus = Some(FuzzyValue.Yes),
+ eligibilityStatus = Some(LabelValue.Yes),
verifiedEligibilityStatus = None,
isVisible = true,
isVerified = true,
@@ -32,21 +33,22 @@ class PatientCriterionFormatSuite extends FlatSpec with Matchers {
PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(32), armName = "arm 32")
)
val richPatientCriterion = RichPatientCriterion(orig, LongId(21), arms)
- val writtenJson = patientCriterionWriter.write(richPatientCriterion)
+ val writtenJson = patientCriterionWriter.write(richPatientCriterion)
- writtenJson should be (
+ writtenJson should be(
"""{"id":1,"labelId":21,"nctId":"NCT00001","criterionId":101,"criterionText":"criterion text","criterionValue":"Yes",
"criterionIsDefining":false,"criterionIsCompound":false,"eligibilityStatus":"Yes","verifiedEligibilityStatus":null,
"isVisible":true,"isVerified":true,"lastUpdate":"2017-08-10T18:00Z","arms":["arm 31","arm 32"]}""".parseJson)
- val updatePatientCriterionJson = """{"verifiedEligibilityStatus":"No"}""".parseJson
- val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = Some(FuzzyValue.No))
- val parsedUpdatePatientCriterion = applyUpdateToPatientCriterion(updatePatientCriterionJson, orig)
+ val updatePatientCriterionJson = """{"verifiedEligibilityStatus":"No"}""".parseJson
+ val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = Some(LabelValue.No))
+ val parsedUpdatePatientCriterion = applyUpdateToPatientCriterion(updatePatientCriterionJson, orig)
parsedUpdatePatientCriterion should be(expectedUpdatedPatientCriterion)
- val updateBulkPatientCriterionJson = """[{"id":1,"eligibilityStatus":"No"},{"id":2,"isVerified":false}]""".parseJson
+ val updateBulkPatientCriterionJson =
+ """[{"id":1,"eligibilityStatus":"No"},{"id":2,"isVerified":false}]""".parseJson
val expectedDraftPatientCriterionList = List(
- DraftPatientCriterion(id = LongId(1), eligibilityStatus = Some(FuzzyValue.No), isVerified = None),
+ DraftPatientCriterion(id = LongId(1), eligibilityStatus = Some(LabelValue.No), isVerified = None),
DraftPatientCriterion(id = LongId(2), eligibilityStatus = None, isVerified = Some(false))
)
val parsedDraftPatientCriterionList = draftPatientCriterionListReader.read(updateBulkPatientCriterionJson)
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala
index 8b00883..b8f6f8e 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala
@@ -2,9 +2,10 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats
import java.time.LocalDateTime
-import spray.json._
import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId}
+import spray.json._
+import xyz.driver.entities.labels.LabelValue
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuidomain.entities.{PatientCriterionArm, PatientTrialArmGroupView, Trial}
import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial
@@ -37,24 +38,24 @@ class PatientEligibleTrialFormatSuite extends FlatSpec with Matchers {
patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
trialId = StringId("NCT000001"),
hypothesisId = UuidId("e76e2fc4-a29c-44fb-a81b-8856d06bb1d4"),
- eligibilityStatus = Some(FuzzyValue.Yes),
- verifiedEligibilityStatus = Some(FuzzyValue.Yes),
+ eligibilityStatus = Some(LabelValue.Yes),
+ verifiedEligibilityStatus = Some(LabelValue.Yes),
isVerified = false
)
val arms = List(
PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(31), armName = "arm 31"),
PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(32), armName = "arm 32")
)
- val orig = RichPatientEligibleTrial(trial, group, arms)
+ val orig = RichPatientEligibleTrial(trial, group, arms)
val writtenJson = patientEligibleTrialWriter.write(orig)
- writtenJson should be (
+ writtenJson should be(
"""{"id":1,"patientId":"748b5884-3528-4cb9-904b-7a8151d6e343","trialId":"NCT000001","trialTitle":"trial title",
"hypothesisId":"e76e2fc4-a29c-44fb-a81b-8856d06bb1d4","verifiedEligibilityStatus":"Yes","isVerified":false,"arms":["arm 31","arm 32"]}""".parseJson)
- val updatePatientEligibleTrialJson = """{"isVerified":true}""".parseJson
+ val updatePatientEligibleTrialJson = """{"isVerified":true}""".parseJson
val expectedUpdatedPatientTrialArmGroup = group.copy(isVerified = true)
- val parsedUpdatePatientTrialArmGroup = applyUpdateToTrialArmGroup(updatePatientEligibleTrialJson, group)
+ val parsedUpdatePatientTrialArmGroup = applyUpdateToTrialArmGroup(updatePatientEligibleTrialJson, group)
parsedUpdatePatientTrialArmGroup should be(expectedUpdatedPatientTrialArmGroup)
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala
index 2761d6a..128cad1 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala
@@ -4,6 +4,8 @@ import java.time.{LocalDate, LocalDateTime}
import spray.json._
import org.scalatest.{FlatSpec, Matchers}
+import xyz.driver.entities.common.FullName
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.domain.UuidId
import xyz.driver.pdsuidomain.entities.{Patient, PatientOrderId}
@@ -14,23 +16,24 @@ class PatientFormatSuite extends FlatSpec with Matchers {
val orig = Patient(
id = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
status = Patient.Status.New,
- name = "John Doe",
+ name = FullName.fromStrings("John", "", "Doe"),
dob = LocalDate.parse("1980-06-30"),
assignee = None,
previousStatus = None,
previousAssignee = None,
lastActiveUserId = None,
isUpdateRequired = false,
- condition = "breast",
+ disease = CancerType.Breast,
orderId = PatientOrderId("7b54a75d-4197-4b27-9045-b9b6cb131be9"),
lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00")
)
val writtenJson = patientWriter.write(orig)
- writtenJson should be (
- """{"id":"748b5884-3528-4cb9-904b-7a8151d6e343","dob":"1980-06-30","name":"John Doe","status":"New","assignee":null,
+ writtenJson should be(
+ """{"id":"748b5884-3528-4cb9-904b-7a8151d6e343","dob":"1980-06-30",
+ "name":{"firstName":"John","middleName":"","lastName":"Doe"},"status":"New","assignee":null,
"previousStatus":null,"previousAssignee":null,"lastActiveUser":null,"lastUpdate":"2017-08-10T18:00Z",
- "orderId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","condition":"breast"}""".parseJson)
+ "orderId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","disease":"Breast"}""".parseJson)
}
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala
index fbb5213..71cbbad 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala
@@ -19,13 +19,13 @@ class PatientHypothesisFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = richPatientHypothesisWriter.write(RichPatientHypothesis(orig, isRequired = true))
- writtenJson should be (
+ writtenJson should be(
"""{"id":"815d9715-1089-4775-b120-3afb983b9a97","patientId":"748b5884-3528-4cb9-904b-7a8151d6e343",
"hypothesisId":"e76e2fc4-a29c-44fb-a81b-8856d06bb1d4","rationale":null,"matchedTrials":1,"isRationaleRequired":true}""".parseJson)
- val updatePatientHypothesisJson = """{"rationale":"rationale"}""".parseJson
+ val updatePatientHypothesisJson = """{"rationale":"rationale"}""".parseJson
val expectedUpdatedPatientHypothesis = orig.copy(rationale = Some("rationale"))
- val parsedUpdatePatientHypothesis = applyUpdateToPatientHypothesis(updatePatientHypothesisJson, orig)
+ val parsedUpdatePatientHypothesis = applyUpdateToPatientHypothesis(updatePatientHypothesisJson, orig)
parsedUpdatePatientHypothesis should be(expectedUpdatedPatientHypothesis)
}
@@ -39,7 +39,7 @@ class PatientHypothesisFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = patientHypothesisWriter.write(orig)
- writtenJson should be (
+ writtenJson should be(
"""{"id":"815d9715-1089-4775-b120-3afb983b9a97","patientId":"748b5884-3528-4cb9-904b-7a8151d6e343",
"hypothesisId":"e76e2fc4-a29c-44fb-a81b-8856d06bb1d4","rationale":null,"matchedTrials":1}""".parseJson)
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientIssueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientIssueFormatSuite.scala
index 1e2a11e..2776dcc 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientIssueFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientIssueFormatSuite.scala
@@ -22,13 +22,14 @@ class PatientIssueFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = patientIssueWriter.write(patientIssue)
- writtenJson should be(
- """{"id":10,"userId":"userId-001","lastUpdate":"2017-08-10T18:00Z","isDraft":false,
+ writtenJson should be("""{"id":10,"userId":"userId-001","lastUpdate":"2017-08-10T18:00Z","isDraft":false,
"text":"message text","archiveRequired":false}""".parseJson)
- val createPatientIssueJson = """{"text":"message text"}""".parseJson
+ val createPatientIssueJson = """{"text":"message text"}""".parseJson
val expectedCreatedPatientIssue = patientIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
- val parsedCreatePatientIssue = jsValueToPatientIssue(createPatientIssueJson, UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"), StringId("userId-001"))
+ val parsedCreatePatientIssue = jsValueToPatientIssue(createPatientIssueJson,
+ UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
+ StringId("userId-001"))
parsedCreatePatientIssue should be(expectedCreatedPatientIssue)
val updatePatientIssueJson =
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
index 3ef286d..2122777 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
@@ -4,8 +4,9 @@ import java.time.LocalDate
import spray.json._
import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, UuidId}
-import xyz.driver.pdsuidomain.entities.{PatientLabel, PatientLabelEvidenceView}
+import xyz.driver.entities.labels.LabelValue
+import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
+import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel
class PatientLabelFormatSuite extends FlatSpec with Matchers {
@@ -16,7 +17,7 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
id = LongId(1),
patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
labelId = LongId(20),
- primaryValue = Some(FuzzyValue.Yes),
+ primaryValue = Some(LabelValue.Yes),
verifiedPrimaryValue = None,
isVisible = true,
score = 1,
@@ -24,13 +25,13 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = richPatientLabelWriter.write(RichPatientLabel(orig, isVerified = true))
- writtenJson should be (
+ writtenJson should be(
"""{"id":1,"labelId":20,"primaryValue":"Yes","verifiedPrimaryValue":null,"isVisible":true,"isVerified":true,
"score":1,"isImplicitMatch":false}""".parseJson)
- val updatePatientLabelJson = """{"verifiedPrimaryValue":"No"}""".parseJson
- val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = Some(FuzzyValue.No))
- val parsedUpdatePatientLabel = applyUpdateToPatientLabel(updatePatientLabelJson, orig)
+ val updatePatientLabelJson = """{"verifiedPrimaryValue":"No"}""".parseJson
+ val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = Some(LabelValue.No))
+ val parsedUpdatePatientLabel = applyUpdateToPatientLabel(updatePatientLabelJson, orig)
parsedUpdatePatientLabel should be(expectedUpdatedPatientLabel)
}
@@ -38,23 +39,24 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
import patientlabel._
val orig = PatientLabelEvidenceView(
id = LongId(1),
- value = FuzzyValue.Maybe,
+ value = LabelValue.Maybe,
evidenceText = "evidence text",
documentId = Some(LongId(21)),
evidenceId = Some(LongId(10)),
reportId = None,
- documentType = "document type",
+ documentType = DocumentType.LaboratoryReport,
date = Some(LocalDate.parse("2017-08-10")),
- providerType = "provider type",
+ providerType = ProviderType.EmergencyMedicine,
patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
labelId = LongId(20),
isImplicitMatch = false
)
val writtenJson = patientLabelEvidenceWriter.write(orig)
- writtenJson should be (
+ writtenJson should be(
"""{"id":1,"value":"Maybe","evidenceText":"evidence text","documentId":21,"evidenceId":10,"reportId":null,
- "documentType":"document type","date":"2017-08-10","providerType":"provider type"}""".parseJson)
+ "documentType":{"id":3,"name":"Laboratory Report"},"date":"2017-08-10",
+ "providerType":{"id":26,"name":"Emergency Medicine"}}""".parseJson)
}
"Json format for PatientLabelDefiningCriteria" should "read and write correct JSON" in {
@@ -63,15 +65,15 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
id = LongId(1),
patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
labelId = LongId(20),
- primaryValue = Some(FuzzyValue.Yes),
- verifiedPrimaryValue = Some(FuzzyValue.Yes),
+ primaryValue = Some(LabelValue.Yes),
+ verifiedPrimaryValue = Some(LabelValue.Yes),
isVisible = true,
score = 1,
isImplicitMatch = false
)
val writtenJson = patientLabelDefiningCriteriaWriter.write(orig)
- writtenJson should be ("""{"id":1,"value":"Yes"}""".parseJson)
+ writtenJson should be("""{"id":1,"value":"Yes"}""".parseJson)
}
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala
index 3533c07..c9dc85f 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala
@@ -2,8 +2,8 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats
import java.time.LocalDateTime
-import spray.json._
import org.scalatest.{FlatSpec, Matchers}
+import spray.json._
import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuidomain.entities.Trial
@@ -33,16 +33,16 @@ class TrialFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = trialWriter.write(orig)
- writtenJson should be (
+ writtenJson should be(
"""{"isPartner":false,"assignee":null,"lastUpdate":"2017-08-10T18:16:19Z","previousStatus":null,
"isUpdated":false,"overviewTemplate":"","phase":"","originalStudyDesignId":null,
"hypothesisId":"3b80b2e2-5372-4cf5-a342-6e4ebe10fafd","originalTitle":"orig trial title",
"studyDesignId":321,"lastActiveUser":null,"externalid":"40892a07-c638-49d2-9795-1edfefbbcc7c",
"id":"NCT000001","status":"New","overview":null,"previousAssignee":null,"title":"trial title"}""".parseJson)
- val updateTrialJson = """{"hypothesisId":null,"overview":"new overview"}""".parseJson
+ val updateTrialJson = """{"hypothesisId":null,"overview":"new overview"}""".parseJson
val expectedUpdatedTrial = orig.copy(hypothesisId = None, overview = Some("new overview"))
- val parsedUpdateTrial = applyUpdateToTrial(updateTrialJson, orig)
+ val parsedUpdateTrial = applyUpdateToTrial(updateTrialJson, orig)
parsedUpdateTrial should be(expectedUpdatedTrial)
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialHistoryFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialHistoryFormatSuite.scala
index dbb143c..d5ad2ec 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialHistoryFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialHistoryFormatSuite.scala
@@ -21,8 +21,7 @@ class TrialHistoryFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = trialHistoryFormat.write(trialHistory)
- writtenJson should be(
- """{"id":10,"executor":"userId-001","trialId":"NCT000001","state":"Summarize",
+ writtenJson should be("""{"id":10,"executor":"userId-001","trialId":"NCT000001","state":"Summarize",
"action":"Start","created":"2017-08-10T18:00Z"}""".parseJson)
val parsedTrialHistory = trialHistoryFormat.read(writtenJson)
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialIssueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialIssueFormatSuite.scala
index 02e14ba..4a9ea4f 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialIssueFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialIssueFormatSuite.scala
@@ -24,13 +24,13 @@ class TrialIssueFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = trialIssueWriter.write(trialIssue)
- writtenJson should be(
- """{"id":10,"userId":"userId-001","lastUpdate":"2017-08-10T18:00Z","isDraft":false,
+ writtenJson should be("""{"id":10,"userId":"userId-001","lastUpdate":"2017-08-10T18:00Z","isDraft":false,
"text":"message text","evidence":"evidence","archiveRequired":false,"meta":"{}"}""".parseJson)
- val createTrialIssueJson = """{"text":"message text","evidence":"evidence","meta":"{}"}""".parseJson
+ val createTrialIssueJson = """{"text":"message text","evidence":"evidence","meta":"{}"}""".parseJson
val expectedCreatedTrialIssue = trialIssue.copy(id = LongId(0), lastUpdate = LocalDateTime.MIN, isDraft = true)
- val parsedCreateTrialIssue = jsValueToTrialIssue(createTrialIssueJson, StringId("NCT000001"), StringId("userId-001"))
+ val parsedCreateTrialIssue =
+ jsValueToTrialIssue(createTrialIssueJson, StringId("NCT000001"), StringId("userId-001"))
parsedCreateTrialIssue should be(expectedCreatedTrialIssue)
val updateTrialIssueJson =