aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala5
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala3
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Keyword.scala3
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Label.scala31
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/eligibility.scala63
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala3
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala3
11 files changed, 78 insertions, 37 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala
index 0dfb33f..7f065d4 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala
@@ -1,5 +1,6 @@
package xyz.driver.pdsuidomain.entities
+import xyz.driver.entities.labels.{Label, LabelCategory}
import xyz.driver.pdsuicommon.domain.{LongId, StringId}
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.entities.Criterion.Meta.Evidence
@@ -10,7 +11,7 @@ final case class Criterion(id: LongId[Criterion],
isCompound: Boolean,
meta: String) {
- def isValid(): Boolean = text.nonEmpty && Option(meta).isDefined
+ def isValid: Boolean = text.nonEmpty && Option(meta).isDefined
}
object Criterion {
@@ -41,7 +42,7 @@ object CriterionArm {
final case class CriterionLabel(id: LongId[CriterionLabel],
labelId: Option[LongId[Label]],
criterionId: LongId[Criterion],
- categoryId: Option[LongId[Category]],
+ categoryId: Option[LongId[LabelCategory]],
value: Option[Boolean],
isDefining: Boolean)
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala
index 32258dc..fbd468f 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala
@@ -1,5 +1,6 @@
package xyz.driver.pdsuidomain.entities
+import xyz.driver.entities.labels.{Label, LabelCategory}
import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, TextJson}
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.entities.ExtractedData.Meta
@@ -43,5 +44,5 @@ object ExtractedDataLabel {
final case class ExtractedDataLabel(id: LongId[ExtractedDataLabel],
dataId: LongId[ExtractedData],
labelId: Option[LongId[Label]],
- categoryId: Option[LongId[Category]],
+ categoryId: Option[LongId[LabelCategory]],
value: Option[FuzzyValue])
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Keyword.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Keyword.scala
index 3683efc..a984f92 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Keyword.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Keyword.scala
@@ -1,5 +1,6 @@
package xyz.driver.pdsuidomain.entities
+import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuicommon.logging._
@@ -17,7 +18,7 @@ final case class KeywordWithLabels(keyword: Keyword, labels: List[Label])
object KeywordWithLabels {
implicit def toPhiString(x: KeywordWithLabels): PhiString = {
import x._
- phi"KeywordWithLabels(keyword=$keyword, $labels)"
+ phi"KeywordWithLabels(keyword=$keyword, ${Unsafe(labels)}"
}
}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Label.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Label.scala
deleted file mode 100644
index eea39de..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Label.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-package xyz.driver.pdsuidomain.entities
-
-import xyz.driver.pdsuicommon.domain.LongId
-import xyz.driver.pdsuicommon.logging._
-
-final case class Category(id: LongId[Category], name: String)
-
-object Category {
- implicit def toPhiString(x: Category): PhiString = {
- import x._
- phi"Category(id=$id, name=${Unsafe(name)})"
- }
-}
-
-final case class Label(id: LongId[Label], categoryId: LongId[Category], name: String, description: String)
-
-object Label {
- implicit def toPhiString(x: Label): PhiString = {
- import x._
- phi"Label($id, categoryId=${Unsafe(categoryId)}, name=${Unsafe(name)}, description=${Unsafe(description)})"
- }
-}
-
-final case class CategoryWithLabels(category: Category, labels: List[Label])
-
-object CategoryWithLabels {
- implicit def toPhiString(x: CategoryWithLabels): PhiString = {
- import x._
- phi"CategoryWithLabels(category=$category, labels=$labels)"
- }
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala
index 633a347..d10c7d2 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala
@@ -1,5 +1,6 @@
package xyz.driver.pdsuidomain.entities
+import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, UuidId}
import xyz.driver.pdsuicommon.logging._
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
index 34e3741..3311d96 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala
@@ -2,6 +2,7 @@ package xyz.driver.pdsuidomain.entities
import java.time.LocalDate
+import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala
index 184782b..689eaa4 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientLabel.scala
@@ -2,6 +2,7 @@ package xyz.driver.pdsuidomain.entities
import java.time.LocalDate
+import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, UuidId}
import xyz.driver.pdsuicommon.logging._
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala
index 9e69c87..bdbc4ea 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala
@@ -2,6 +2,7 @@ package xyz.driver.pdsuidomain.entities
import java.time.LocalDateTime
+import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuicommon.logging._
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/eligibility.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/eligibility.scala
new file mode 100644
index 0000000..aa7a7d2
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/eligibility.scala
@@ -0,0 +1,63 @@
+package xyz.driver.pdsuidomain.entities
+
+import xyz.driver.core.Id
+import xyz.driver.core.date.Date
+import xyz.driver.entities.assays.AssayType
+import xyz.driver.entities.clinic.{ClinicalRecord, TestOrder}
+import xyz.driver.entities.common.FullName
+import xyz.driver.entities.labels.{Label, LabelValue}
+import xyz.driver.entities.patient.CancerType
+import xyz.driver.entities.process.ProcessStepExecutionStatus
+import xyz.driver.entities.report.Report
+import xyz.driver.pdsuidomain.entities.export.trial.ExportTrialWithLabels
+
+object eligibility {
+
+ sealed trait EvidenceDocument {
+ val documentType: DocumentType
+ val providerType: ProviderType
+ val providerName: Option[String]
+ val date: Option[Date]
+ val isDriverDocument: Boolean
+ }
+
+ final case class MolecularEvidenceDocument(documentType: DocumentType,
+ providerType: ProviderType,
+ providerName: Option[String],
+ date: Option[Date],
+ reportId: Id[Report],
+ reportType: AssayType,
+ isDriverDocument: Boolean = true)
+ extends EvidenceDocument
+
+ final case class ClinicalEvidenceDocument(documentId: Id[ClinicalEvidenceDocument],
+ documentType: DocumentType,
+ providerType: ProviderType,
+ providerName: Option[String],
+ date: Option[Date],
+ requestId: Id[ClinicalRecord],
+ isDriverDocument: Boolean = false)
+ extends EvidenceDocument
+
+ // Some fields are optional because they are not in the backend response
+ final case class Evidence(evidenceId: Option[Id[Evidence]],
+ evidenceText: String,
+ labelValue: LabelValue,
+ document: EvidenceDocument,
+ isPrimaryValue: Option[Boolean] = None)
+
+ final case class LabelWithEvidence(label: Label, evidence: Seq[Evidence] = Seq.empty)
+
+ final case class LabelMismatchRank(label: Label,
+ score: Int,
+ trials: Seq[ExportTrialWithLabels],
+ evidence: Seq[Evidence])
+ final case class MismatchRankedLabels(data: Seq[LabelMismatchRank], labelVersion: Int)
+
+ final case class MatchedPatient(patientId: Id[MatchedPatient],
+ name: FullName[MatchedPatient],
+ birthDate: Date,
+ orderId: Id[TestOrder],
+ disease: CancerType,
+ patientDataStatus: ProcessStepExecutionStatus)
+}
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 c69fc09..2edd707 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
@@ -1,8 +1,9 @@
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.{Label, RawPatientLabel}
+import xyz.driver.pdsuidomain.entities.RawPatientLabel
final case class ExportPatientLabel(id: LongId[Label], evidences: List[ExportPatientLabelEvidence])
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
index 7bff22c..1f06e0d 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala
@@ -1,8 +1,9 @@
package xyz.driver.pdsuidomain.entities.export.trial
+import xyz.driver.entities.labels.Label
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{Arm, Criterion, Label, RawTrialLabel}
+import xyz.driver.pdsuidomain.entities.{Arm, Criterion, RawTrialLabel}
final case class ExportTrialLabelCriterion(criterionId: LongId[Criterion],
value: Option[Boolean],