From eeeb6d90f1c6882f0b3d765022b114d97e4dba40 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 9 Oct 2017 12:49:02 -0700 Subject: Getting rid of the FuzzyValues, Name as a string, and condition --- .../pdsuidomain/formats/json/trial/ApiTrial.scala | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/trial') diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala index 1b4ac64..a2a1ca9 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/trial/ApiTrial.scala @@ -2,11 +2,12 @@ package xyz.driver.pdsuidomain.formats.json.trial import java.time.{ZoneId, ZonedDateTime} import java.util.UUID -import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} +import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} import xyz.driver.pdsuidomain.entities.Trial import play.api.libs.functional.syntax._ import play.api.libs.json._ +import xyz.driver.entities.patient.CancerType final case class ApiTrial(id: String, externalId: UUID, @@ -16,7 +17,7 @@ final case class ApiTrial(id: String, previousStatus: Option[String], previousAssignee: Option[String], lastActiveUser: Option[String], - condition: String, + disease: String, phase: String, hypothesisId: Option[UUID], studyDesignId: Option[Long], @@ -37,11 +38,9 @@ final case class ApiTrial(id: String, previousAssignee = this.previousAssignee.map(id => StringId(id)), lastActiveUserId = this.lastActiveUser.map(id => StringId(id)), lastUpdate = this.lastUpdate.toLocalDateTime, - condition = Trial.Condition - .fromString(this.condition) - .getOrElse( - throw new NoSuchElementException(s"unknown condition ${this.condition}") - ), + disease = CancerType + .fromString(this.disease) + .getOrElse(throw new NoSuchElementException(s"Unknown disease ${this.disease}")), phase = this.phase, hypothesisId = this.hypothesisId.map(id => UuidId(id)), studyDesignId = this.studyDesignId.map(id => LongId(id)), @@ -67,7 +66,7 @@ object ApiTrial { (JsPath \ "previousStatus").formatNullable[String] and (JsPath \ "previousAssignee").formatNullable[String] and (JsPath \ "lastActiveUser").formatNullable[String] and - (JsPath \ "condition").format[String] and + (JsPath \ "disease").format[String] and (JsPath \ "phase").format[String] and (JsPath \ "hypothesisId").formatNullable[UUID] and (JsPath \ "studyDesignId").formatNullable[Long] and @@ -89,7 +88,7 @@ object ApiTrial { previousAssignee = trial.previousAssignee.map(_.id), lastActiveUser = trial.lastActiveUserId.map(_.id), lastUpdate = ZonedDateTime.of(trial.lastUpdate, ZoneId.of("Z")), - condition = trial.condition.toString, + disease = trial.disease.toString, phase = trial.phase, hypothesisId = trial.hypothesisId.map(_.id), studyDesignId = trial.studyDesignId.map(_.id), -- cgit v1.2.3