From 7d8712a62d30b412717e1b730c0ad267cd207aa4 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 9 Oct 2017 12:24:59 -0700 Subject: Getting rid of the FuzzyValues, Name as a string, and condition --- .../entities/export/patient/ExportPatientLabel.scala | 5 ----- .../export/patient/ExportPatientLabelEvidence.scala | 19 ++++--------------- .../patient/ExportPatientLabelEvidenceDocument.scala | 8 -------- .../export/patient/ExportPatientWithLabels.scala | 12 +----------- 4 files changed, 5 insertions(+), 39 deletions(-) (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities/export/patient') diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala index 2edd707..957e607 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala @@ -3,7 +3,6 @@ package xyz.driver.pdsuidomain.entities.export.patient import xyz.driver.entities.labels.Label import xyz.driver.pdsuicommon.domain.LongId import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuidomain.entities.RawPatientLabel final case class ExportPatientLabel(id: LongId[Label], evidences: List[ExportPatientLabelEvidence]) @@ -13,8 +12,4 @@ object ExportPatientLabel extends PhiLogging { import x._ phi"ExportPatientLabel(id=$id, evidences=$evidences)" } - - def fromRaw(labelId: LongId[Label], rawPatientLabels: List[RawPatientLabel]): ExportPatientLabel = { - ExportPatientLabel(id = labelId, evidences = rawPatientLabels.map(ExportPatientLabelEvidence.fromRaw)) - } } diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala index fb40339..6472a6b 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala @@ -1,11 +1,12 @@ package xyz.driver.pdsuidomain.entities.export.patient +import xyz.driver.entities.labels.LabelValue import xyz.driver.pdsuicommon.domain._ import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuidomain.entities.{ExtractedData, RawPatientLabel} +import xyz.driver.pdsuidomain.entities.ExtractedData final case class ExportPatientLabelEvidence(id: LongId[ExtractedData], - value: FuzzyValue, + value: LabelValue, evidenceText: String, document: ExportPatientLabelEvidenceDocument) @@ -13,20 +14,8 @@ object ExportPatientLabelEvidence { implicit def toPhiString(x: ExportPatientLabelEvidence): PhiString = { import x._ - phi"ExportPatientLabelEvidence(id=${Unsafe(id)}, value=$value, " + + phi"ExportPatientLabelEvidence(id=${Unsafe(id)}, value=${Unsafe(value)}, " + phi"evidenceText=${Unsafe(evidenceText)}, document=$document)" } - def fromRaw(x: RawPatientLabel) = ExportPatientLabelEvidence( - id = x.evidenceId, - value = x.value, - evidenceText = x.evidenceText, - document = ExportPatientLabelEvidenceDocument( - x.documentId, - x.requestId, - x.documentType, - x.providerType, - x.startDate - ) - ) } diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala index 7003615..467170b 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala @@ -19,12 +19,4 @@ object ExportPatientLabelEvidenceDocument extends PhiLogging { phi"ExportPatientLabelEvidenceDocument(documentId=$documentId, requestId=$requestId, " + phi"documentType=${Unsafe(documentType)}, providerType=${Unsafe(providerType)}, date=$date)" } - - def fromRaw(x: RawPatientLabel) = ExportPatientLabelEvidenceDocument( - documentId = x.documentId, - requestId = x.requestId, - documentType = x.documentType, - providerType = x.providerType, - date = x.startDate - ) } diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala index bd6173b..8fb2660 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala @@ -2,9 +2,7 @@ package xyz.driver.pdsuidomain.entities.export.patient import xyz.driver.pdsuicommon.domain._ import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuidomain.entities.{Patient, RawPatientLabel} - -import scala.collection.breakOut +import xyz.driver.pdsuidomain.entities.Patient final case class ExportPatientWithLabels(patientId: UuidId[Patient], labelVersion: Long, @@ -16,12 +14,4 @@ object ExportPatientWithLabels { import x._ phi"ExportPatientWithLabels(patientId=$patientId, version=${Unsafe(labelVersion)}, labels=$labels)" } - - def fromRaw(patientId: UuidId[Patient], rawPatientRefs: List[RawPatientLabel]) = ExportPatientWithLabels( - patientId = patientId, - labelVersion = 1L, // TODO It is needed to replace this mock label version. - labels = rawPatientRefs - .groupBy(_.labelId) - .map(Function.tupled(ExportPatientLabel.fromRaw))(breakOut) - ) } -- cgit v1.2.3