diff options
author | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 18:09:49 -0700 |
---|---|---|
committer | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 18:09:49 -0700 |
commit | 85c78f58f0428d13795aa0419ff42471513a34d6 (patch) | |
tree | d28e95168b7fcf9682e36aa2a4ba2bfb7eb8b8cb | |
parent | b124608a4faa9cb94474f27c1d4605e5cb0ab63d (diff) | |
download | rest-query-0.7.6.tar.gz rest-query-0.7.6.tar.bz2 rest-query-0.7.6.zip |
add diseaseList to ExportTrialArmv0.7.6
5 files changed, 11 insertions, 8 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialArm.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialArm.scala index 24fe641..fbac0df 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialArm.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialArm.scala @@ -4,12 +4,12 @@ import xyz.driver.pdsuicommon.domain._ import xyz.driver.pdsuicommon.logging._ import xyz.driver.pdsuidomain.entities.EligibilityArm -final case class ExportTrialArm(armId: LongId[EligibilityArm], armName: String) +final case class ExportTrialArm(armId: LongId[EligibilityArm], armName: String, diseaseList: Seq[String]) object ExportTrialArm { implicit def toPhiString(x: ExportTrialArm): PhiString = { import x._ - phi"ExportTrialArm(armId=$armId, armName=${Unsafe(armName)})" + phi"ExportTrialArm(armId=$armId, armName=${Unsafe(armName)}, diseaseList=${Unsafe(diseaseList)})" } } 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 5febd8f..1fe7533 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala @@ -9,7 +9,9 @@ object export { import xyz.driver.core.generators._ def nextExportTrialArm(): ExportTrialArm = - ExportTrialArm(armId = nextLongId[EligibilityArm], armName = nextString(100)) + ExportTrialArm(armId = nextLongId[EligibilityArm], + armName = nextString(100), + diseaseList = listOf(nextString(100))) def nextExportTrialLabelCriterion(): ExportTrialLabelCriterion = ExportTrialLabelCriterion( 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 1c4b6b4..4391453 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 @@ -25,7 +25,7 @@ object export { implicit val patientWithLabelsFormat: RootJsonFormat[ExportPatientWithLabels] = jsonFormat(ExportPatientWithLabels.apply, "patientId", "labelVersion", "labels") - implicit val trialArmFormat: RootJsonFormat[ExportTrialArm] = jsonFormat2(ExportTrialArm.apply) + implicit val trialArmFormat: RootJsonFormat[ExportTrialArm] = jsonFormat3(ExportTrialArm.apply) implicit val trialLabelCriterionFormat: RootJsonFormat[ExportTrialLabelCriterion] = new RootJsonFormat[ExportTrialLabelCriterion] { 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 0431d95..e0efcd1 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala @@ -74,7 +74,8 @@ class FakeTrialService extends TrialService { generators.listOf( new ExportTrialArm( LongId[EligibilityArm](generators.nextInt(999999).toLong), - generators.nextName().value + generators.nextName().value, + generators.listOf(generators.oneOf("adenocarcinoma", "breast", "prostate")) )), generators.listOf( new ExportTrialLabelCriterion( 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 3eaf93f..d78e754 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 @@ -81,8 +81,8 @@ class ExportFormatSuite extends FlatSpec with Matchers { "Json format for ApiExportTrialWithLabels" should "read and write correct JSON" in { import xyz.driver.pdsuidomain.entities.export.trial._ val arms = List( - ExportTrialArm(armId = LongId(1), armName = "arm 1"), - ExportTrialArm(armId = LongId(2), armName = "arm 2") + ExportTrialArm(armId = LongId(1), armName = "arm 1", diseaseList = Seq("Breast")), + ExportTrialArm(armId = LongId(2), armName = "arm 2", diseaseList = Seq("Breast")) ) val criteriaList = List( ExportTrialLabelCriterion( @@ -116,7 +116,7 @@ class ExportFormatSuite extends FlatSpec with Matchers { val writtenJson = trialWithLabelsFormat.write(trialWithLabels) writtenJson should be( """{"nctId":"NCT000001","trialId":"40892a07-c638-49d2-9795-1edfefbbcc7c","lastReviewed":"2017-08-10T18:00Z", - "labelVersion":1,"arms":[{"armId":1,"armName":"arm 1"},{"armId":2,"armName":"arm 2"}],"criteria":[ + "labelVersion":1,"arms":[{"armId":1,"armName":"arm 1","diseaseList":["Breast"]},{"armId":2,"armName":"arm 2","diseaseList":["Breast"]}],"criteria":[ {"value":"Yes","labelId":21,"criterionId":10,"criterionText":"criteria 10 text","armIds":[1,2],"isCompound":false,"isDefining":false}, {"value":"Unknown","labelId":21,"criterionId":11,"criterionText":"criteria 11 text","armIds":[2],"isCompound":true,"isDefining":false}]}""".parseJson) } |