aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities
diff options
context:
space:
mode:
authorMarvin Bertin <marvin.bertin@gmail.com>2017-10-03 13:09:49 -0700
committerMarvin Bertin <marvin.bertin@gmail.com>2017-10-03 13:09:49 -0700
commit98d6f3d136a16310300e23b12e6b730ac7ade6b6 (patch)
tree34ef97bc59f3c34d20a18cd65107655d319097fc /src/main/scala/xyz/driver/pdsuidomain/entities
parent1d0202a3964637ffb93180a1c89617633ab5ab18 (diff)
parent0653b90dddc294fddb0e81059aef00b202113d78 (diff)
downloadrest-query-98d6f3d136a16310300e23b12e6b730ac7ade6b6.tar.gz
rest-query-98d6f3d136a16310300e23b12e6b730ac7ade6b6.tar.bz2
rest-query-98d6f3d136a16310300e23b12e6b730ac7ade6b6.zip
Merge branch 'add-slot-eligibility-arms' into trial-46-disease-entity
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala8
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala364
-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.scala5
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/RawTrialLabel.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala15
-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/patient/ExportPatientLabelEvidenceDocument.scala6
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala3
14 files changed, 368 insertions, 139 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala
index afb86b3..26ced22 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
@@ -8,9 +9,10 @@ final case class Criterion(id: LongId[Criterion],
trialId: StringId[Trial],
text: Option[String],
isCompound: Boolean,
- meta: String) {
+ meta: String,
+ inclusion: Option[Boolean]) {
- def isValid(): Boolean = text.nonEmpty && Option(meta).isDefined
+ def isValid: Boolean = text.nonEmpty && Option(meta).isDefined
}
object Criterion {
@@ -41,7 +43,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/Document.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
index 839fead..eccb254 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
@@ -15,74 +15,195 @@ import xyz.driver.pdsuicommon.validation.Validators.Validator
import xyz.driver.pdsuidomain.entities.Document.Meta
import scalaz.Equal
+import scalaz.syntax.equal._
+import scalaz.Scalaz.stringInstance
-final case class ProviderType(id: LongId[ProviderType], name: String)
+sealed trait ProviderType {
+ val id: LongId[ProviderType]
+ val name: String
+}
object ProviderType {
- sealed trait ProviderTypeName
- case object MedicalOncology extends ProviderTypeName
- case object Surgery extends ProviderTypeName
- case object Pathology extends ProviderTypeName
- case object MolecularPathology extends ProviderTypeName
- case object LaboratoryMedicine extends ProviderTypeName
- case object Radiology extends ProviderTypeName
- case object InterventionalRadiology extends ProviderTypeName
- case object RadiationOncology extends ProviderTypeName
- case object PrimaryCare extends ProviderTypeName
- case object Cardiology extends ProviderTypeName
- case object Dermatology extends ProviderTypeName
- case object Ophthalmology extends ProviderTypeName
- case object Gastroenterology extends ProviderTypeName
- case object Neurology extends ProviderTypeName
- case object Psychiatry extends ProviderTypeName
- case object Gynecology extends ProviderTypeName
- case object InfectiousDisease extends ProviderTypeName
- case object Immunology extends ProviderTypeName
- case object Nephrology extends ProviderTypeName
- case object Rheumatology extends ProviderTypeName
- case object Cytology extends ProviderTypeName
- case object Otolaryngology extends ProviderTypeName
- case object Anesthesiology extends ProviderTypeName
- case object Urology extends ProviderTypeName
- case object PalliativeCare extends ProviderTypeName
- case object EmergencyMedicine extends ProviderTypeName
- case object SocialWork extends ProviderTypeName
- case object NA extends ProviderTypeName
- case object Other extends ProviderTypeName
-
- def fromString(txt: String): Option[ProviderTypeName] = {
- txt match {
- case "Medical Oncology" => Some(MedicalOncology)
- case "Surgery" => Some(Surgery)
- case "Pathology" => Some(Pathology)
- case "Molecular Pathology" => Some(MolecularPathology)
- case "LaboratoryMedicine" => Some(LaboratoryMedicine)
- case "Radiology" => Some(Radiology)
- case "Interventional Radiology" => Some(InterventionalRadiology)
- case "Radiation Oncology" => Some(RadiationOncology)
- case "Primary Care" => Some(PrimaryCare)
- case "Cardiology" => Some(Cardiology)
- case "Dermatology" => Some(Dermatology)
- case "Ophthalmology" => Some(Ophthalmology)
- case "Gastroenterology" => Some(Gastroenterology)
- case "Neurology" => Some(Neurology)
- case "Psychiatry" => Some(Psychiatry)
- case "Gynecology" => Some(Gynecology)
- case "Infectious Disease" => Some(InfectiousDisease)
- case "Immunology" => Some(Immunology)
- case "Nephrology" => Some(Nephrology)
- case "Rheumatology" => Some(Rheumatology)
- case "Cytology" => Some(Cytology)
- case "Otolaryngology" => Some(Otolaryngology)
- case "Anesthesiology" => Some(Anesthesiology)
- case "Urology" => Some(Urology)
- case "Palliative Care" => Some(PalliativeCare)
- case "Emergency Medicine" => Some(EmergencyMedicine)
- case "Social Work" => Some(SocialWork)
- case "N/A" => Some(NA)
- case "Other" => Some(Other)
- case _ => None
- }
+
+ case object MedicalOncology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](1)
+ val name: String = "Medical Oncology"
+ }
+
+ case object Surgery extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](2)
+ val name: String = "Surgery"
+ }
+
+ case object Pathology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](3)
+ val name: String = "Pathology"
+ }
+
+ case object MolecularPathology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](4)
+ val name: String = "Molecular Pathology"
+ }
+
+ case object LaboratoryMedicine extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](5)
+ val name: String = "Laboratory Medicine"
+ }
+
+ case object Radiology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](6)
+ val name: String = "Radiology"
+ }
+
+ case object InterventionalRadiology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](7)
+ val name: String = "Interventional Radiology"
+ }
+
+ case object RadiationOncology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](8)
+ val name: String = "Radiation Oncology"
+ }
+
+ case object PrimaryCare extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](9)
+ val name: String = "Primary Care"
+ }
+
+ case object Cardiology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](10)
+ val name: String = "Cardiology"
+ }
+
+ case object Dermatology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](11)
+ val name: String = "Dermatology"
+ }
+
+ case object Ophthalmology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](12)
+ val name: String = "Ophthalmology"
+ }
+
+ case object Gastroenterology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](13)
+ val name: String = "Gastroenterology"
+ }
+
+ case object Neurology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](14)
+ val name: String = "Neurology"
+ }
+
+ case object Psychiatry extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](15)
+ val name: String = "Psychiatry"
+ }
+
+ case object Gynecology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](16)
+ val name: String = "Gynecology"
+ }
+
+ case object InfectiousDisease extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](17)
+ val name: String = "Infectious Disease"
+ }
+
+ case object Immunology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](18)
+ val name: String = "Immunology"
+ }
+
+ case object Nephrology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](19)
+ val name: String = "Nephrology"
+ }
+
+ case object Rheumatology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](20)
+ val name: String = "Rheumatology"
+ }
+
+ case object Cytology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](21)
+ val name: String = "Cytology"
+ }
+
+ case object Otolaryngology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](22)
+ val name: String = "Otolaryngology"
+ }
+
+ case object Anesthesiology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](23)
+ val name: String = "Anesthesiology"
+ }
+
+ case object Urology extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](24)
+ val name: String = "Urology"
+ }
+
+ case object PalliativeCare extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](25)
+ val name: String = "Palliative Care"
+ }
+
+ case object EmergencyMedicine extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](26)
+ val name: String = "Emergency Medicine"
+ }
+
+ case object SocialWork extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](27)
+ val name: String = "Social Work"
+ }
+
+ case object NA extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](28)
+ val name: String = "N/A"
+ }
+
+ case object Other extends ProviderType {
+ val id: LongId[ProviderType] = LongId[ProviderType](29)
+ val name: String = "Other"
+ }
+
+ val All = Seq[ProviderType](
+ MedicalOncology,
+ Surgery,
+ Pathology,
+ MolecularPathology,
+ LaboratoryMedicine,
+ Radiology,
+ InterventionalRadiology,
+ RadiationOncology,
+ PrimaryCare,
+ Cardiology,
+ Dermatology,
+ Ophthalmology,
+ Gastroenterology,
+ Neurology,
+ Psychiatry,
+ Gynecology,
+ InfectiousDisease,
+ Immunology,
+ Nephrology,
+ Rheumatology,
+ Cytology,
+ Otolaryngology,
+ Anesthesiology,
+ Urology,
+ PalliativeCare,
+ EmergencyMedicine,
+ SocialWork,
+ NA,
+ Other
+ )
+
+ def fromString(txt: String): Option[ProviderType] = {
+ All.find(_.name === txt)
}
implicit def toPhiString(x: ProviderType): PhiString = {
@@ -91,39 +212,90 @@ object ProviderType {
}
}
-final case class DocumentType(id: LongId[DocumentType], name: String)
+sealed trait DocumentType {
+ val id: LongId[DocumentType]
+ val name: String
+}
object DocumentType {
- sealed trait DocumentTypeName
- case object OutpatientPhysicianNote extends DocumentTypeName
- case object DischargeNote extends DocumentTypeName
- case object LaboratoryReport extends DocumentTypeName
- case object MedicationList extends DocumentTypeName
- case object HospitalizationNote extends DocumentTypeName
- case object PathologyReport extends DocumentTypeName
- case object RadiologyReport extends DocumentTypeName
- case object OperativeProcedureReport extends DocumentTypeName
- case object MedicationAdministration extends DocumentTypeName
- case object SocialWorkCaseManagementNote extends DocumentTypeName
- case object NonPhysicianProviderNote extends DocumentTypeName
- case object Administrative extends DocumentTypeName
-
- def fromString(txt: String): Option[DocumentTypeName] = {
- txt match {
- case "Outpatient Physician Note" => Some(OutpatientPhysicianNote)
- case "Discharge Note" => Some(DischargeNote)
- case "Laboratory Report" => Some(LaboratoryReport)
- case "Medication List" => Some(MedicationList)
- case "Hospitalization Note" => Some(HospitalizationNote)
- case "Pathology Report" => Some(PathologyReport)
- case "Radiology Report" => Some(RadiologyReport)
- case "Operative/Procedure Report" => Some(OperativeProcedureReport)
- case "Medication Administration" => Some(MedicationAdministration)
- case "Social Work/Case Management Note" => Some(SocialWorkCaseManagementNote)
- case "Non-physician Provider Note" => Some(NonPhysicianProviderNote)
- case "Administrative" => Some(Administrative)
- case _ => None
- }
+
+ case object OutpatientPhysicianNote extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](1)
+ val name: String = "Outpatient Physician Note"
+ }
+
+ case object DischargeNote extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](2)
+ val name: String = "Discharge Note"
+ }
+
+ case object LaboratoryReport extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](3)
+ val name: String = "Laboratory Report"
+ }
+
+ case object MedicationList extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](4)
+ val name: String = "Medication List"
+ }
+
+ case object HospitalizationNote extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](5)
+ val name: String = "Hospitalization Note"
+ }
+
+ case object PathologyReport extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](6)
+ val name: String = "Pathology Report"
+ }
+
+ case object RadiologyReport extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](7)
+ val name: String = "Radiology Report"
+ }
+
+ case object OperativeProcedureReport extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](8)
+ val name: String = "Operative/Procedure Report"
+ }
+
+ case object MedicationAdministration extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](9)
+ val name: String = "Medication Administration"
+ }
+
+ case object SocialWorkCaseManagementNote extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](10)
+ val name: String = "Social Work/Case Management Note"
+ }
+
+ case object NonPhysicianProviderNote extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](11)
+ val name: String = "Non-physician Provider Note"
+ }
+
+ case object Administrative extends DocumentType {
+ val id: LongId[DocumentType] = LongId[DocumentType](12)
+ val name: String = "Administrative"
+ }
+
+ val All = Seq[DocumentType](
+ OutpatientPhysicianNote,
+ DischargeNote,
+ LaboratoryReport,
+ MedicationList,
+ HospitalizationNote,
+ PathologyReport,
+ RadiologyReport,
+ OperativeProcedureReport,
+ MedicationAdministration,
+ SocialWorkCaseManagementNote,
+ NonPhysicianProviderNote,
+ Administrative
+ )
+
+ def fromString(txt: String): Option[DocumentType] = {
+ All.find(_.name === txt)
}
implicit def equal: Equal[DocumentType] = Equal.equal[DocumentType](_ == _)
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 6114661..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._
@@ -13,8 +14,8 @@ final case class RawPatientLabel(patientId: UuidId[Patient],
disease: String,
documentId: LongId[Document],
requestId: RecordRequestId,
- documentType: String,
- providerType: String,
+ documentType: DocumentType,
+ providerType: ProviderType,
startDate: LocalDate,
endDate: Option[LocalDate])
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/SlotArmEligibilityArm.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala
new file mode 100644
index 0000000..f9aed6c
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala
@@ -0,0 +1,15 @@
+package xyz.driver.pdsuidomain.entities
+
+import xyz.driver.pdsuicommon.domain.LongId
+import xyz.driver.pdsuicommon.logging._
+
+final case class SlotArmEligibilityArm(slotArmId: LongId[SlotArm],
+ eligibilityArmId: LongId[EligibilityArm])
+
+
+object SlotArmEligibilityArm {
+ implicit def toPhiString(x: SlotArmEligibilityArm): PhiString = {
+ import x._
+ phi"SlotArmEligibilityArm(slotArmId=$slotArmId, eligibilityArmId=$eligibilityArmId)"
+ }
+}
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..1a900ac
--- /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 LabelEvidence(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[xyz.driver.entities.patient.Patient],
+ name: FullName[xyz.driver.entities.patient.Patient],
+ 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/patient/ExportPatientLabelEvidenceDocument.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala
index 99912bc..7003615 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
@@ -4,12 +4,12 @@ import java.time.LocalDate
import xyz.driver.pdsuicommon.domain._
import xyz.driver.pdsuicommon.logging._
-import xyz.driver.pdsuidomain.entities.{Document, RawPatientLabel, RecordRequestId}
+import xyz.driver.pdsuidomain.entities._
final case class ExportPatientLabelEvidenceDocument(documentId: LongId[Document],
requestId: RecordRequestId,
- documentType: String,
- providerType: String,
+ documentType: DocumentType,
+ providerType: ProviderType,
date: LocalDate)
object ExportPatientLabelEvidenceDocument extends PhiLogging {
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],