From deba20326e3269fee3ef51f8e6841f17453b4155 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 28 Sep 2017 13:12:32 -0700 Subject: Simplified Export entities for EVLS --- .../export/ApiExportPatientLabelEvidence.scala | 38 ---------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala') diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala deleted file mode 100644 index d141762..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala +++ /dev/null @@ -1,38 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.export - -import play.api.libs.functional.syntax._ -import play.api.libs.json._ -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId} -import xyz.driver.pdsuidomain.entities.export.patient.ExportPatientLabelEvidence - -final case class ApiExportPatientLabelEvidence(evidenceId: String, - labelValue: String, - evidenceText: String, - document: ApiExportPatientLabelEvidenceDocument) { - - def toDomain = ExportPatientLabelEvidence( - id = LongId(this.evidenceId.toLong), - value = FuzzyValue.fromString - .applyOrElse(this.labelValue, (s: String) => throw new NoSuchElementException(s"Unknown fuzzy value $s")), - evidenceText = this.evidenceText, - document = this.document.toDomain - ) - -} - -object ApiExportPatientLabelEvidence { - - implicit val format: Format[ApiExportPatientLabelEvidence] = ( - (JsPath \ "evidenceId").format[String] and - (JsPath \ "labelValue").format[String](Writes[String](x => JsString(x.toUpperCase))) and - (JsPath \ "evidenceText").format[String] and - (JsPath \ "document").format[ApiExportPatientLabelEvidenceDocument] - )(ApiExportPatientLabelEvidence.apply, unlift(ApiExportPatientLabelEvidence.unapply)) - - def fromDomain(evidence: ExportPatientLabelEvidence) = ApiExportPatientLabelEvidence( - evidenceId = evidence.id.toString, - labelValue = FuzzyValue.valueToString(evidence.value), - evidenceText = evidence.evidenceText, - document = ApiExportPatientLabelEvidenceDocument.fromDomain(evidence.document) - ) -} -- cgit v1.2.3