diff options
author | Vlad Uspensky <v.uspenskiy@icloud.com> | 2017-09-26 12:48:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-26 12:48:55 -0700 |
commit | 7bb4873042d1bc557a7f2e78b15a44d3ba182bf5 (patch) | |
tree | 15fe180be3f035f308168d5564d01cf293a1f83a /src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/intervention.scala | |
parent | 2cd8e672feba0d076f4f44f556f993f1db2043b7 (diff) | |
parent | c0ffb2a34240876c16f9ce62205cf257aa6d5991 (diff) | |
download | rest-query-7bb4873042d1bc557a7f2e78b15a44d3ba182bf5.tar.gz rest-query-7bb4873042d1bc557a7f2e78b15a44d3ba182bf5.tar.bz2 rest-query-7bb4873042d1bc557a7f2e78b15a44d3ba182bf5.zip |
Merge pull request #29 from drivergroup/PDSUI-2275
PDSUI-2275 Added delivery_method field to intervention table
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/intervention.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/intervention.scala | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/intervention.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/intervention.scala index 8651932..daa28e4 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/intervention.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/intervention.scala @@ -18,6 +18,7 @@ object intervention { "isActive" -> obj.intervention.isActive.toJson, "arms" -> obj.arms.map(_.armId).toJson, "trialId" -> obj.intervention.trialId.toJson, + "deliveryMethod" -> obj.intervention.deliveryMethod.toJson, "originalName" -> obj.intervention.originalName.toJson, "originalDosage" -> obj.intervention.originalDosage.toJson, "originalType" -> obj.intervention.originalType.toJson @@ -48,6 +49,10 @@ object intervention { .get("isActive") .exists(_.convertTo[Boolean]) + val deliveryMethod = fields + .get("deliveryMethod") + .map(_.convertTo[String]) + val arms = fields .get("arms") .map(_.convertTo[List[LongId[Arm]]].map(x => InterventionArm(armId = x, interventionId = LongId(0)))) @@ -63,7 +68,8 @@ object intervention { originalType = None, dosage = dosage, originalDosage = dosage, - isActive = isActive + isActive = isActive, + deliveryMethod = deliveryMethod ), arms = arms ) @@ -90,6 +96,10 @@ object intervention { .get("isActive") .map(_.convertTo[Boolean]) + val deliveryMethod = fields + .get("deliveryMethod") + .map(_.convertTo[String]) + val origIntervention = orig.intervention val arms = fields .get("arms") @@ -100,7 +110,8 @@ object intervention { name = name.getOrElse(origIntervention.name), typeId = typeId.orElse(origIntervention.typeId), dosage = dosage.getOrElse(origIntervention.dosage), - isActive = isActive.getOrElse(origIntervention.isActive) + isActive = isActive.getOrElse(origIntervention.isActive), + deliveryMethod = deliveryMethod.orElse(origIntervention.deliveryMethod) ), arms = arms.getOrElse(orig.arms) ) |