From 4a657a974815a5e6de56808d818efc84164c3956 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 27 Nov 2017 21:49:32 -0800 Subject: Revert 'Add formats for patient eligible trials' --- .../formats/json/patienteligibletrial.scala | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats') 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 11253fc..4c006f9 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala @@ -8,8 +8,6 @@ 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 { @@ -24,10 +22,19 @@ object patienteligibletrial { case _ => deserializationError(s"Expected Json Object as partial PatientTrialArmGroupView, but got $json") } - implicit val patientEligibleArmGroupView: RootJsonFormat[PatientTrialArmGroupView] = - jsonFormat7(PatientTrialArmGroupView.apply) - - implicit val patientEligibleTrialFormat: RootJsonFormat[RichPatientEligibleTrial] = - jsonFormat3(RichPatientEligibleTrial.apply) + 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 + ) + } } -- cgit v1.2.3