From 96d81a36286e41035ff4068859a3b0f9da924fbc Mon Sep 17 00:00:00 2001 From: vlad Date: Fri, 30 Jun 2017 19:38:37 -0700 Subject: Latest PDS UI utils including all the domain stuff --- .../driver/pdsuidomain/formats/json/patient/ApiPatient.scala | 3 +++ .../json/patient/eligible/ApiPatientEligibleTrial.scala | 6 +++--- .../json/patient/hypothesis/ApiPatientHypothesis.scala | 11 +++++++---- .../formats/json/patient/label/ApiPartialPatientLabel.scala | 2 -- .../formats/json/patient/trial/ApiPatientCriterion.scala | 3 +++ 5 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/patient') diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala index caa556b..68e965c 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/ApiPatient.scala @@ -13,6 +13,7 @@ final case class ApiPatient(id: String, assignee: Option[Long], previousStatus: Option[String], previousAssignee: Option[Long], + lastActiveUser: Option[Long], lastUpdate: ZonedDateTime, condition: String) @@ -26,6 +27,7 @@ object ApiPatient { (JsPath \ "assignee").formatNullable[Long] and (JsPath \ "previousStatus").formatNullable[String] and (JsPath \ "previousAssignee").formatNullable[Long] and + (JsPath \ "lastActiveUser").formatNullable[Long] and (JsPath \ "lastUpdate").format[ZonedDateTime] and (JsPath \ "condition").format[String] )(ApiPatient.apply, unlift(ApiPatient.unapply)) @@ -38,6 +40,7 @@ object ApiPatient { assignee = patient.assignee.map(_.id), previousStatus = patient.previousStatus.map(PatientStatus.statusToString), previousAssignee = patient.previousAssignee.map(_.id), + lastActiveUser = patient.lastActiveUserId.map(_.id), lastUpdate = ZonedDateTime.of(patient.lastUpdate, ZoneId.of("Z")), condition = patient.condition ) diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala index 42c3259..033d73e 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala @@ -14,7 +14,7 @@ final case class ApiPatientEligibleTrial(id: Long, trialTitle: String, arms: List[String], hypothesisId: UUID, - eligibilityStatus: Option[String], + verifiedEligibilityStatus: Option[String], isVerified: Boolean) object ApiPatientEligibleTrial { @@ -26,7 +26,7 @@ object ApiPatientEligibleTrial { (JsPath \ "trialTitle").format[String] and (JsPath \ "arms").format[List[String]] and (JsPath \ "hypothesisId").format[UUID] and - (JsPath \ "eligibilityStatus").formatNullable[String](Format( + (JsPath \ "verifiedEligibilityStatus").formatNullable[String](Format( Reads .of[String] .filter(ValidationError("unknown eligibility status"))({ @@ -45,7 +45,7 @@ object ApiPatientEligibleTrial { trialTitle = eligibleTrialWithTrial.trial.title, arms = eligibleTrialWithTrial.arms.map(_.name), hypothesisId = eligibleTrialWithTrial.group.hypothesisId.id, - eligibleTrialWithTrial.group.eligibilityStatus.map(FuzzyValue.valueToString), + eligibleTrialWithTrial.group.verifiedEligibilityStatus.map(FuzzyValue.valueToString), eligibleTrialWithTrial.group.isVerified ) } diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/hypothesis/ApiPatientHypothesis.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/hypothesis/ApiPatientHypothesis.scala index 374370e..584ff72 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/hypothesis/ApiPatientHypothesis.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/hypothesis/ApiPatientHypothesis.scala @@ -10,7 +10,8 @@ final case class ApiPatientHypothesis(id: UUID, patientId: String, hypothesisId: UUID, matchedTrials: Long, - rationale: Option[String]) + rationale: Option[String], + isRationaleRequired: Boolean) object ApiPatientHypothesis { @@ -19,14 +20,16 @@ object ApiPatientHypothesis { (JsPath \ "patientId").format[String] and (JsPath \ "hypothesisId").format[UUID] and (JsPath \ "matchedTrials").format[Long] and - (JsPath \ "rationale").formatNullable[String] + (JsPath \ "rationale").formatNullable[String] and + (JsPath \ "isRationaleRequired").format[Boolean] )(ApiPatientHypothesis.apply, unlift(ApiPatientHypothesis.unapply)) - def fromDomain(patientHypothesis: PatientHypothesis) = ApiPatientHypothesis( + def fromDomain(patientHypothesis: PatientHypothesis, isRationaleRequired: Boolean) = ApiPatientHypothesis( id = patientHypothesis.id.id, patientId = patientHypothesis.patientId.toString, hypothesisId = patientHypothesis.hypothesisId.id, matchedTrials = patientHypothesis.matchedTrials, - rationale = patientHypothesis.rationale + rationale = patientHypothesis.rationale, + isRationaleRequired = isRationaleRequired ) } diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala index 40f7de4..91d0a0e 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/label/ApiPartialPatientLabel.scala @@ -17,7 +17,6 @@ final case class ApiPartialPatientLabel(primaryValue: Option[String], verifiedPr verifiedPrimaryValue.cata(x => Some(FuzzyValue.fromString(x)), None, orig.verifiedPrimaryValue) ) } - } object ApiPartialPatientLabel { @@ -42,5 +41,4 @@ object ApiPartialPatientLabel { Writes.of[String] )) )(ApiPartialPatientLabel.apply, unlift(ApiPartialPatientLabel.unapply)) - } diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala index 3e2de99..7ac55f6 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/trial/ApiPatientCriterion.scala @@ -11,6 +11,7 @@ import play.api.libs.json.{Format, JsPath, Reads, Writes} final case class ApiPatientCriterion(id: Long, labelId: Long, nctId: String, + criterionId: Long, criterionText: String, criterionValue: Option[String], criterionIsDefining: Boolean, @@ -28,6 +29,7 @@ object ApiPatientCriterion { (JsPath \ "id").format[Long] and (JsPath \ "labelId").format[Long] and (JsPath \ "nctId").format[String] and + (JsPath \ "criterionId").format[Long] and (JsPath \ "criterionText").format[String] and (JsPath \ "criterionValue").formatNullable[String](Format(Reads.of[String].filter(ValidationError("unknown value"))({ x => x == "Yes" || x == "No" @@ -56,6 +58,7 @@ object ApiPatientCriterion { id = patientCriterion.id.id, labelId = labelId.id, nctId = patientCriterion.nctId.id, + criterionId = patientCriterion.criterionId.id, criterionText = patientCriterion.criterionText, criterionValue = patientCriterion.criterionValue.map { x => FuzzyValue.valueToString(FuzzyValue.fromBoolean(x)) -- cgit v1.2.3