diff options
author | vlad <vlad@driver.xyz> | 2018-01-25 14:12:31 -0800 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2018-01-25 14:12:31 -0800 |
commit | a0877d81ca2844d75dc361b5ce7c99afacd6e25f (patch) | |
tree | 8fe49f45cbcddbbb9a3d167099abe7aa2625e56b /src/main/scala/xyz/driver/pdsuidomain/entities | |
parent | 46a22e9ab324a0068a85952cdc809800f360f445 (diff) | |
download | rest-query-a0877d81ca2844d75dc361b5ce7c99afacd6e25f.tar.gz rest-query-a0877d81ca2844d75dc361b5ce7c99afacd6e25f.tar.bz2 rest-query-a0877d81ca2844d75dc361b5ce7c99afacd6e25f.zip |
Extracting query library
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities')
38 files changed, 0 insertions, 2530 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Arm.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Arm.scala deleted file mode 100644 index 2190b8d..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Arm.scala +++ /dev/null @@ -1,20 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.pdsuicommon.domain.{LongId, StringId} -import xyz.driver.pdsuicommon.logging._ - -final case class Arm(id: LongId[Arm], - name: String, - originalName: String, - trialId: StringId[Trial], - deleted: Option[LocalDateTime] = None) - -object Arm { - - implicit def toPhiString(x: Arm): PhiString = { - import x._ - phi"Arm(id=$id, name=${Unsafe(x.name)}, trialId=${Unsafe(x.trialId)})" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala deleted file mode 100644 index 26ced22..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Criterion.scala +++ /dev/null @@ -1,57 +0,0 @@ -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 - -final case class Criterion(id: LongId[Criterion], - trialId: StringId[Trial], - text: Option[String], - isCompound: Boolean, - meta: String, - inclusion: Option[Boolean]) { - - def isValid: Boolean = text.nonEmpty && Option(meta).isDefined -} - -object Criterion { - - final case class Meta(evidence: Evidence) - - object Meta { - final case class Evidence(pageRatio: Double, start: TextLayerPosition, end: TextLayerPosition) - final case class TextLayerPosition(page: Integer, index: Integer, offset: Integer) - } - - implicit def toPhiString(x: Criterion): PhiString = { - import x._ - phi"Criterion(id=$id, trialId=$trialId, isCompound=$isCompound)" - } -} - -final case class CriterionArm(criterionId: LongId[Criterion], armId: LongId[EligibilityArm]) - -object CriterionArm { - - implicit def toPhiString(x: CriterionArm): PhiString = { - import x._ - phi"CriterionArm(criterionId=$criterionId, armId=$armId)" - } -} - -final case class CriterionLabel(id: LongId[CriterionLabel], - labelId: Option[LongId[Label]], - criterionId: LongId[Criterion], - categoryId: Option[LongId[LabelCategory]], - value: Option[Boolean], - isDefining: Boolean) - -object CriterionLabel { - - implicit def toPhiString(x: CriterionLabel): PhiString = { - import x._ - phi"CriterionLabel(id=$id, labelId=$labelId, criterionId=$criterionId, " + - phi"categoryId=$categoryId, value=$value, isDefining=$isDefining)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/DirectReport.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/DirectReport.scala deleted file mode 100644 index f35c3fd..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/DirectReport.scala +++ /dev/null @@ -1,24 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDate - -import xyz.driver.entities.assays.AssayType -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.domain.UuidId - -object DirectReport { - implicit def toPhiString(x: DirectReport): PhiString = { - import x._ - phi"DirectReport(id=$id, patientId=$patientId, reportType=${Unsafe(reportType)}, date=${Unsafe(date)}, " + - phi"documentType=${Unsafe(documentType)}, providerType=${Unsafe(providerType)}, " + - phi"providerName=${Unsafe(providerName)})" - } -} - -final case class DirectReport(id: UuidId[DirectReport], - patientId: UuidId[Patient], - reportType: AssayType, - date: LocalDate, - documentType: DocumentType, - providerType: ProviderType, - providerName: String) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala deleted file mode 100644 index 0669baf..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala +++ /dev/null @@ -1,492 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.{LocalDate, LocalDateTime, ZoneId} - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties -import com.fasterxml.jackson.core.{JsonGenerator, JsonParser} -import com.fasterxml.jackson.databind._ -import com.fasterxml.jackson.databind.annotation.{JsonDeserialize, JsonSerialize} -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils -import xyz.driver.pdsuicommon.validation.Validators -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 - -sealed trait ProviderType { - val id: LongId[ProviderType] - val name: String -} - -object ProviderType { - - 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 = { - import x._ - phi"ProviderType(id=$id, category=${Unsafe(name)})" - } -} - -sealed trait DocumentType { - val id: LongId[DocumentType] - val name: String -} - -object DocumentType { - - 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](_ == _) - - implicit def toPhiString(x: DocumentType): PhiString = { - import x._ - phi"DocumentType(id=$id, name=${Unsafe(name)})" - } -} - -object Document { - - final case class Meta(startPage: Double, endPage: Double) - - class DocumentStatusSerializer extends JsonSerializer[Status] { - def serialize(value: Status, gen: JsonGenerator, serializers: SerializerProvider): Unit = { - gen.writeString(value.toString.toUpperCase) - } - } - - class DocumentStatusDeserializer extends JsonDeserializer[Status] { - def deserialize(parser: JsonParser, context: DeserializationContext): Status = { - val value = parser.getValueAsString - Option(value).fold[Document.Status](Status.New /* Default document status */ ) { v => - Status.All.find(_.toString.toUpperCase == v) match { - case None => throw new RuntimeJsonMappingException(s"$v is not valid Document.Status") - case Some(status) => status - } - } - } - } - - // Product with Serializable fixes issue: - // Set(New, Organized) has type Set[Status with Product with Serializable] - @JsonDeserialize(using = classOf[DocumentStatusDeserializer]) - @JsonSerialize(using = classOf[DocumentStatusSerializer]) - sealed trait Status extends Product with Serializable { - - def oneOf(xs: Status*): Boolean = xs.contains(this) - - def oneOf(xs: Set[Status]): Boolean = xs.contains(this) - - } - - object Status { - case object New extends Status - case object Organized extends Status - case object Extracted extends Status - case object Done extends Status - case object Flagged extends Status - case object Archived extends Status - - val All = Set[Status](New, Organized, Extracted, Done, Flagged, Archived) - val AllPrevious = Set[Status](Organized, Extracted) - - def fromString(status: String): Option[Status] = status match { - case "New" => Some(Status.New) - case "Organized" => Some(Status.Organized) - case "Extracted" => Some(Status.Extracted) - case "Done" => Some(Status.Done) - case "Flagged" => Some(Status.Flagged) - case "Archived" => Some(Status.Archived) - case _ => None - } - - def statusToString(x: Status): String = x match { - case Status.New => "New" - case Status.Organized => "Organized" - case Status.Extracted => "Extracted" - case Status.Done => "Done" - case Status.Flagged => "Flagged" - case Status.Archived => "Archived" - } - - implicit def toPhiString(x: Status): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - sealed trait RequiredType extends Product with Serializable { - - def oneOf(xs: RequiredType*): Boolean = xs.contains(this) - - def oneOf(xs: Set[RequiredType]): Boolean = xs.contains(this) - - } - - object RequiredType { - case object OPN extends RequiredType - case object PN extends RequiredType - - val All = Set[RequiredType](OPN, PN) - - def fromString(tpe: String): Option[RequiredType] = tpe match { - case "OPN" => Some(RequiredType.OPN) - case "PN" => Some(RequiredType.PN) - case _ => None - } - - def requiredTypeToString(x: RequiredType): String = x match { - case RequiredType.OPN => "OPN" - case RequiredType.PN => "PN" - } - - implicit def toPhiString(x: RequiredType): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - implicit def toPhiString(x: Document): PhiString = { - import x._ - phi"Document(id=$id, status=$status, assignee=${Unsafe(assignee)}, " + - phi"previousAssignee=${Unsafe(previousAssignee)}, " + - phi"lastActiveUserId=${Unsafe(lastActiveUserId)}, recordId=$recordId)" - } - - val validator: Validator[Document, Document] = { input => - for { - typeId <- Validators.nonEmpty("typeId")(input.typeId).right - - providerTypeId <- Validators.nonEmpty("providerTypeId")(input.providerTypeId).right - - institutionName <- Validators.nonEmpty("institutionName")(input.institutionName).right - - meta <- Validators.nonEmpty("meta")(input.meta).right - - startDate <- Validators.nonEmpty("startDate")(input.startDate).right - - isOrderRight <- (input.endDate match { - case Some(endDate) if startDate.isAfter(endDate) => - Validators.fail("The start date should be less, than the end one") - - case _ => Validators.success(true) - }).right - - areDatesInThePast <- { - val dates = List(input.startDate, input.endDate).flatten - val now = LocalDate.now() - val hasInvalid = dates.exists(_.isAfter(now)) - - if (hasInvalid) Validators.fail("Dates should be in the past") - else Validators.success(true) - }.right - } yield input - } - -} - -@JsonIgnoreProperties(value = Array("valid")) -final case class Document(id: LongId[Document] = LongId(0L), - status: Document.Status, - previousStatus: Option[Document.Status], - assignee: Option[xyz.driver.core.Id[User]], - previousAssignee: Option[xyz.driver.core.Id[User]], - lastActiveUserId: Option[xyz.driver.core.Id[User]], - recordId: LongId[MedicalRecord], - physician: Option[String], - typeId: Option[LongId[DocumentType]], // not null - providerName: Option[String], // not null - providerTypeId: Option[LongId[ProviderType]], // not null - requiredType: Option[Document.RequiredType], - institutionName: Option[String], - meta: Option[TextJson[Meta]], // not null - startDate: Option[LocalDate], // not null - endDate: Option[LocalDate], - lastUpdate: LocalDateTime, - labelVersion: Int) { - - import Document.Status._ - - if (previousStatus.nonEmpty) { - assert(AllPrevious.contains(previousStatus.get), s"Previous status has invalid value: ${previousStatus.get}") - } - - def getRequiredType(documentTypeName: String, providerTypeName: String): Option[Document.RequiredType] = { - import DocumentType.{OutpatientPhysicianNote, PathologyReport} - import ProviderType.MedicalOncology - - (DocumentType.fromString(documentTypeName), ProviderType.fromString(providerTypeName), startDate) match { - case (Some(OutpatientPhysicianNote), Some(MedicalOncology), Some(date)) - if !(date.isAfter(LocalDate.now(ZoneId.of("Z"))) || date.isBefore( - LocalDate.now(ZoneId.of("Z")).minusMonths(6))) => - Some(Document.RequiredType.OPN) - - case (Some(PathologyReport), _, _) => Some(Document.RequiredType.PN) - - case _ => None - } - } - - // TODO: with the current business logic code this constraint sometimes harmful - // require(status match { - // case Document.Status.New if assignee.isDefined => false - // case Document.Status.Done if assignee.isDefined => false - // case _ => true - // }, "Assignee can't be defined in New or Done statuses") - -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentHistory.scala deleted file mode 100644 index f076074..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentHistory.scala +++ /dev/null @@ -1,98 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.{LocalDateTime, ZoneId} - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils -import xyz.driver.pdsuidomain.entities.DocumentHistory.{Action, _} - -object DocumentHistory { - - implicit def toPhiString(x: DocumentHistory): PhiString = { - import x._ - phi"DocumentHistory(id=$id, executor=${Unsafe(executor)}, documentId=$documentId, state=$state, action=$action, " + - phi"created=$created)" - } - - sealed trait State - object State { - case object New extends State - case object Extract extends State - case object Review extends State - case object Done extends State - case object Flag extends State - case object Archive extends State - - val All: Set[State] = Set( - State.New, - State.Extract, - State.Review, - State.Done, - State.Flag, - State.Archive - ) - - private val stateToName: Map[State, String] = - All.map(s => s -> s.toString).toMap - - val fromString: PartialFunction[String, State] = - for ((k, v) <- stateToName) yield (v, k) - - def stateToString: State => String = stateToName - - implicit def toPhiString(x: State): PhiString = - Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - sealed trait Action extends Product with Serializable { - - def oneOf(xs: Action*): Boolean = xs.contains(this) - - def oneOf(xs: Set[Action]): Boolean = xs.contains(this) - - } - - object Action { - case object Start extends Action - case object Submit extends Action - case object Unassign extends Action - case object Resolve extends Action - case object Flag extends Action - case object Archive extends Action - case object PostEvidence extends Action - case object CreateDocument extends Action - case object ReadDocument extends Action - - val All: Set[Action] = Set( - Action.Start, - Action.Submit, - Action.Unassign, - Action.Resolve, - Action.Flag, - Action.Archive, - Action.PostEvidence, - Action.CreateDocument, - Action.ReadDocument - ) - - private val actionToName: Map[Action, String] = - All.map(a => a -> a.toString).toMap - - val fromString: PartialFunction[String, Action] = - for ((k, v) <- actionToName) yield (v, k) - - def actionToString: Action => String = actionToName - - implicit def toPhiString(x: Action): PhiString = - Unsafe(Utils.getClassSimpleName(x.getClass)) - } -} - -final case class DocumentHistory(id: LongId[DocumentHistory], - executor: xyz.driver.core.Id[User], - documentId: LongId[Document], - state: State, - action: Action, - created: LocalDateTime = LocalDateTime.now(ZoneId.of("Z"))) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentIssue.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentIssue.scala deleted file mode 100644 index 279ef38..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentIssue.scala +++ /dev/null @@ -1,24 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain.LongId -import xyz.driver.pdsuicommon.logging._ - -final case class DocumentIssue(id: LongId[DocumentIssue], - userId: xyz.driver.core.Id[User], - documentId: LongId[Document], - startPage: Option[Double], - endPage: Option[Double], - lastUpdate: LocalDateTime, - isDraft: Boolean, - text: String, - archiveRequired: Boolean) - -object DocumentIssue { - implicit def toPhiString(x: DocumentIssue): PhiString = { - import x._ - phi"DocumentIssue(id=$id, userId=${Unsafe(userId)}, documentId=$documentId)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/EligibilityArm.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/EligibilityArm.scala deleted file mode 100644 index 50b49ad..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/EligibilityArm.scala +++ /dev/null @@ -1,42 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.entities.patient.CancerType -import xyz.driver.pdsuicommon.domain.{LongId, StringId} -import xyz.driver.pdsuicommon.logging._ - -final case class EligibilityArm(id: LongId[EligibilityArm], - name: String, - originalName: String, - trialId: StringId[Trial], - deleted: Option[LocalDateTime] = None) - -object EligibilityArm { - - implicit def toPhiString(x: EligibilityArm): PhiString = { - import x._ - phi"Arm(id=$id, name=${Unsafe(x.name)}, trialId=${Unsafe(x.trialId)})" - } -} - -final case class EligibilityArmDisease(eligibilityArmId: LongId[EligibilityArm], disease: CancerType) - -object EligibilityArmDisease { - - implicit def toPhiString(x: EligibilityArmDisease): PhiString = { - phi"EligibilityArmDisease(eligibilityArmId=${Unsafe(x.eligibilityArmId)}, disease=${Unsafe(x.disease)})" - } - -} - -final case class EligibilityArmWithDiseases(eligibilityArm: EligibilityArm, - eligibilityArmDiseases: Seq[EligibilityArmDisease]) - -object EligibilityArmWithDiseases { - - implicit def toPhiString(x: EligibilityArmWithDiseases): PhiString = { - import x._ - phi"EligibilityArmWithDiseases(eligibilityArm=$eligibilityArm, eligibilityArmDiseases=$eligibilityArmDiseases)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala deleted file mode 100644 index 569375a..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/ExtractedData.scala +++ /dev/null @@ -1,48 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue} -import xyz.driver.pdsuicommon.domain.{LongId, TextJson} -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuidomain.entities.ExtractedData.Meta - -final case class ExtractedData(id: LongId[ExtractedData] = LongId(0L), - documentId: LongId[Document], - keywordId: Option[LongId[Keyword]], - evidenceText: Option[String], - meta: Option[TextJson[Meta]]) { - - def isValid: Boolean = evidenceText.getOrElse("") != "" && meta.nonEmpty - -} - -object ExtractedData { - - final case class Meta(keyword: Option[Meta.Keyword], evidence: Option[Meta.Evidence]) - - object Meta { - final case class Evidence(pageRatio: Double, start: TextLayerPosition, end: TextLayerPosition) - - final case class TextLayerPosition(page: Integer, index: Integer, offset: Integer) - - final case class Keyword(page: Integer, pageRatio: Option[Double], index: Integer, sortIndex: String) - } - - implicit def toPhiString(x: ExtractedData): PhiString = { - import x._ - phi"ExtractedData(id=$id, documentId=$documentId, keywordId=$keywordId)" - } -} - -object ExtractedDataLabel { - - implicit def toPhiString(x: ExtractedDataLabel): PhiString = { - import x._ - phi"ExtractedDataLabel(id=$id, dataId=$dataId, labelId=$labelId, categoryId=$categoryId, value=${Unsafe(value)})" - } -} - -final case class ExtractedDataLabel(id: LongId[ExtractedDataLabel], - dataId: LongId[ExtractedData], - labelId: Option[LongId[Label]], - categoryId: Option[LongId[LabelCategory]], - value: Option[LabelValue]) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Hypothesis.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Hypothesis.scala deleted file mode 100644 index 47b87ff..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Hypothesis.scala +++ /dev/null @@ -1,13 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import xyz.driver.pdsuicommon.domain.UuidId -import xyz.driver.pdsuicommon.logging._ - -final case class Hypothesis(id: UuidId[Hypothesis], name: String, treatmentType: String, description: String) - -object Hypothesis { - implicit def toPhiString(x: Hypothesis): PhiString = { - import x._ - phi"Hypothesis(id=$id, name=${Unsafe(name)})" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala deleted file mode 100644 index be51e4f..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Intervention.scala +++ /dev/null @@ -1,215 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import xyz.driver.pdsuicommon.domain.{LongId, StringId} -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuidomain.entities.InterventionType.DeliveryMethod -import xyz.driver.pdsuidomain.entities.InterventionType.DeliveryMethod._ - -import scalaz.syntax.equal._ -import scalaz.Scalaz.stringInstance - -sealed trait InterventionType { - val id: LongId[InterventionType] - val name: String - val deliveryMethods: Set[DeliveryMethod] -} - -object InterventionType { - - final case object Chemotherapy extends InterventionType { - val id: LongId[InterventionType] = LongId[InterventionType](2) - val name: String = "Chemotherapy" - val deliveryMethods: Set[DeliveryMethod] = commonMethods - } - - final case object TargetedTherapy extends InterventionType { - val id: LongId[InterventionType] = LongId[InterventionType](3) - val name: String = "Targeted therapy" - val deliveryMethods: Set[DeliveryMethod] = commonMethods - } - - final case object Immunotherapy extends InterventionType { - val id: LongId[InterventionType] = LongId[InterventionType](4) - val name: String = "Immunotherapy" - val deliveryMethods: Set[DeliveryMethod] = commonMethods - } - - final case object HormoneTherapy extends InterventionType { - val id: LongId[InterventionType] = LongId[InterventionType](6) - val name: String = "Hormone therapy" - val deliveryMethods: Set[DeliveryMethod] = commonMethods - } - - final case object Other extends InterventionType { - val id: LongId[InterventionType] = LongId[InterventionType](7) - val name: String = "Other" - val deliveryMethods: Set[DeliveryMethod] = commonMethods - } - - final case object Radiation extends InterventionType { - val id: LongId[InterventionType] = LongId[InterventionType](8) - val name: String = "Radiation" - val deliveryMethods: Set[DeliveryMethod] = Set( - ExternalRadiationTherapy, - Brachytherapy, - SystemicRadiationTherapyIV, - SystemicRadiationTherapyOral, - ProtonBeamTherapy - ) - } - - final case object SurgeryProcedure extends InterventionType { - val id: LongId[InterventionType] = LongId[InterventionType](9) - val name: String = "Surgery/Procedure" - val deliveryMethods: Set[DeliveryMethod] = Set( - RadioFrequencyAblationRFA, - Cryoablation, - TherapeuticConventionalSurgery, - RoboticAssistedLaparoscopicSurgery - ) - } - - def typeFromString(txt: String): Option[InterventionType] = { - All.values.find(_.name === txt) - } - - sealed trait DeliveryMethod - object DeliveryMethod { - case object IntravenousInfusionIV extends DeliveryMethod - case object IntramuscularInjection extends DeliveryMethod - case object SubcutaneousInjection extends DeliveryMethod - case object IntradermalInjection extends DeliveryMethod - case object SpinalInjection extends DeliveryMethod - case object Oral extends DeliveryMethod - case object Topical extends DeliveryMethod - case object TransdermalPatch extends DeliveryMethod - case object Inhalation extends DeliveryMethod - case object Rectal extends DeliveryMethod - case object ExternalRadiationTherapy extends DeliveryMethod - case object Brachytherapy extends DeliveryMethod - case object SystemicRadiationTherapyIV extends DeliveryMethod - case object SystemicRadiationTherapyOral extends DeliveryMethod - case object ProtonBeamTherapy extends DeliveryMethod - case object RadioFrequencyAblationRFA extends DeliveryMethod - case object Cryoablation extends DeliveryMethod - case object TherapeuticConventionalSurgery extends DeliveryMethod - case object RoboticAssistedLaparoscopicSurgery extends DeliveryMethod - - def fromString: PartialFunction[String, DeliveryMethod] = { - case "Intravenous Infusion (IV)" => IntravenousInfusionIV - case "Intramuscular Injection" => IntramuscularInjection - case "Subcutaneous Injection" => SubcutaneousInjection - case "Intradermal Injection" => IntradermalInjection - case "Spinal Injection" => SpinalInjection - case "Oral" => Oral - case "Topical" => Topical - case "Transdermal Patch" => TransdermalPatch - case "Inhalation" => Inhalation - case "Rectal" => Rectal - case "External Radiation Therapy" => ExternalRadiationTherapy - case "Brachytherapy" => Brachytherapy - case "Systemic Radiation Therapy (IV)" => SystemicRadiationTherapyIV - case "Systemic Radiation Therapy (Oral)" => SystemicRadiationTherapyOral - case "Proton Beam Therapy" => ProtonBeamTherapy - case "Radio-Frequency Ablation (RFA)" => RadioFrequencyAblationRFA - case "Cryoablation" => Cryoablation - case "Therapeutic Conventional Surgery" => TherapeuticConventionalSurgery - case "Robotic Assisted Laparoscopic Surgery" => RoboticAssistedLaparoscopicSurgery - } - - def methodToString(x: DeliveryMethod): String = x match { - case IntravenousInfusionIV => "Intravenous Infusion (IV)" - case IntramuscularInjection => "Intramuscular Injection" - case SubcutaneousInjection => "Subcutaneous Injection" - case IntradermalInjection => "Intradermal Injection" - case SpinalInjection => "Spinal Injection" - case Oral => "Oral" - case Topical => "Topical" - case TransdermalPatch => "Transdermal Patch" - case Inhalation => "Inhalation" - case Rectal => "Rectal" - case ExternalRadiationTherapy => "External Radiation Therapy" - case Brachytherapy => "Brachytherapy" - case SystemicRadiationTherapyIV => "Systemic Radiation Therapy (IV)" - case SystemicRadiationTherapyOral => "Systemic Radiation Therapy (Oral)" - case ProtonBeamTherapy => "Proton Beam Therapy" - case RadioFrequencyAblationRFA => "Radio-Frequency Ablation (RFA)" - case Cryoablation => "Cryoablation" - case TherapeuticConventionalSurgery => "Therapeutic Conventional Surgery" - case RoboticAssistedLaparoscopicSurgery => "Robotic Assisted Laparoscopic Surgery" - } - } - - val commonMethods: Set[DeliveryMethod] = Set[DeliveryMethod]( - IntravenousInfusionIV, - IntramuscularInjection, - SubcutaneousInjection, - IntradermalInjection, - SpinalInjection, - Oral, - Topical, - TransdermalPatch, - Inhalation, - Rectal - ) - - val All: Map[LongId[InterventionType], InterventionType] = Map[LongId[InterventionType], InterventionType]( - LongId[InterventionType](2) -> Chemotherapy, - LongId[InterventionType](3) -> TargetedTherapy, - LongId[InterventionType](4) -> Immunotherapy, - LongId[InterventionType](6) -> HormoneTherapy, - LongId[InterventionType](7) -> Other, - LongId[InterventionType](8) -> Radiation, - LongId[InterventionType](9) -> SurgeryProcedure - ) - - implicit def toPhiString(x: InterventionType): PhiString = { - import x._ - phi"InterventionType(id=$id, name=${Unsafe(name)})" - } -} - -final case class InterventionArm(armId: LongId[SlotArm], interventionId: LongId[Intervention]) - -object InterventionArm { - implicit def toPhiString(x: InterventionArm): PhiString = { - import x._ - phi"InterventionArm(armId=$armId, interventionId=$interventionId)" - } -} - -final case class Intervention(id: LongId[Intervention], - trialId: StringId[Trial], - name: String, - originalName: String, - typeId: Option[LongId[InterventionType]], - originalType: Option[String], - dosage: String, - originalDosage: String, - isActive: Boolean, - deliveryMethod: Option[String]) { - def deliveryMethodIsCorrect: Boolean = { - if (this.typeId.nonEmpty && this.deliveryMethod.nonEmpty) { - InterventionType.All - .getOrElse(this.typeId.get, throw new IllegalArgumentException(s"Not found Intervention type ${this.typeId}")) - .deliveryMethods - .contains(DeliveryMethod.fromString(this.deliveryMethod.get)) - } else true - } -} - -object Intervention { - implicit def toPhiString(x: Intervention): PhiString = { - import x._ - phi"Intervention(id=$id, trialId=$trialId, name=${Unsafe(name)}, typeId=$typeId, isActive=$isActive, deliveryMethod=${Unsafe(deliveryMethod)})" - } -} - -final case class InterventionWithArms(intervention: Intervention, arms: List[InterventionArm]) - -object InterventionWithArms { - implicit def toPhiString(x: InterventionWithArms): PhiString = { - import x._ - phi"InterventionWithArms(intervention=$intervention, arms=$arms)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Keyword.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Keyword.scala deleted file mode 100644 index a984f92..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Keyword.scala +++ /dev/null @@ -1,32 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import xyz.driver.entities.labels.Label -import xyz.driver.pdsuicommon.domain.LongId -import xyz.driver.pdsuicommon.logging._ - -final case class Keyword(id: LongId[Keyword], keyword: String) - -object Keyword { - implicit def toPhiString(x: Keyword): PhiString = { - import x._ - phi"Keyword(id=$id, keyword=${Unsafe(keyword)})" - } -} - -final case class KeywordWithLabels(keyword: Keyword, labels: List[Label]) - -object KeywordWithLabels { - implicit def toPhiString(x: KeywordWithLabels): PhiString = { - import x._ - phi"KeywordWithLabels(keyword=$keyword, ${Unsafe(labels)}" - } -} - -final case class KeywordLabel(keywordId: LongId[Keyword], labelId: LongId[Label]) - -object KeywordLabel { - implicit def toPhiString(x: KeywordLabel): PhiString = { - import x._ - phi"KeywordLabel($keywordId, $labelId)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecord.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecord.scala deleted file mode 100644 index cf13d1a..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecord.scala +++ /dev/null @@ -1,164 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.nio.channels.ReadableByteChannel -import java.time.LocalDateTime - -import com.fasterxml.jackson.annotation.JsonSubTypes.Type -import com.fasterxml.jackson.annotation.{JsonProperty, JsonSubTypes, JsonTypeInfo} -import xyz.driver.core.auth.User -import xyz.driver.entities.assays.PatientCase -import xyz.driver.entities.clinic.ClinicalRecord -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils -import xyz.driver.pdsuidomain.entities.MedicalRecord.Meta -import xyz.driver.pdsuidomain.entities.MedicalRecord.Meta.{Duplicate, Reorder, Rotation} - -object MedicalRecord { - - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") - @JsonSubTypes( - Array( - new Type(value = classOf[Duplicate], name = "duplicate"), - new Type(value = classOf[Reorder], name = "reorder"), - new Type(value = classOf[Rotation], name = "rotation") - )) - trait Meta { - @JsonProperty("type") def metaType: String - } - - object Meta { - - final case class Duplicate(startPage: Double, - endPage: Double, - startOriginalPage: Double, - endOriginalPage: Option[Double]) - extends Meta { - override val metaType = "duplicate" - } - - object Duplicate { - implicit def toPhiString(x: Duplicate): PhiString = { - import x._ - phi"Duplicate(startPage=${Unsafe(startPage)}, endPage=${Unsafe(endPage)}, " + - phi"startOriginalPage=${Unsafe(startOriginalPage)}, endOriginalPage=${Unsafe(endOriginalPage)}" - } - } - - final case class Reorder(items: Seq[Int]) extends Meta { - override val metaType = "reorder" - } - - object Reorder { - implicit def toPhiString(x: Reorder): PhiString = { - import x._ - phi"Reorder(items=${Unsafe(items.toString)})" - } - } - - final case class Rotation(items: Map[String, Int]) extends Meta { - override val metaType = "rotation" - } - - object Rotation { - implicit def toPhiString(x: Rotation): PhiString = { - import x._ - phi"Rotation(items=${Unsafe(items.toString)})" - } - } - - implicit def toPhiString(input: Meta): PhiString = input match { - case x: Duplicate => Duplicate.toPhiString(x) - case x: Reorder => Reorder.toPhiString(x) - case x: Rotation => Rotation.toPhiString(x) - } - - } - - // Product with Serializable fixes issue: - // Set(New, Cleaned) has type Set[Status with Product with Serializable] - sealed trait Status extends Product with Serializable { - - def oneOf(xs: Status*): Boolean = xs.contains(this) - - def oneOf(xs: Set[Status]): Boolean = xs.contains(this) - - } - object Status { - case object New extends Status - case object Cleaned extends Status - case object Reviewed extends Status - case object Organized extends Status - case object Done extends Status - case object Flagged extends Status - case object Archived extends Status - - def fromString(status: String): Option[Status] = status match { - case "New" => Some(New) - case "Cleaned" => Some(Cleaned) - case "Reviewed" => Some(Reviewed) - case "Organized" => Some(Organized) - case "Done" => Some(Done) - case "Flagged" => Some(Flagged) - case "Archived" => Some(Archived) - case _ => None - } - - val All: Set[Status] = Set[Status]( - New, - Cleaned, - Reviewed, - Organized, - Done, - Flagged, - Archived - ) - - val AllPrevious: Set[Status] = Set[Status](New, Cleaned, Reviewed, Organized) - - implicit def toPhiString(x: Status): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - sealed trait PdfSource - - object PdfSource { - case object Empty extends PdfSource - - /** @param createResource Constructor of the resource which is represents the file */ - final case class Channel(createResource: () => ReadableByteChannel) extends PdfSource - } - - implicit def toPhiString(x: MedicalRecord): PhiString = { - import x._ - phi"MedicalRecord(id=$id, status=$status, assignee=${Unsafe(assignee)}, " + - phi"previousAssignee=${Unsafe(previousAssignee)}, lastActiveUserId=${Unsafe(lastActiveUserId)})" - } -} - -final case class MedicalRecord(id: LongId[MedicalRecord], - status: MedicalRecord.Status, - previousStatus: Option[MedicalRecord.Status], - assignee: Option[xyz.driver.core.Id[User]], - previousAssignee: Option[xyz.driver.core.Id[User]], - lastActiveUserId: Option[xyz.driver.core.Id[User]], - patientId: UuidId[Patient], - requestId: xyz.driver.core.Id[ClinicalRecord], - disease: String, - caseId: Option[xyz.driver.core.Id[PatientCase]], - physician: Option[String], - meta: Option[TextJson[List[Meta]]], - lastUpdate: LocalDateTime, - totalPages: Int) { - - import MedicalRecord.Status._ - - if (previousStatus.nonEmpty) { - assert(AllPrevious.contains(previousStatus.get), s"Previous status has invalid value: ${previousStatus.get}") - } - - // TODO: with the current business logic code this constraint sometimes harmful - // require(status match { - // case MedicalRecord.Status.Done if assignee.isDefined => false - // case _ => true - // }, "Assignee can't be defined in Done status") -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala deleted file mode 100644 index 5ed5805..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala +++ /dev/null @@ -1,112 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.{LocalDateTime, ZoneId} - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils -import xyz.driver.pdsuidomain.entities.MedicalRecordHistory._ - -object MedicalRecordHistory { - - implicit def toPhiString(x: MedicalRecordHistory): PhiString = { - import x._ - phi"MedicalRecordHistory(id=$id, executor=${Unsafe(executor)}, recordId=$recordId, state=$state, action=$action, " + - phi"created=$created)" - } - - sealed trait State - - object State { - case object New extends State - case object Clean extends State - case object Organize extends State - case object Review extends State - case object Done extends State - case object Flag extends State - case object Archive extends State - - val All: Set[State] = Set( - State.New, - State.Clean, - State.Organize, - State.Review, - State.Done, - State.Flag, - State.Archive - ) - - private val stateToName: Map[State, String] = - All.map(s => s -> s.toString).toMap - - val fromString: PartialFunction[String, State] = - for ((k, v) <- stateToName) yield (v, k) - - def stateToString: State => String = stateToName - - implicit def toPhiString(x: State): PhiString = - Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - sealed trait Action extends Product with Serializable { - def oneOf(xs: Action*): Boolean = xs.contains(this) - def oneOf(xs: Set[Action]): Boolean = xs.contains(this) - } - - object Action { - case object Start extends Action - case object Submit extends Action - case object Unassign extends Action - case object Resolve extends Action - case object Flag extends Action - case object Archive extends Action - case object SaveDuplicate extends Action - case object SaveReorder extends Action - case object SaveRotation extends Action - case object DeleteDuplicate extends Action - case object DeleteReorder extends Action - case object DeleteRotation extends Action - case object CreateDocument extends Action - case object DeleteDocument extends Action - case object CreateRecord extends Action - case object ReadRecord extends Action - - val All: Set[Action] = Set( - Action.Start, - Action.Submit, - Action.Unassign, - Action.Resolve, - Action.Flag, - Action.Archive, - Action.SaveDuplicate, - Action.SaveReorder, - Action.SaveRotation, - Action.DeleteDuplicate, - Action.DeleteReorder, - Action.DeleteRotation, - Action.CreateDocument, - Action.DeleteDocument, - Action.CreateRecord, - Action.ReadRecord - ) - - private val actionToName: Map[Action, String] = - All.map(a => a -> a.toString).toMap - - val fromString: PartialFunction[String, Action] = - for ((k, v) <- actionToName) yield (v, k) - - def actionToString: Action => String = actionToName - - implicit def toPhiString(x: Action): PhiString = - Unsafe(Utils.getClassSimpleName(x.getClass)) - } -} - -final case class MedicalRecordHistory(id: LongId[MedicalRecordHistory], - executor: xyz.driver.core.Id[User], - recordId: LongId[MedicalRecord], - state: State, - action: Action, - created: LocalDateTime = LocalDateTime.now(ZoneId.of("Z"))) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordIssue.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordIssue.scala deleted file mode 100644 index 6cdad49..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordIssue.scala +++ /dev/null @@ -1,24 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain.LongId -import xyz.driver.pdsuicommon.logging._ - -final case class MedicalRecordIssue(id: LongId[MedicalRecordIssue], - userId: xyz.driver.core.Id[User], - recordId: LongId[MedicalRecord], - startPage: Option[Double], - endPage: Option[Double], - lastUpdate: LocalDateTime, - isDraft: Boolean, - text: String, - archiveRequired: Boolean) - -object MedicalRecordIssue { - implicit def toPhiString(x: MedicalRecordIssue): PhiString = { - import x._ - phi"MedicalRecordIssue(id=$id, userId=${Unsafe(userId)}, recordId=$recordId)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Message.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Message.scala deleted file mode 100644 index 68fd5cd..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Message.scala +++ /dev/null @@ -1,35 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} -import xyz.driver.pdsuicommon.logging._ - -final case class Message(id: LongId[Message], - text: String, - lastUpdate: LocalDateTime, - userId: xyz.driver.core.Id[User], - isDraft: Boolean, - recordId: Option[LongId[MedicalRecord]], - documentId: Option[LongId[Document]], - patientId: Option[UuidId[Patient]], - trialId: Option[StringId[Trial]], - startPage: Option[Double], - endPage: Option[Double], - evidence: Option[String], - archiveRequired: Option[Boolean], - meta: Option[String]) - -object Message { - implicit def toPhiString(x: Message): PhiString = { - import x._ - - val entityId: Option[String] = recordId - .map(_.toString) - .orElse(documentId.map(_.toString)) - .orElse(patientId.map(_.toString)) - - phi"Message(id=$id, userId=${Unsafe(userId)}, isDraft=$isDraft, entityId=${Unsafe(entityId)}" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Patient.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Patient.scala deleted file mode 100644 index c48e0d9..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Patient.scala +++ /dev/null @@ -1,63 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.{LocalDate, LocalDateTime} - -import xyz.driver.core.auth.User -import xyz.driver.entities.clinic.TestOrder -import xyz.driver.entities.common.FullName -import xyz.driver.entities.patient.CancerType -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils - -object Patient { - - // Product with Serizalizable fixes issue: - // Set(New, Verified) has type Set[Status with Product with Serializable] - sealed trait Status extends Product with Serializable { - def oneOf(xs: Status*): Boolean = xs.contains(this) - - def oneOf(xs: Set[Status]): Boolean = xs.contains(this) - } - - object Status { - case object New extends Status - case object Verified extends Status - case object Reviewed extends Status - case object Curated extends Status - case object Flagged extends Status - case object Done extends Status - - val AllPrevious: Set[Status] = Set[Status](New, Verified, Reviewed, Curated) - - val All: Set[Status] = Set[Status](New, Verified, Reviewed, Curated, Flagged, Done) - - implicit def toPhiString(x: Status): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - implicit def toPhiString(x: Patient): PhiString = { - import x._ - phi"Patient(id=$id, status=$status, previousStatus=$previousStatus, lastActiveUserId=${Unsafe(lastActiveUserId)}" + - phi"assignee=${Unsafe(assignee)}, previousAssignee=${Unsafe(previousAssignee)})" - } -} - -final case class Patient(id: UuidId[Patient], - status: Patient.Status, - name: FullName[Patient], - dob: LocalDate, - assignee: Option[xyz.driver.core.Id[User]], - previousStatus: Option[Patient.Status], - previousAssignee: Option[xyz.driver.core.Id[User]], - lastActiveUserId: Option[xyz.driver.core.Id[User]], - isUpdateRequired: Boolean, - disease: CancerType, - orderId: xyz.driver.core.Id[TestOrder], - lastUpdate: LocalDateTime) { - - import Patient.Status._ - - if (previousStatus.nonEmpty) { - assert(AllPrevious.contains(previousStatus.get), s"Previous status has invalid value: ${previousStatus.get}") - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala deleted file mode 100644 index e6d466a..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientCriterion.scala +++ /dev/null @@ -1,96 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.entities.labels.{Label, LabelValue} -import xyz.driver.pdsuicommon.domain.{LongId, StringId} -import xyz.driver.pdsuicommon.logging._ - -object PatientCriterion { - implicit def toPhiString(x: PatientCriterion): PhiString = { - import x._ - phi"PatientCriterion(id=$id, patientLabelId=$patientLabelId, trialId=${Unsafe(trialId)}, nctId=$nctId, " + - phi"criterionId=$criterionId, criterionValue=${Unsafe(criterionValue)}, " + - phi"isImplicitMatch=$criterionIsDefining), criterionIsDefining=${Unsafe(criterionIsDefining)}, " + - phi"eligibilityStatus=${Unsafe(eligibilityStatus)}, verifiedEligibilityStatus=${Unsafe(verifiedEligibilityStatus)}, " + - phi"isVerified=${Unsafe(isVerified)}, lastUpdate=${Unsafe(lastUpdate)}, inclusion=${Unsafe(inclusion)}" - } - - /** - * @see https://driverinc.atlassian.net/wiki/display/MTCH/EV+Business+Process - */ - def getEligibilityStatus(criterionValue: Option[Boolean], primaryValue: LabelValue): LabelValue = { - primaryValue match { - case LabelValue.Unknown => LabelValue.Unknown - case LabelValue.Maybe => LabelValue.Maybe - case _ if criterionValue.isEmpty => LabelValue.Maybe - case status => - LabelValue.fromBoolean( - LabelValue.fromBoolean( - criterionValue.getOrElse(throw new IllegalArgumentException("Criterion should not be empty"))) == status - ) - } - } - -} - -/** - * @param eligibilityStatus - a value, that selects an eligibility verifier (EV) - * @param verifiedEligibilityStatus - a copy of eligibilityStatus, when a patient goes to routes curator (RC) - * @param isVerified - is EV selected the eligibilityStatus? - */ -final case class PatientCriterion(id: LongId[PatientCriterion], - patientLabelId: LongId[PatientLabel], - trialId: Long, - nctId: StringId[Trial], - criterionId: LongId[Criterion], - criterionText: String, - criterionValue: Option[Boolean], - criterionIsDefining: Boolean, - eligibilityStatus: LabelValue, - verifiedEligibilityStatus: LabelValue, - isVerified: Boolean, - isVisible: Boolean, - lastUpdate: LocalDateTime, - inclusion: Option[Boolean]) { - import scalaz.syntax.equal._ - def isIneligibleForEv: Boolean = eligibilityStatus === LabelValue.No && isVerified -} - -final case class DraftPatientCriterion(id: LongId[PatientCriterion], - eligibilityStatus: Option[LabelValue], - isVerified: Option[Boolean]) { - def applyTo(orig: PatientCriterion) = { - orig.copy( - eligibilityStatus = eligibilityStatus.getOrElse(orig.eligibilityStatus), - isVerified = isVerified.getOrElse(orig.isVerified) - ) - } -} - -object DraftPatientCriterion { - implicit def toPhiString(x: DraftPatientCriterion): PhiString = { - phi"DraftPatientCriterion(id=${x.id}, eligibilityStatus=${Unsafe(x.eligibilityStatus)}, isVerified=${x.isVerified})" - } -} - -final case class RichPatientCriterion(patientCriterion: PatientCriterion, - labelId: LongId[Label], - armList: List[PatientCriterionArm]) - -object RichPatientCriterion { - implicit def toPhiString(x: RichPatientCriterion): PhiString = { - phi"RichPatientCriterion(patientCriterion=${x.patientCriterion}, labelId=${x.labelId}, arms=${x.armList})" - } -} - -object PatientCriterionArm { - - implicit def toPhiString(x: PatientCriterionArm): PhiString = { - import x._ - phi"PatientCriterionArm(patientCriterionId=$patientCriterionId, armId=$armId, armName=${Unsafe(armName)})" - } - -} - -final case class PatientCriterionArm(patientCriterionId: LongId[PatientCriterion], armId: LongId[Arm], armName: String) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientEligibleTrial.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientEligibleTrial.scala deleted file mode 100644 index 4f62a9e..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientEligibleTrial.scala +++ /dev/null @@ -1,94 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import xyz.driver.entities.labels.LabelValue -import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} -import xyz.driver.pdsuicommon.logging._ - -object PatientTrialArm { - - implicit def toPhiString(x: PatientTrialArm): PhiString = { - import x._ - phi"PatientTrialArm(armId=$armId, trialArmGroupId=$trialArmGroupId)" - } -} - -final case class PatientTrialArm(armId: LongId[Arm], trialArmGroupId: LongId[PatientTrialArmGroup]) - -object PatientEligibleTrial { - implicit def toPhiString(x: PatientEligibleTrial): PhiString = { - import x._ - phi"PatientEligibleTrial(id=$id, patientId=$patientId, trialId=$trialId, hypothesisId=$hypothesisId)" - } -} - -final case class PatientEligibleTrial(id: UuidId[PatientEligibleTrial], - patientId: UuidId[Patient], - trialId: StringId[Trial], - hypothesisId: UuidId[Hypothesis]) - -object PatientTrialArmGroup { - - implicit def toPhiString(x: PatientTrialArmGroup): PhiString = { - import x._ - phi"PatientTrialArmGroup(id=$id, eligibleTrialId=$eligibleTrialId, " + - phi"eligibilityStatus=${Unsafe(eligibilityStatus)}, " + - phi"verifiedEligibilityStatus=${Unsafe(verifiedEligibilityStatus)}, isVerified=$isVerified)" - } - - /** - * @see https://driverinc.atlassian.net/wiki/display/DMPD/EV+Business+Process - */ - def getEligibilityStatusForRc(criterionList: TraversableOnce[PatientCriterion]): LabelValue = { - def isEligible: Boolean = criterionList.forall(_.verifiedEligibilityStatus == LabelValue.Yes) - def isIneligible: Boolean = criterionList.exists(_.verifiedEligibilityStatus == LabelValue.No) - def isUnknown: Boolean = criterionList.forall(_.verifiedEligibilityStatus == LabelValue.Unknown) - - if (isEligible) LabelValue.Yes - else if (isIneligible) LabelValue.No - else if (isUnknown) LabelValue.Unknown - else LabelValue.Maybe - } -} - -final case class PatientTrialArmGroup(id: LongId[PatientTrialArmGroup], - eligibleTrialId: UuidId[PatientEligibleTrial], - eligibilityStatus: LabelValue, - verifiedEligibilityStatus: LabelValue, - isVerified: Boolean) - -object PatientTrialArmGroupView { - - implicit def toPhiString(x: PatientTrialArmGroupView): PhiString = { - import x._ - phi"PatientTrialArmGroupView(id=$id, patientId=$patientId, trialId=$trialId, " + - phi"hypothesisId=$hypothesisId, eligibilityStatus=${Unsafe(eligibilityStatus)}, " + - phi"verifiedEligibilityStatus=${Unsafe(verifiedEligibilityStatus)}, isVerified=$isVerified)" - } -} - -final case class PatientTrialArmGroupView(id: LongId[PatientTrialArmGroup], - patientId: UuidId[Patient], - trialId: StringId[Trial], - hypothesisId: UuidId[Hypothesis], - eligibilityStatus: LabelValue, - verifiedEligibilityStatus: LabelValue, - isVerified: Boolean) { - - def applyTo(trialArmGroup: PatientTrialArmGroup) = { - trialArmGroup.copy( - eligibilityStatus = this.eligibilityStatus, - verifiedEligibilityStatus = this.verifiedEligibilityStatus, - isVerified = this.isVerified - ) - } -} - -final case class RichPatientEligibleTrial(trial: Trial, - group: PatientTrialArmGroupView, - arms: List[PatientCriterionArm]) - -object RichPatientEligibleTrial { - implicit def toPhiString(x: RichPatientEligibleTrial): PhiString = { - phi"RichPatientEligibleTrial(group=${x.group}, trial=${x.trial}, arms=${x.arms})" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientHistory.scala deleted file mode 100644 index bea2c3b..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientHistory.scala +++ /dev/null @@ -1,94 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.{LocalDateTime, ZoneId} - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain.{LongId, UuidId} -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils -import xyz.driver.pdsuidomain.entities.PatientHistory.{Action, State} - -object PatientHistory { - - implicit def toPhiString(x: PatientHistory): PhiString = { - import x._ - phi"PatientHistory(id=$id, executor=${Unsafe(executor)}, patientId=$patientId, " + - phi"state=$state, action=$action, created=$created)" - } - - sealed trait State - object State { - case object Verify extends State - case object Curate extends State - case object Review extends State - case object Flag extends State - - val All: Set[State] = Set[State](Verify, Curate, Review, Flag) - - val fromString: PartialFunction[String, State] = { - case "Verify" => State.Verify - case "Curate" => State.Curate - case "Review" => State.Review - case "Flag" => State.Flag - } - - def stateToString(x: State): String = x match { - case State.Verify => "Verify" - case State.Curate => "Curate" - case State.Review => "Review" - case State.Flag => "Flag" - } - - implicit def toPhiString(x: State): PhiString = - Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - sealed trait Action extends Product with Serializable { - - def oneOf(xs: Action*): Boolean = xs.contains(this) - - def oneOf(xs: Set[Action]): Boolean = xs.contains(this) - - } - - object Action { - case object Start extends Action - case object Submit extends Action - case object Unassign extends Action - case object Resolve extends Action - case object Flag extends Action - case object Archive extends Action - - val All: Set[Action] = - Set[Action](Start, Submit, Unassign, Resolve, Flag, Archive) - - val fromString: PartialFunction[String, Action] = { - case "Start" => Action.Start - case "Submit" => Action.Submit - case "Unassign" => Action.Unassign - case "Resolve" => Action.Resolve - case "Flag" => Action.Flag - case "Archive" => Action.Archive - } - - def actionToString(x: Action): String = x match { - case Action.Start => "Start" - case Action.Submit => "Submit" - case Action.Unassign => "Unassign" - case Action.Resolve => "Resolve" - case Action.Flag => "Flag" - case Action.Archive => "Archive" - } - - implicit def toPhiString(x: Action): PhiString = - Unsafe(Utils.getClassSimpleName(x.getClass)) - } - -} - -final case class PatientHistory(id: LongId[PatientHistory], - executor: xyz.driver.core.Id[User], - patientId: UuidId[Patient], - state: State, - action: Action, - created: LocalDateTime = LocalDateTime.now(ZoneId.of("Z"))) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientHypothesis.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientHypothesis.scala deleted file mode 100644 index 7943fb9..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientHypothesis.scala +++ /dev/null @@ -1,20 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import eu.timepit.refined.api.Refined -import eu.timepit.refined.numeric.NonNegative -import xyz.driver.pdsuicommon.domain.UuidId -import xyz.driver.pdsuicommon.logging._ - -object PatientHypothesis { - implicit def toPhiString(x: PatientHypothesis): PhiString = { - import x._ - phi"PatientHypothesis(id=$id, patientId=$patientId, hypothesisId=$hypothesisId, " + - phi"rationale=${Unsafe(rationale)}, matchedTrials=${Unsafe(matchedTrials)})" - } -} - -final case class PatientHypothesis(id: UuidId[PatientHypothesis], - patientId: UuidId[Patient], - hypothesisId: UuidId[Hypothesis], - rationale: Option[String], - matchedTrials: Long Refined NonNegative) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientIssue.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientIssue.scala deleted file mode 100644 index b60c2ea..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientIssue.scala +++ /dev/null @@ -1,22 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ - -final case class PatientIssue(id: LongId[PatientIssue], - userId: xyz.driver.core.Id[User], - patientId: UuidId[Patient], - lastUpdate: LocalDateTime, - isDraft: Boolean, - text: String, - archiveRequired: Boolean) - -object PatientIssue { - implicit def toPhiString(x: PatientIssue): PhiString = { - import x._ - phi"PatientIssue(id=$id, userId=${Unsafe(userId)}, patientId=$patientId)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala deleted file mode 100644 index 8d64389..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabel.scala +++ /dev/null @@ -1,47 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import xyz.driver.entities.labels.{Label, LabelValue} -import xyz.driver.pdsuicommon.domain.{LongId, UuidId} -import xyz.driver.pdsuicommon.logging._ - -object PatientLabel { - implicit def toPhiString(x: PatientLabel): PhiString = { - import x._ - phi"PatientLabel(id=$id, patientId=$patientId, labelId=$labelId, " + - phi"score=${Unsafe(score)}, primaryValue=${Unsafe(primaryValue)}, " + - phi"verifiedPrimaryValue=${Unsafe(verifiedPrimaryValue)})" - } -} - -final case class PatientLabel(id: LongId[PatientLabel], - patientId: UuidId[Patient], - labelId: LongId[Label], - score: Int, - primaryValue: LabelValue, - verifiedPrimaryValue: LabelValue, - isImplicitMatch: Boolean, - isVisible: Boolean) - -final case class RichPatientLabel(patientLabel: PatientLabel, isVerified: Boolean) - -object RichPatientLabel { - implicit def toPhiString(x: RichPatientLabel): PhiString = { - phi"RichPatientLabel(patientLabel=${x.patientLabel}, isVerified=${x.isVerified})" - } -} - -object PatientLabelEvidence { - implicit def toPhiString(x: PatientLabelEvidence): PhiString = { - import x._ - phi"PatientLabelEvidence(id=$id, patientLabelId=$patientLabelId, value=${Unsafe(value)}, " + - phi"documentId=$documentId, evidenceId=$evidenceId, reportId=$reportId)" - } -} - -final case class PatientLabelEvidence(id: LongId[PatientLabelEvidence], - patientLabelId: LongId[PatientLabel], - value: LabelValue, - evidenceText: String, - reportId: Option[UuidId[DirectReport]], - documentId: Option[LongId[Document]], - evidenceId: Option[LongId[ExtractedData]]) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala deleted file mode 100644 index 6055921..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala +++ /dev/null @@ -1,29 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDate - -import xyz.driver.entities.labels.{Label, LabelValue} -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ - -object PatientLabelEvidenceView { - implicit def toPhiString(x: PatientLabelEvidenceView): PhiString = { - import x._ - phi"PatientLabelEvidenceView(id=$id, value=${Unsafe(value)}, documentId=$documentId, " + - phi"evidenceId=$evidenceId, reportId=$reportId, patientId=$patientId, labelId=$labelId, " + - phi"isImplicitMatch=$isImplicitMatch)" - } -} - -final case class PatientLabelEvidenceView(id: LongId[PatientLabelEvidence], - value: LabelValue, - evidenceText: String, - documentId: Option[LongId[Document]], - evidenceId: Option[LongId[ExtractedData]], - reportId: Option[UuidId[DirectReport]], - documentType: DocumentType, - date: Option[LocalDate], // Document.startDate is optional - providerType: ProviderType, - patientId: UuidId[Patient], - labelId: LongId[Label], - isImplicitMatch: Boolean) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientDocument.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientDocument.scala deleted file mode 100644 index 45cdc4e..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/RawPatientDocument.scala +++ /dev/null @@ -1,30 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDate - -import xyz.driver.core.Id -import xyz.driver.entities.clinic.ClinicalRecord -import xyz.driver.pdsuicommon.domain.{LongId, UuidId} -import xyz.driver.pdsuicommon.logging._ - -final case class RawPatientDocument(disease: String, - patientId: UuidId[Patient], - requestId: Id[ClinicalRecord], - recordId: LongId[MedicalRecord], - recordStatus: MedicalRecord.Status, - documentId: LongId[Document], - documentType: String, - documentProviderType: String, - documentStartDate: LocalDate, - documentStatus: Document.Status) - -object RawPatientDocument { - - implicit def toPhiString(x: RawPatientDocument): PhiString = { - import x._ - phi"RawPatientDocument(disease=${Unsafe(disease)}, patientId=$patientId, requestId=${Unsafe(requestId)}, " + - phi"recordId=$recordId, recordStatus=$recordStatus, documentId=$documentId, " + - phi"documentType=${Unsafe(documentType)}, providerType=${Unsafe(documentProviderType)}, " + - phi"startDate=$documentStartDate, documentStatus=$documentStatus)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala deleted file mode 100644 index 70114de..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArmEligibilityArm.scala +++ /dev/null @@ -1,13 +0,0 @@ -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/SlotArms.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArms.scala deleted file mode 100644 index 932de38..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/SlotArms.scala +++ /dev/null @@ -1,20 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.pdsuicommon.domain.{LongId, StringId} -import xyz.driver.pdsuicommon.logging._ - -final case class SlotArm(id: LongId[SlotArm], - name: String, - originalName: String, - trialId: StringId[Trial], - deleted: Option[LocalDateTime] = None) - -object SlotArm { - - implicit def toPhiString(x: SlotArm): PhiString = { - import x._ - phi"Arm(id=$id, name=${Unsafe(x.name)}, trialId=${Unsafe(x.trialId)})" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Trial.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Trial.scala deleted file mode 100644 index fa5ed61..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/Trial.scala +++ /dev/null @@ -1,126 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils -import xyz.driver.pdsuidomain.entities.Trial.Status - -import scalaz.syntax.equal._ -import scalaz.Scalaz.stringInstance - -sealed trait StudyDesign { - val id: LongId[StudyDesign] - val name: String -} - -object StudyDesign { - - final case object Randomized extends StudyDesign { - val id: LongId[StudyDesign] = LongId[StudyDesign](1) - val name: String = "Randomized" - } - - final case object NonRandomized extends StudyDesign { - val id: LongId[StudyDesign] = LongId[StudyDesign](2) - val name: String = "Non-randomized" - } - - final case object SingleGroupAssignment extends StudyDesign { - val id: LongId[StudyDesign] = LongId[StudyDesign](3) - val name: String = "Single-group assignment" - } - - val All = Seq[StudyDesign]( - Randomized, - NonRandomized, - SingleGroupAssignment - ) - - def fromString(txt: String): Option[StudyDesign] = { - All.find(_.name === txt) - } - - implicit def toPhiString(x: StudyDesign): PhiString = { - import x._ - phi"StudyDesign(id=$id, category=${Unsafe(name)})" - } -} - -object TrialCreationRequest { - - implicit def toPhiString(x: TrialCreationRequest): PhiString = phi"${Unsafe(x.toString)}" -} - -final case class TrialCreationRequest(id: UuidId[Trial], nctId: String, phase: String) - -object Trial { - - sealed trait Status { - def oneOf(xs: Status*): Boolean = xs.contains(this) - def oneOf(xs: Set[Status]): Boolean = xs.contains(this) - } - - object Status { - case object New extends Status - case object ReviewSummary extends Status - case object Summarized extends Status - case object PendingUpdate extends Status - case object Update extends Status - case object ReviewCriteria extends Status - case object Done extends Status - case object Flagged extends Status - case object Archived extends Status - - val All: Set[Status] = Set[Status]( - New, - ReviewSummary, - Summarized, - PendingUpdate, - Update, - ReviewCriteria, - Done, - Flagged, - Archived - ) - - val AllPrevious: Set[Status] = Set[Status](New, ReviewSummary, Summarized, ReviewCriteria) - - implicit def toPhiString(x: Status): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - implicit def toPhiString(x: Trial): PhiString = { - import x._ - phi"Trial(id=$id, externalId=$externalId, status=$status, previousStatus=$previousStatus, " + - phi"lastActiveUserId=${Unsafe(lastActiveUserId)}, assignee=${Unsafe(assignee)}, previousAssignee=${Unsafe(previousAssignee)})" - } - - final case class Locations(locations: List[String]) -} - -final case class Trial(id: StringId[Trial], - externalId: UuidId[Trial], - status: Status, - assignee: Option[xyz.driver.core.Id[User]], - previousStatus: Option[Status], - previousAssignee: Option[xyz.driver.core.Id[User]], - lastActiveUserId: Option[xyz.driver.core.Id[User]], - lastUpdate: LocalDateTime, - phase: String, - hypothesisId: Option[UuidId[Hypothesis]], - studyDesignId: Option[LongId[StudyDesign]], - originalStudyDesign: Option[String], - isPartner: Boolean, - overview: Option[String], - overviewTemplate: String, - isUpdated: Boolean, - title: String, - originalTitle: String) { - import Trial.Status._ - - if (previousStatus.nonEmpty) { - assert(AllPrevious.contains(previousStatus.get), s"Previous status has invalid value: ${previousStatus.get}") - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/TrialHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/TrialHistory.scala deleted file mode 100644 index 9210742..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/TrialHistory.scala +++ /dev/null @@ -1,100 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.{LocalDateTime, ZoneId} - -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils -import TrialHistory._ -import xyz.driver.core.auth.User - -object TrialHistory { - - implicit def toPhiString(x: TrialHistory): PhiString = { - import x._ - phi"TrialHistory(id=$id, executor=${Unsafe(executor)}, trialId=$trialId, state=$state, action=$action, created=$created)" - } - - sealed trait State - object State { - case object Summarize extends State - case object Criteriarize extends State - case object Review extends State - case object ReviewSummary extends State - case object ReviewCriteria extends State - case object Flag extends State - - val All: Set[State] = Set[State](Summarize, Criteriarize, Review, ReviewSummary, ReviewCriteria, Flag) - - val fromString: PartialFunction[String, State] = { - case "Summarize" => State.Summarize - case "Criteriarize" => State.Criteriarize - case "Review" => State.Review - case "ReviewSummary" => State.ReviewSummary - case "ReviewCriteria" => State.ReviewCriteria - case "Flag" => State.Flag - } - - def stateToString(x: State): String = x match { - case State.Summarize => "Summarize" - case State.Criteriarize => "Criteriarize" - case State.Review => "Review" - case State.ReviewSummary => "ReviewSummary" - case State.ReviewCriteria => "ReviewCriteria" - case State.Flag => "Flag" - } - - implicit def toPhiString(x: State): PhiString = - Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - sealed trait Action extends Product with Serializable { - - def oneOf(xs: Action*): Boolean = xs.contains(this) - - def oneOf(xs: Set[Action]): Boolean = xs.contains(this) - - } - - object Action { - case object Start extends Action - case object Submit extends Action - case object Unassign extends Action - case object Resolve extends Action - case object Flag extends Action - case object Archive extends Action - - val All: Set[Action] = - Set[Action](Start, Submit, Unassign, Resolve, Flag, Archive) - - val fromString: PartialFunction[String, Action] = { - case "Start" => Action.Start - case "Submit" => Action.Submit - case "Unassign" => Action.Unassign - case "Resolve" => Action.Resolve - case "Flag" => Action.Flag - case "Archive" => Action.Archive - } - - def actionToString(x: Action): String = x match { - case Action.Start => "Start" - case Action.Submit => "Submit" - case Action.Unassign => "Unassign" - case Action.Resolve => "Resolve" - case Action.Flag => "Flag" - case Action.Archive => "Archive" - } - - implicit def toPhiString(x: Action): PhiString = - Unsafe(Utils.getClassSimpleName(x.getClass)) - } - -} - -final case class TrialHistory(id: LongId[TrialHistory], - executor: xyz.driver.core.Id[User], - trialId: StringId[Trial], - state: State, - action: Action, - created: LocalDateTime = LocalDateTime.now(ZoneId.of("Z")), - comment: Option[String] = None) diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/TrialIssue.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/TrialIssue.scala deleted file mode 100644 index f69e681..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/TrialIssue.scala +++ /dev/null @@ -1,24 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.LocalDateTime - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain.{LongId, StringId} -import xyz.driver.pdsuicommon.logging._ - -final case class TrialIssue(id: LongId[TrialIssue], - userId: xyz.driver.core.Id[User], - trialId: StringId[Trial], - lastUpdate: LocalDateTime, - isDraft: Boolean, - text: String, - evidence: String, - archiveRequired: Boolean, - meta: String) - -object TrialIssue { - implicit def toPhiString(x: TrialIssue): PhiString = { - import x._ - phi"TrialIssue(id=$id, userId=${Unsafe(userId)}, trialId=$trialId)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/UserHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/UserHistory.scala deleted file mode 100644 index 6299ed4..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/UserHistory.scala +++ /dev/null @@ -1,146 +0,0 @@ -package xyz.driver.pdsuidomain.entities - -import java.time.{LocalDateTime, ZoneId} - -import xyz.driver.core.auth.User -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuicommon.utils.Utils - -final case class UserHistory(id: LongId[UserHistory], - executor: xyz.driver.core.Id[User], - recordId: Option[LongId[MedicalRecord]] = None, - documentId: Option[LongId[Document]] = None, - trialId: Option[StringId[Trial]] = None, - patientId: Option[UuidId[Patient]] = None, - state: UserHistory.State, - action: UserHistory.Action, - created: LocalDateTime = LocalDateTime.now(ZoneId.of("Z"))) - -object UserHistory { - - def forDocument(executor: xyz.driver.core.Id[User], - documentId: LongId[Document], - state: UserHistory.State, - action: UserHistory.Action): UserHistory = UserHistory( - id = LongId(0L), - executor = executor, - documentId = Some(documentId), - state = state, - action = action - ) - - def forRecord(executor: xyz.driver.core.Id[User], - recordId: LongId[MedicalRecord], - state: UserHistory.State, - action: UserHistory.Action): UserHistory = UserHistory( - id = LongId(0L), - executor = executor, - recordId = Some(recordId), - state = state, - action = action - ) - - def forPatient(executor: xyz.driver.core.Id[User], - patientId: UuidId[Patient], - state: UserHistory.State, - action: UserHistory.Action): UserHistory = UserHistory( - id = LongId(0L), - executor = executor, - patientId = Some(patientId), - state = state, - action = action - ) - - sealed trait State extends Product with Serializable { - - def oneOf(xs: State*): Boolean = xs.contains(this) - - def oneOf(xs: Set[State]): Boolean = xs.contains(this) - } - - object State { - case object Clean extends State - case object Organize extends State - case object Extract extends State - case object Summarize extends State - case object Criteriarize extends State - case object Verify extends State - case object Curate extends State - case object Review extends State - case object Flag extends State - - val All: Set[State] = Set[State](Clean, Organize, Extract, Summarize, Criteriarize, Verify, Curate, Review, Flag) - - val fromString: PartialFunction[String, State] = { - case "Clean" => State.Clean - case "Organize" => State.Organize - case "Extract" => State.Extract - case "Summarize" => State.Summarize - case "Criteriarize" => State.Criteriarize - case "Verify" => State.Verify - case "Curate" => State.Curate - case "Review" => State.Review - case "Flag" => State.Flag - } - - def stateToString(x: State): String = x match { - case State.Clean => "Clean" - case State.Organize => "Organize" - case State.Extract => "Extract" - case State.Summarize => "Summarize" - case State.Criteriarize => "Criteriarize" - case State.Verify => "Verify" - case State.Curate => "Curate" - case State.Review => "Review" - case State.Flag => "Flag" - } - - implicit def toPhiString(x: State): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - sealed trait Action extends Product with Serializable { - - def oneOf(xs: Action*): Boolean = xs.contains(this) - - def oneOf(xs: Set[Action]): Boolean = xs.contains(this) - } - - object Action { - case object Start extends Action - case object Submit extends Action - case object Unassign extends Action - case object Resolve extends Action - case object Flag extends Action - case object Archive extends Action - - val All: Set[Action] = Set[Action](Start, Submit, Unassign, Resolve, Flag, Archive) - - val fromString: PartialFunction[String, Action] = { - case "Start" => Action.Start - case "Submit" => Action.Submit - case "Unassign" => Action.Unassign - case "Resolve" => Action.Resolve - case "Flag" => Action.Flag - case "Archive" => Action.Archive - } - - def actionToString(x: Action): String = x match { - case Action.Start => "Start" - case Action.Submit => "Submit" - case Action.Unassign => "Unassign" - case Action.Resolve => "Resolve" - case Action.Flag => "Flag" - case Action.Archive => "Archive" - } - - implicit def toPhiString(x: Action): PhiString = Unsafe(Utils.getClassSimpleName(x.getClass)) - } - - implicit def toPhiString(x: UserHistory): PhiString = { - import x._ - phi"UserHistory(id=$id, executor=${Unsafe(executor)}, recordId=$recordId, " + - phi"documentId=$documentId, trialId=$trialId, patientId=$patientId, " + - phi"state=$state, action=$action, created=$created)" - } -} diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/eligibility.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/eligibility.scala deleted file mode 100644 index 9362a0c..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/eligibility.scala +++ /dev/null @@ -1,68 +0,0 @@ -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) - - final case class EligibleTrial(nctId: String, arms: Seq[EligibleArm]) - final case class EligibleArm(title: String, criteria: Seq[EligibleCriterion]) - final case class EligibleCriterion(text: String, eligibilityStatus: LabelValue) - -} 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 957e607..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabel.scala +++ /dev/null @@ -1,15 +0,0 @@ -package xyz.driver.pdsuidomain.entities.export.patient - -import xyz.driver.entities.labels.Label -import xyz.driver.pdsuicommon.domain.LongId -import xyz.driver.pdsuicommon.logging._ - -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)" - } -} 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 6472a6b..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidence.scala +++ /dev/null @@ -1,21 +0,0 @@ -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 - -final case class ExportPatientLabelEvidence(id: LongId[ExtractedData], - value: LabelValue, - evidenceText: String, - document: ExportPatientLabelEvidenceDocument) - -object ExportPatientLabelEvidence { - - implicit def toPhiString(x: ExportPatientLabelEvidence): PhiString = { - import x._ - phi"ExportPatientLabelEvidence(id=${Unsafe(id)}, value=${Unsafe(value)}, " + - phi"evidenceText=${Unsafe(evidenceText)}, document=$document)" - } - -} 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 1b3a6d6..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientLabelEvidenceDocument.scala +++ /dev/null @@ -1,23 +0,0 @@ -package xyz.driver.pdsuidomain.entities.export.patient - -import java.time.LocalDate - -import xyz.driver.entities.clinic.ClinicalRecord -import xyz.driver.pdsuicommon.domain.LongId -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuidomain.entities._ - -final case class ExportPatientLabelEvidenceDocument(documentId: LongId[Document], - requestId: xyz.driver.core.Id[ClinicalRecord], - documentType: DocumentType, - providerType: ProviderType, - date: LocalDate) - -object ExportPatientLabelEvidenceDocument extends PhiLogging { - - implicit def toPhiString(x: ExportPatientLabelEvidenceDocument): PhiString = { - import x._ - phi"ExportPatientLabelEvidenceDocument(documentId=$documentId, requestId=${Unsafe(requestId)}, " + - phi"documentType=${Unsafe(documentType)}, providerType=${Unsafe(providerType)}, date=$date)" - } -} 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 8fb2660..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/patient/ExportPatientWithLabels.scala +++ /dev/null @@ -1,17 +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 - -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)" - } -} 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 fbac0df..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.EligibilityArm - -final case class ExportTrialArm(armId: LongId[EligibilityArm], armName: String, diseaseList: Seq[String]) - -object ExportTrialArm { - - implicit def toPhiString(x: ExportTrialArm): PhiString = { - import x._ - phi"ExportTrialArm(armId=$armId, armName=${Unsafe(armName)}, diseaseList=${Unsafe(diseaseList)})" - } -} 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 98bd084..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialLabelCriterion.scala +++ /dev/null @@ -1,24 +0,0 @@ -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.{Criterion, EligibilityArm} - -final case class ExportTrialLabelCriterion(criterionId: LongId[Criterion], - value: Option[Boolean], - labelId: LongId[Label], - armIds: Set[LongId[EligibilityArm]], - criteria: String, - isCompound: Boolean, - isDefining: Boolean, - inclusion: Option[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), inclusion=${Unsafe(inclusion)}" - } -} 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 3681945..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/export/trial/ExportTrialWithLabels.scala +++ /dev/null @@ -1,23 +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.Trial - -final case class ExportTrialWithLabels(nctId: StringId[Trial], - trialId: UuidId[Trial], - 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}, " + - phi"lastReviewed=$lastReviewed, labelVersion=${Unsafe(labelVersion)}, arms=$arms, criteria=$criteria)" - } -} |