aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats
diff options
context:
space:
mode:
authorJakob Odersky <jakob@driver.xyz>2017-11-20 20:41:50 -0800
committerJakob Odersky <jakob@driver.xyz>2017-11-20 20:47:35 -0800
commit92df74ed76b7a06dbe1405fc496f3f650709e75f (patch)
treefbef129d0bee9a3e23cb3e9d5fbdbd77f1484e87 /src/main/scala/xyz/driver/pdsuidomain/formats
parent38a00385d1b11046cd33384e61ad59958f474c88 (diff)
downloadrest-query-92df74ed76b7a06dbe1405fc496f3f650709e75f.tar.gz
rest-query-92df74ed76b7a06dbe1405fc496f3f650709e75f.tar.bz2
rest-query-92df74ed76b7a06dbe1405fc496f3f650709e75f.zip
Add formats for patient eligible trials
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala
index 4c006f9..11253fc 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala
@@ -8,6 +8,8 @@ import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEl
object patienteligibletrial {
import DefaultJsonProtocol._
import common._
+ import xyz.driver.pdsuidomain.formats.json.trial._
+ import xyz.driver.pdsuidomain.formats.json.patientcriterion._
def applyUpdateToTrialArmGroup(json: JsValue, orig: PatientTrialArmGroupView): PatientTrialArmGroupView =
json match {
@@ -22,19 +24,10 @@ object patienteligibletrial {
case _ => deserializationError(s"Expected Json Object as partial PatientTrialArmGroupView, but got $json")
}
- implicit val patientEligibleTrialWriter: RootJsonWriter[RichPatientEligibleTrial] =
- new RootJsonWriter[RichPatientEligibleTrial] {
- override def write(obj: RichPatientEligibleTrial) =
- JsObject(
- "id" -> obj.group.id.toJson,
- "patientId" -> obj.group.patientId.toJson,
- "trialId" -> obj.group.trialId.toJson,
- "trialTitle" -> obj.trial.title.toJson,
- "arms" -> obj.arms.map(_.armName).toJson,
- "hypothesisId" -> obj.trial.hypothesisId.toJson,
- "verifiedEligibilityStatus" -> obj.group.verifiedEligibilityStatus.toJson,
- "isVerified" -> obj.group.isVerified.toJson
- )
- }
+ implicit val patientEligibleArmGroupView: RootJsonFormat[PatientTrialArmGroupView] =
+ jsonFormat7(PatientTrialArmGroupView.apply)
+
+ implicit val patientEligibleTrialFormat: RootJsonFormat[RichPatientEligibleTrial] =
+ jsonFormat3(RichPatientEligibleTrial.apply)
}