aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-04 18:29:52 +0700
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-04 18:29:52 +0700
commitc5462a496aeb4d43f023bb427bf12fc87b482b61 (patch)
treed70b3624a66203716e27939db90d9ed695955c63
parenta813bb68eb3a63e8eeab5d8fb3db36472296f1db (diff)
downloadrest-query-c5462a496aeb4d43f023bb427bf12fc87b482b61.tar.gz
rest-query-c5462a496aeb4d43f023bb427bf12fc87b482b61.tar.bz2
rest-query-c5462a496aeb4d43f023bb427bf12fc87b482b61.zip
Deleted duplicate spray format and fixed reply of patient eligible trial service
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala2
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patienthypothesis.scala10
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala14
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala5
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala20
5 files changed, 8 insertions, 43 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala
index b97570a..0520ef2 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientdefiningcriteria.scala
@@ -7,7 +7,7 @@ object patientdefiningcriteria {
import DefaultJsonProtocol._
import common._
- implicit val patientLabelDefiningCriteriaWriter: JsonWriter[PatientLabel] = new JsonWriter[PatientLabel] {
+ implicit val patientLabelDefiningCriteriaWriter: RootJsonWriter[PatientLabel] = new RootJsonWriter[PatientLabel] {
override def write(obj: PatientLabel) =
JsObject(
"id" -> obj.id.toJson,
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 bd448b3..b8c0058 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
@@ -37,11 +37,11 @@ object 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
+ "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 10a0a94..b36949e 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
@@ -44,20 +44,6 @@ 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 =
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala
index abb3f8a..d9013c6 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala
@@ -1,12 +1,12 @@
package xyz.driver.pdsuidomain.services
-import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.auth.AuthenticatedRequestContext
import xyz.driver.pdsuicommon.db.{Pagination, SearchFilterExpr, Sorting}
import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
import xyz.driver.pdsuicommon.error.DomainError
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.entities.{Trial, _}
+import xyz.driver.pdsuidomain.services.PatientCriterionService.RichPatientCriterion
import scala.concurrent.Future
@@ -71,8 +71,7 @@ object PatientEligibleTrialService {
sealed trait GetCriterionListOfGroupReply
object GetCriterionListOfGroupReply {
- final case class EntityList(xs: Seq[(PatientCriterion, LongId[Label], List[PatientCriterionArm])], totalFound: Int)
- extends GetCriterionListOfGroupReply
+ final case class EntityList(xs: Seq[RichPatientCriterion], totalFound: Int) extends GetCriterionListOfGroupReply
type Error = GetCriterionListOfGroupReply with DomainError
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
index ffb1bd4..3ef286d 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
@@ -34,26 +34,6 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
parsedUpdatePatientLabel should be(expectedUpdatedPatientLabel)
}
- "Json format for PatientLabel" should "read and write correct JSON" in {
- import patientlabel._
- val orig = PatientLabel(
- id = LongId(1),
- patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
- labelId = LongId(20),
- primaryValue = Some(FuzzyValue.Yes),
- verifiedPrimaryValue = None,
- isVisible = true,
- score = 1,
- isImplicitMatch = false
- )
- val writtenJson = patientLabelWriter.write(orig)
-
- writtenJson should be (
- """{"id":1,"labelId":20,"primaryValue":"Yes","verifiedPrimaryValue":null,"isVisible":true,
- "score":1,"isImplicitMatch":false}""".parseJson)
- }
-
-
"Json format for PatientLabelEvidence" should "read and write correct JSON" in {
import patientlabel._
val orig = PatientLabelEvidenceView(