aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala
blob: 12eff616c9dbc4036aa8bbc0eeb75561fff9176a (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
69
70
71
72
73
74
75
76
package xyz.driver.pdsuidomain.fakes.entities

import xyz.driver.core.generators
import xyz.driver.entities.clinic.ClinicalRecord
import xyz.driver.entities.labels.Label
import xyz.driver.fakes
import xyz.driver.pdsuidomain.entities.export.patient._
import xyz.driver.pdsuidomain.entities.export.trial._
import xyz.driver.pdsuidomain.entities._

object export {
  import common._
  import xyz.driver.core.generators._

  def nextExportTrialArm(): ExportTrialArm =
    ExportTrialArm(armId = nextLongId[EligibilityArm],
                   armName = nextString(100),
                   diseaseList = listOf(nextString(100)))

  def nextExportTrialLabelCriterion(): ExportTrialLabelCriterion =
    ExportTrialLabelCriterion(
      criterionId = nextLongId[Criterion],
      value = nextOption[Boolean](nextBoolean()),
      labelId = nextLongId[Label],
      armIds = setOf(nextLongId[EligibilityArm]),
      criteria = nextString(100),
      isCompound = nextBoolean(),
      isDefining = nextBoolean(),
      inclusion = nextOption(nextBoolean())
    )

  def nextExportTrialWithLabels(): ExportTrialWithLabels =
    ExportTrialWithLabels(
      nctId = nextStringId[Trial],
      trialId = nextUuidId[Trial],
      lastReviewed = nextLocalDateTime,
      labelVersion = nextInt(100).toLong,
      arms = listOf(nextExportTrialArm()),
      criteria = listOf(nextExportTrialLabelCriterion())
    )

  def nextExportPatientLabelEvidenceDocument(): ExportPatientLabelEvidenceDocument = {
    ExportPatientLabelEvidenceDocument(
      documentId = nextLongId[Document],
      requestId = generators.nextId[ClinicalRecord](),
      documentType = nextDocumentType(),
      providerType = nextProviderType(),
      date = nextLocalDate
    )
  }

  def nextExportPatientLabelEvidence(): ExportPatientLabelEvidence = {
    ExportPatientLabelEvidence(
      id = nextLongId[ExtractedData],
      value = fakes.entities.labels.nextLabelValue(),
      evidenceText = nextString(),
      document = nextExportPatientLabelEvidenceDocument()
    )
  }

  def nextExportPatientLabel(): ExportPatientLabel = {
    ExportPatientLabel(
      id = nextLongId[Label],
      evidences = List.fill(nextInt(10))(nextExportPatientLabelEvidence())
    )
  }

  def nextExportPatientWithLabels(): ExportPatientWithLabels = {
    ExportPatientWithLabels(
      patientId = nextUuidId[Patient],
      labelVersion = nextInt(Int.MaxValue).toLong,
      labels = List.fill(nextInt(10))(nextExportPatientLabel())
    )
  }

}