aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities/eligibility.scala
blob: 9362a0c8a25a49a8bea56603521d7ca6e1b234e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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)

}