aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2017-10-04 16:23:04 +0700
committerAleksandr <ognelisar@gmail.com>2017-10-04 16:23:04 +0700
commit7446fbcb6f51ae67ae8bf0f54729e774da8e7f73 (patch)
tree667c0f62d13561732096c2c9b251e3a227abfbe0 /src/main/scala/xyz/driver/pdsuidomain/formats
parent996af2657cdd779e08e46fc1ba5f47d9e7c5aac5 (diff)
downloadrest-query-7446fbcb6f51ae67ae8bf0f54729e774da8e7f73.tar.gz
rest-query-7446fbcb6f51ae67ae8bf0f54729e774da8e7f73.tar.bz2
rest-query-7446fbcb6f51ae67ae8bf0f54729e774da8e7f73.zip
Implemented new spray json formats for PatientHypothesis and PatientLabel
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienthypothesis.scala15
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala16
2 files changed, 29 insertions, 2 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienthypothesis.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienthypothesis.scala
index 82759ab..bd448b3 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienthypothesis.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienthypothesis.scala
@@ -19,7 +19,7 @@ object patienthypothesis {
case _ => deserializationError(s"Expected Json Object as partial PatientHypothesis, but got $json")
}
- implicit val patientHypothesisWriter: RootJsonWriter[RichPatientHypothesis] =
+ implicit val richPatientHypothesisWriter: RootJsonWriter[RichPatientHypothesis] =
new RootJsonWriter[RichPatientHypothesis] {
override def write(obj: RichPatientHypothesis): JsValue = {
JsObject(
@@ -33,4 +33,17 @@ object patienthypothesis {
}
}
+ implicit val patientHypothesisWriter: RootJsonWriter[PatientHypothesis] =
+ new RootJsonWriter[PatientHypothesis] {
+ override def write(obj: PatientHypothesis): JsValue = {
+ JsObject(
+ "id" -> obj.id.toJson,
+ "patientId" -> obj.patientId.toJson,
+ "hypothesisId" -> obj.hypothesisId.toJson,
+ "matchedTrials" -> obj.matchedTrials.toJson,
+ "rationale" -> obj.rationale.toJson
+ )
+ }
+ }
+
}
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 f4af376..10a0a94 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
@@ -29,7 +29,7 @@ object patientlabel {
case _ => deserializationError(s"Expected Json Object as PatientLabel, but got $json")
}
- implicit val patientLabelWriter: RootJsonWriter[RichPatientLabel] = new RootJsonWriter[RichPatientLabel] {
+ implicit val richPatientLabelWriter: RootJsonWriter[RichPatientLabel] = new RootJsonWriter[RichPatientLabel] {
override def write(obj: RichPatientLabel): JsValue = {
JsObject(
"id" -> obj.patientLabel.id.toJson,
@@ -44,6 +44,20 @@ object patientlabel {
}
}
+ implicit val patientLabelWriter: RootJsonWriter[PatientLabel] = new RootJsonWriter[PatientLabel] {
+ override def write(obj: PatientLabel): JsValue = {
+ JsObject(
+ "id" -> obj.id.toJson,
+ "labelId" -> obj.labelId.toJson,
+ "primaryValue" -> obj.primaryValue.toJson,
+ "verifiedPrimaryValue" -> obj.verifiedPrimaryValue.toJson,
+ "score" -> obj.score.toJson,
+ "isImplicitMatch" -> obj.isImplicitMatch.toJson,
+ "isVisible" -> obj.isVisible.toJson
+ )
+ }
+ }
+
implicit val patientLabelEvidenceWriter: RootJsonWriter[PatientLabelEvidenceView] =
new RootJsonWriter[PatientLabelEvidenceView] {
override def write(evidence: PatientLabelEvidenceView): JsValue =