diff options
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible')
2 files changed, 0 insertions, 69 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPartialPatientEligibleTrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPartialPatientEligibleTrial.scala deleted file mode 100644 index 03ff275..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPartialPatientEligibleTrial.scala +++ /dev/null @@ -1,18 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.patient.eligible - -import xyz.driver.pdsuidomain.entities.PatientTrialArmGroupView -import play.api.libs.json.{Format, Json} - -final case class ApiPartialPatientEligibleTrial(isVerified: Option[Boolean]) { - - def applyTo(orig: PatientTrialArmGroupView): PatientTrialArmGroupView = { - orig.copy( - isVerified = isVerified.getOrElse(orig.isVerified) - ) - } -} - -object ApiPartialPatientEligibleTrial { - - implicit val format: Format[ApiPartialPatientEligibleTrial] = Json.format -} 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 deleted file mode 100644 index 55c8149..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patient/eligible/ApiPatientEligibleTrial.scala +++ /dev/null @@ -1,51 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.patient.eligible - -import java.util.UUID - -import play.api.data.validation.ValidationError -import play.api.libs.functional.syntax._ -import play.api.libs.json._ -import xyz.driver.entities.labels.LabelValue -import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial - -final case class ApiPatientEligibleTrial(id: Long, - patientId: String, - trialId: String, - trialTitle: String, - arms: List[String], - hypothesisId: UUID, - verifiedEligibilityStatus: Option[String], - isVerified: Boolean) - -object ApiPatientEligibleTrial { - - implicit val apiEligibleTrialJsonFormat: Format[ApiPatientEligibleTrial] = ( - (JsPath \ "id").format[Long] and - (JsPath \ "patientId").format[String] and - (JsPath \ "trialId").format[String] and - (JsPath \ "trialTitle").format[String] and - (JsPath \ "arms").format[List[String]] and - (JsPath \ "hypothesisId").format[UUID] and - (JsPath \ "verifiedEligibilityStatus").formatNullable[String](Format( - Reads - .of[String] - .filter(ValidationError("unknown eligibility status"))({ - case x if LabelValue.fromString(x).isDefined => true - case _ => false - }), - Writes.of[String] - )) and - (JsPath \ "isVerified").format[Boolean] - )(ApiPatientEligibleTrial.apply, unlift(ApiPatientEligibleTrial.unapply)) - - def fromDomain(eligibleTrialWithTrial: RichPatientEligibleTrial) = ApiPatientEligibleTrial( - id = eligibleTrialWithTrial.group.id.id, - patientId = eligibleTrialWithTrial.group.patientId.toString, - trialId = eligibleTrialWithTrial.group.trialId.id, - trialTitle = eligibleTrialWithTrial.trial.title, - arms = eligibleTrialWithTrial.arms.map(_.armName), - hypothesisId = eligibleTrialWithTrial.group.hypothesisId.id, - eligibleTrialWithTrial.group.verifiedEligibilityStatus.map(_.toString), - eligibleTrialWithTrial.group.isVerified - ) -} |