aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities/export
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities/export')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala19
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala32
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala30
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala27
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialArm.scala15
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala32
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala57
7 files changed, 0 insertions, 212 deletions
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
deleted file mode 100644
index c69fc09..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-package xyz.driver.pdsuidomain.entities.export.patient
-
-import xyz.driver.pdsuicommon.domain.LongId
-import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{Label, RawPatientLabel}
-
-final case class ExportPatientLabel(id: LongId[Label], evidences: List[ExportPatientLabelEvidence])
-
-object ExportPatientLabel extends PhiLogging {
-
- implicit def toPhiString(x: ExportPatientLabel): PhiString = {
- 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
deleted file mode 100644
index fb40339..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package xyz.driver.pdsuidomain.entities.export.patient
-
-import xyz.driver.pdsuicommon.domain._
-import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{ExtractedData, RawPatientLabel}
-
-final case class ExportPatientLabelEvidence(id: LongId[ExtractedData],
- value: FuzzyValue,
- evidenceText: String,
- document: ExportPatientLabelEvidenceDocument)
-
-object ExportPatientLabelEvidence {
-
- implicit def toPhiString(x: ExportPatientLabelEvidence): PhiString = {
- import x._
- phi"ExportPatientLabelEvidence(id=${Unsafe(id)}, value=$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
deleted file mode 100644
index 99912bc..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-package xyz.driver.pdsuidomain.entities.export.patient
-
-import java.time.LocalDate
-
-import xyz.driver.pdsuicommon.domain._
-import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{Document, RawPatientLabel, RecordRequestId}
-
-final case class ExportPatientLabelEvidenceDocument(documentId: LongId[Document],
- requestId: RecordRequestId,
- documentType: String,
- providerType: String,
- date: LocalDate)
-
-object ExportPatientLabelEvidenceDocument extends PhiLogging {
-
- implicit def toPhiString(x: ExportPatientLabelEvidenceDocument): PhiString = {
- import x._
- 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
deleted file mode 100644
index bd6173b..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-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
-
-final case class ExportPatientWithLabels(patientId: UuidId[Patient],
- labelVersion: Long,
- labels: List[ExportPatientLabel])
-
-object ExportPatientWithLabels {
-
- implicit def toPhiString(x: ExportPatientWithLabels): PhiString = {
- 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)
- )
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialArm.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialArm.scala
deleted file mode 100644
index 5a9a406..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialArm.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-package xyz.driver.pdsuidomain.entities.export.trial
-
-import xyz.driver.pdsuicommon.domain._
-import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.Arm
-
-final case class ExportTrialArm(armId: LongId[Arm], armName: String)
-
-object ExportTrialArm {
-
- implicit def toPhiString(x: ExportTrialArm): PhiString = {
- import x._
- phi"ExportTrialArm(armId=$armId, armName=${Unsafe(armName)})"
- }
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala
deleted file mode 100644
index 7bff22c..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package xyz.driver.pdsuidomain.entities.export.trial
-
-import xyz.driver.pdsuicommon.domain._
-import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{Arm, Criterion, Label, RawTrialLabel}
-
-final case class ExportTrialLabelCriterion(criterionId: LongId[Criterion],
- value: Option[Boolean],
- labelId: LongId[Label],
- armIds: Set[LongId[Arm]],
- criteria: String,
- isCompound: Boolean,
- isDefining: Boolean)
-
-object ExportTrialLabelCriterion {
-
- implicit def toPhiString(x: ExportTrialLabelCriterion): PhiString = {
- import x._
- phi"TrialLabelCriterion(criterionId=$criterionId, value=$value, labelId=$labelId, " +
- phi"criteria=${Unsafe(criteria)}, isCompound=$isCompound, isDefining=$isDefining)"
- }
-
- def fromRaw(x: RawTrialLabel, armIds: Set[LongId[Arm]]) = ExportTrialLabelCriterion(
- criterionId = x.criterionId,
- value = x.value,
- labelId = x.labelId,
- armIds = armIds,
- criteria = x.criteria,
- isCompound = x.isCompound,
- isDefining = x.isDefining
- )
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala
deleted file mode 100644
index 60b74ff..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-package xyz.driver.pdsuidomain.entities.export.trial
-
-import java.time.LocalDateTime
-
-import xyz.driver.pdsuicommon.domain._
-import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{RawTrialLabel, Trial}
-
-import scala.collection.breakOut
-
-final case class ExportTrialWithLabels(nctId: StringId[Trial],
- trialId: UuidId[Trial],
- condition: String,
- lastReviewed: LocalDateTime,
- labelVersion: Long,
- arms: List[ExportTrialArm],
- criteria: List[ExportTrialLabelCriterion])
-
-object ExportTrialWithLabels {
-
- implicit def toPhiString(x: ExportTrialWithLabels): PhiString = {
- import x._
- phi"TrialWithLabels(nctId=$nctId, trialId=$trialId, condition=${Unsafe(condition)}, " +
- phi"lastReviewed=$lastReviewed, labelVersion=${Unsafe(labelVersion)}, arms=$arms, criteria=$criteria)"
- }
-
- def fromRaw(rawData: List[RawTrialLabel]): ExportTrialWithLabels = {
- val trials: Set[StringId[Trial]] = rawData.map(_.nctId)(breakOut)
-
- assert(trials.size == 1, "There are more than one trials in the rawData")
- val trial = rawData.head
-
- ExportTrialWithLabels(
- nctId = trial.nctId,
- trialId = trial.trialId,
- condition = trial.condition,
- lastReviewed = trial.lastReviewed,
- labelVersion = 1, // TODO It is needed to replace this mock label version.
- arms = rawData
- .groupBy(_.armId)
- .map {
- case (armId, rawTrials) =>
- ExportTrialArm(armId, rawTrials.head.armName)
- }(breakOut),
- criteria = rawData
- .groupBy { x =>
- (x.criterionId, x.labelId)
- }
- .map {
- case (_, rawTrialLabels) =>
- val armIds = rawTrialLabels.map(_.criterionArmId).toSet
- ExportTrialLabelCriterion.fromRaw(rawTrialLabels.head, armIds)
- }(breakOut)
- )
- }
-
-}