aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes/entities')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala123
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/eligibility.scala72
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala76
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala322
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala1
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala233
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala239
7 files changed, 0 insertions, 1066 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
deleted file mode 100644
index 2aaa251..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
+++ /dev/null
@@ -1,123 +0,0 @@
-package xyz.driver.pdsuidomain.fakes.entities
-
-import java.time.{LocalDate, LocalDateTime, LocalTime}
-
-import xyz.driver.core.generators._
-import xyz.driver.entities.common.FullName
-import xyz.driver.entities.patient.CancerType
-import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue
-import xyz.driver.pdsuicommon.domain.{LongId, StringId, TextJson, UuidId}
-import xyz.driver.pdsuidomain.ListResponse
-import xyz.driver.pdsuidomain.entities._
-
-import scala.util.Random
-
-object common {
- import xyz.driver.core.generators
-
- def nextUuidId[T]: UuidId[T] = UuidId[T](generators.nextUuid())
-
- def nextLongId[T]: LongId[T] = LongId[T](generators.nextInt(Int.MaxValue).toLong)
-
- def nextStringId[T]: StringId[T] = StringId[T](generators.nextString(maxLength = 20))
-
- def nextTrialStatus: Trial.Status = generators.oneOf[Trial.Status](Trial.Status.All)
-
- def nextPreviousTrialStatus: Trial.Status = generators.oneOf[Trial.Status](Trial.Status.AllPrevious)
-
- def nextLocalDateTime: LocalDateTime = LocalDateTime.of(nextLocalDate, LocalTime.MIDNIGHT)
-
- def nextLocalDate: LocalDate = LocalDate.of(
- 1970 + Random.nextInt(68),
- 1 + Random.nextInt(12),
- 1 + Random.nextInt(28) // all months have at least 28 days
- )
-
- def nextTrialAction = generators.oneOf[TrialHistory.Action](TrialHistory.Action.All)
-
- def nextTrialState = generators.oneOf[TrialHistory.State](TrialHistory.State.All)
-
- def genBoundedRange[T](from: T, to: T)(implicit ord: Ordering[T]): (T, T) = {
- if (ord.compare(from, to) > 0) {
- to -> from
- } else {
- from -> to
- }
- }
-
- def genBoundedRangeOption[T](from: T, to: T)(implicit ord: Ordering[T]): (Option[T], Option[T]) = {
- val ranges = nextOption(from).map { left =>
- val range = genBoundedRange(left, to)
- range._1 -> nextOption(range._2)
- }
-
- ranges.map(_._1) -> ranges.flatMap(_._2)
- }
-
- def nextStartAndEndPagesOption: (Option[Double], Option[Double]) =
- genBoundedRangeOption[Double](nextDouble(), nextDouble())
-
- def nextStartAndEndPages: (Double, Double) =
- genBoundedRange(nextDouble(), nextDouble())
-
- def nextPatientStatus: Patient.Status = generators.oneOf[Patient.Status](Patient.Status.All)
-
- def nextFullName[T]: FullName[T] = FullName(
- firstName = generators.nextName[T](10),
- middleName = generators.nextName[T](10),
- lastName = generators.nextName[T](10)
- )
-
- def nextCancerType: CancerType =
- generators.oneOf[CancerType](CancerType.Breast, CancerType.Lung, CancerType.Prostate)
-
- private val maxAttemptsNumber = 100
-
- def nextBridgeUploadQueueItem(): BridgeUploadQueue.Item = {
- BridgeUploadQueue.Item(
- kind = nextString(),
- tag = nextString(),
- created = nextLocalDateTime,
- attempts = nextInt(maxAttemptsNumber, minValue = 0),
- nextAttempt = nextLocalDateTime,
- completed = nextBoolean(),
- dependencyKind = nextOption(nextString()),
- dependencyTag = nextOption(nextString())
- )
- }
-
- def nextBridgeUploadQueueItemListResponse(): ListResponse[BridgeUploadQueue.Item] = {
- val xs: Seq[BridgeUploadQueue.Item] = Seq.fill(3)(nextBridgeUploadQueueItem())
- nextListResponse(xs)
- }
-
- def nextDocumentType(): DocumentType = generators.oneOf[DocumentType](DocumentType.All: _*)
-
- def nextProviderType(): ProviderType = generators.oneOf[ProviderType](ProviderType.All: _*)
-
- def nextDocumentTypeListResponse(): ListResponse[DocumentType] = {
- val xs: Seq[DocumentType] = Seq.fill(3)(nextDocumentType())
- nextListResponse(xs)
- }
-
- def nextProviderTypeListResponse(): ListResponse[ProviderType] = {
- val xs: Seq[ProviderType] = Seq.fill(3)(nextProviderType())
- nextListResponse(xs)
- }
-
- def nextTextJson[T](obj: T): TextJson[T] = TextJson(obj)
-
- def nextListResponse[T](xs: Seq[T]): ListResponse[T] = {
- val pageSize = generators.nextInt(xs.size, 1)
- ListResponse(
- items = xs,
- meta = ListResponse.Meta(
- itemsCount = xs.size,
- pageNumber = generators.nextInt(xs.size / pageSize),
- pageSize = pageSize,
- lastUpdate = generators.nextOption(nextLocalDateTime)
- )
- )
- }
-
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/eligibility.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/eligibility.scala
deleted file mode 100644
index 1796fe6..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/eligibility.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-package xyz.driver.pdsuidomain.fakes.entities
-
-import xyz.driver.core.generators
-import xyz.driver.entities.clinic.{ClinicalRecord, TestOrder}
-import xyz.driver.entities.patient.{CancerType, Patient}
-import xyz.driver.entities.report.Report
-import xyz.driver.fakes
-import xyz.driver.pdsuidomain.entities.eligibility._
-
-object eligibility {
- import xyz.driver.core.generators._
-
- def nextMolecularEvidenceDocument(): MolecularEvidenceDocument =
- MolecularEvidenceDocument(
- documentType = xyz.driver.pdsuidomain.fakes.entities.common.nextDocumentType(),
- providerType = xyz.driver.pdsuidomain.fakes.entities.common.nextProviderType(),
- providerName = nextOption(nextString(100)),
- date = nextOption(nextDate()),
- reportId = nextId[Report](),
- reportType = fakes.entities.assays.nextAssayType(),
- isDriverDocument = nextBoolean()
- )
-
- def nextClinicalEvidenceDocument(): ClinicalEvidenceDocument =
- ClinicalEvidenceDocument(
- documentType = xyz.driver.pdsuidomain.fakes.entities.common.nextDocumentType(),
- providerType = xyz.driver.pdsuidomain.fakes.entities.common.nextProviderType(),
- providerName = nextOption(nextString(100)),
- date = nextOption(nextDate()),
- documentId = nextId[ClinicalEvidenceDocument](),
- requestId = nextId[ClinicalRecord](),
- isDriverDocument = nextBoolean()
- )
-
- def nextEvidenceDocument(): EvidenceDocument =
- oneOf[EvidenceDocument](nextMolecularEvidenceDocument(),
- nextClinicalEvidenceDocument(),
- nextClinicalEvidenceDocument()) // For more clinical documents
-
- def nextEvidence(): Evidence =
- Evidence(
- evidenceId = Option(nextId[Evidence]()),
- evidenceText = nextString(100),
- labelValue = xyz.driver.fakes.entities.labels.nextLabelValue(),
- nextEvidenceDocument(),
- isPrimaryValue = nextOption(nextBoolean())
- )
-
- def nextLabelEvidence(): LabelEvidence =
- LabelEvidence(label = fakes.entities.labels.nextLabel(), evidence = Seq.empty)
-
- def nextLabelMismatchRank(): LabelMismatchRank =
- LabelMismatchRank(
- label = fakes.entities.labels.nextLabel(),
- score = nextInt(100),
- trials = seqOf(xyz.driver.pdsuidomain.fakes.entities.export.nextExportTrialWithLabels()),
- evidence = seqOf(nextEvidence())
- )
-
- def nextMismatchRankedLabels(): MismatchRankedLabels =
- MismatchRankedLabels(data = seqOf(nextLabelMismatchRank()), labelVersion = nextInt(100))
-
- def nextMatchedPatient(): MatchedPatient =
- MatchedPatient(
- patientId = nextId[Patient](),
- name = fakes.entities.common.nextFullName[Patient](),
- birthDate = nextDate(),
- orderId = nextId[TestOrder](),
- disease = generators.oneOf[CancerType](CancerType.Breast, CancerType.Lung, CancerType.Prostate),
- patientDataStatus = fakes.entities.process.nextProcessStepExecutionStatus()
- )
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala
deleted file mode 100644
index 12eff61..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala
+++ /dev/null
@@ -1,76 +0,0 @@
-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())
- )
- }
-
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala
deleted file mode 100644
index d3d76b8..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala
+++ /dev/null
@@ -1,322 +0,0 @@
-package xyz.driver.pdsuidomain.fakes.entities
-
-import java.time.LocalDate
-
-import xyz.driver.core.auth.User
-import xyz.driver.core.generators
-import xyz.driver.core.generators._
-import xyz.driver.entities.assays.PatientCase
-import xyz.driver.entities.clinic.ClinicalRecord
-import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue}
-import xyz.driver.pdsuicommon.domain.{LongId, TextJson}
-import xyz.driver.pdsuidomain.ListResponse
-import xyz.driver.pdsuidomain.entities.ExtractedData.Meta
-import xyz.driver.pdsuidomain.entities._
-import xyz.driver.pdsuidomain.fakes.entities.common._
-import xyz.driver.pdsuidomain.services.ExtractedDataService.RichExtractedData
-
-object recordprocessing {
-
- private val maxItemsInCollectionNumber: Int = 50
- private val maxPageNumber = 100
- private val maxIndexNumber = 100
- private val maxOffsetNumber = 10
-
- implicit private class LocalDateOrdering(localData: LocalDate) extends Ordered[LocalDate] {
- override def compare(that: LocalDate): Int = {
- this.localData.compareTo(that)
- }
- }
-
- implicit private class TextLayerPositionOrdering(textLayerPosition: ExtractedData.Meta.TextLayerPosition)
- extends Ordered[ExtractedData.Meta.TextLayerPosition] {
- override def compare(that: Meta.TextLayerPosition): Int = {
- if (this.textLayerPosition.page < that.page) -1
- else if (this.textLayerPosition.page > that.page) 1
- else if (this.textLayerPosition.index < that.index) -1
- else if (this.textLayerPosition.index > that.index) 1
- else if (this.textLayerPosition.offset < that.offset) -1
- else if (this.textLayerPosition.offset > that.offset) 1
- else 0
- }
- }
-
- private def nextDates(): (Option[LocalDate], Option[LocalDate]) =
- genBoundedRangeOption[LocalDate](nextLocalDate, nextLocalDate)
-
- private val medicalRecordMeta: Set[() => MedicalRecord.Meta] = {
- Set(
- () => nextMedicalRecordMetaReorder(),
- () => nextMedicalRecordMetaDuplicate(),
- () => nextMedicalRecordMetaRotation()
- )
- }
-
- def nextMedicalRecordMeta(count: Int): List[MedicalRecord.Meta] =
- List.fill(count)(nextMedicalRecordMeta())
-
- def nextMedicalRecordMetaJson(): TextJson[List[MedicalRecord.Meta]] =
- TextJson(nextMedicalRecordMeta(nextInt(maxItemsInCollectionNumber)))
-
- private def nextDocumentList(count: Int): List[Document] =
- List.fill(count)(nextDocument())
-
- def nextDocumentList(recordId: LongId[MedicalRecord]): TextJson[List[Document]] = {
- val documents = nextDocumentList(
- nextInt(maxItemsInCollectionNumber)
- )
- TextJson(documents.map(_.copy(recordId = recordId)))
- }
-
- def nextMedicalRecordStatus(): MedicalRecord.Status =
- generators.oneOf[MedicalRecord.Status](MedicalRecord.Status.All)
-
- def nextMedicalRecordHistoryState(): MedicalRecordHistory.State =
- generators.oneOf[MedicalRecordHistory.State](MedicalRecordHistory.State.All)
-
- def nextMedicalRecordHistoryAction(): MedicalRecordHistory.Action =
- generators.oneOf[MedicalRecordHistory.Action](MedicalRecordHistory.Action.All)
-
- def nextMedicalRecordMetaReorder(): MedicalRecord.Meta.Reorder = {
- val itemsNumber = maxItemsInCollectionNumber
- val items = scala.util.Random.shuffle(Seq.tabulate(itemsNumber)(identity))
-
- MedicalRecord.Meta.Reorder(items)
- }
-
- def nextMedicalRecordMetaDuplicate(): MedicalRecord.Meta.Duplicate = {
- val startPageGen = nextInt(maxPageNumber)
- val endPageGen = nextInt(maxPageNumber, startPageGen)
-
- MedicalRecord.Meta.Duplicate(
- startPage = startPageGen.toDouble,
- endPage = endPageGen.toDouble,
- startOriginalPage = startPageGen.toDouble,
- endOriginalPage = nextOption(endPageGen.toDouble)
- )
- }
-
- def nextMedicalRecordMetaRotation(): MedicalRecord.Meta.Rotation = {
- val items = Array.tabulate(maxItemsInCollectionNumber)(index => nextString() -> index).toMap
-
- MedicalRecord.Meta.Rotation(items = items)
- }
-
- def nextMedicalRecordMeta(): MedicalRecord.Meta = generators.oneOf(medicalRecordMeta)()
-
- def nextMedicalRecord(): MedicalRecord = MedicalRecord(
- id = nextLongId[MedicalRecord],
- status = nextMedicalRecordStatus(),
- previousStatus = nextOption(generators.oneOf[MedicalRecord.Status](MedicalRecord.Status.AllPrevious)),
- assignee = nextOption(generators.nextId[User]),
- previousAssignee = nextOption(generators.nextId[User]),
- lastActiveUserId = nextOption(generators.nextId[User]),
- patientId = nextUuidId[Patient],
- requestId = generators.nextId[ClinicalRecord](),
- disease = generators.nextString(),
- caseId = nextOption(generators.nextId[PatientCase]()),
- physician = nextOption(generators.nextString()),
- meta = nextOption(nextMedicalRecordMetaJson()),
- lastUpdate = nextLocalDateTime,
- totalPages = nextInt(10)
- )
-
- def nextMedicalRecordHistory(): MedicalRecordHistory = MedicalRecordHistory(
- id = nextLongId[MedicalRecordHistory],
- executor = generators.nextId[User],
- recordId = nextLongId[MedicalRecord],
- state = nextMedicalRecordHistoryState(),
- action = nextMedicalRecordHistoryAction(),
- created = nextLocalDateTime
- )
-
- def nextMedicalRecordIssue(): MedicalRecordIssue = {
- val (startPage, endPage) = nextStartAndEndPagesOption
-
- MedicalRecordIssue(
- id = nextLongId[MedicalRecordIssue],
- userId = generators.nextId[User],
- recordId = nextLongId[MedicalRecord],
- startPage = startPage,
- endPage = endPage,
- lastUpdate = nextLocalDateTime,
- isDraft = nextBoolean(),
- text = nextString(),
- archiveRequired = nextBoolean()
- )
- }
-
- def nextDocumentStatus(): Document.Status = generators.oneOf[Document.Status](Document.Status.All)
-
- def nextDocumentRequiredType(): Document.RequiredType =
- generators.oneOf[Document.RequiredType](Document.RequiredType.All)
-
- def nextDocumentHistoryState(): DocumentHistory.State =
- generators.oneOf[DocumentHistory.State](DocumentHistory.State.All)
-
- def nextDocumentHistoryAction(): DocumentHistory.Action =
- generators.oneOf[DocumentHistory.Action](DocumentHistory.Action.All)
-
- def nextDocumentMeta(): Document.Meta = {
- val (startPage, endPage) = nextStartAndEndPages
- Document.Meta(startPage, endPage)
- }
-
- def nextDocumentMetaJson(): TextJson[Document.Meta] = nextTextJson(nextDocumentMeta())
-
- def nextDocument(): Document = {
- val (startDate, endDate) = nextDates()
-
- Document(
- id = nextLongId[Document],
- status = nextDocumentStatus(),
- previousStatus = nextOption(generators.oneOf[Document.Status](Document.Status.AllPrevious)),
- assignee = nextOption(generators.nextId[User]),
- previousAssignee = nextOption(generators.nextId[User]),
- lastActiveUserId = nextOption(generators.nextId[User]),
- recordId = nextLongId[MedicalRecord],
- physician = nextOption(nextString()),
- typeId = nextOption(nextLongId[DocumentType]),
- providerName = nextOption(nextString()),
- providerTypeId = nextOption(nextLongId[ProviderType]),
- requiredType = nextOption(nextDocumentRequiredType()),
- institutionName = nextOption(nextString()),
- meta = nextOption(nextDocumentMetaJson()),
- startDate = startDate,
- endDate = endDate,
- lastUpdate = nextLocalDateTime,
- labelVersion = generators.nextInt(100)
- )
- }
-
- def nextDocumentIssue(): DocumentIssue = {
- val (startPage, endPage) = nextStartAndEndPagesOption
- DocumentIssue(
- id = nextLongId[DocumentIssue],
- userId = generators.nextId[User],
- documentId = nextLongId[Document],
- startPage = startPage,
- endPage = endPage,
- lastUpdate = nextLocalDateTime,
- isDraft = nextBoolean(),
- text = nextString(),
- archiveRequired = nextBoolean()
- )
- }
-
- def nextDocumentHistory(): DocumentHistory = DocumentHistory(
- id = nextLongId[DocumentHistory],
- executor = generators.nextId[User],
- documentId = nextLongId[Document],
- state = nextDocumentHistoryState(),
- action = nextDocumentHistoryAction(),
- created = nextLocalDateTime
- )
-
- def nextExtractedDataMetaKeyword(): Meta.Keyword = {
- ExtractedData.Meta.Keyword(
- page = nextInt(maxPageNumber),
- pageRatio = nextOption(nextDouble()),
- index = nextInt(maxIndexNumber),
- sortIndex = nextString()
- )
- }
-
- def nextExtractedDataMetaTextLayerPosition(): Meta.TextLayerPosition = {
- ExtractedData.Meta.TextLayerPosition(
- page = nextInt(maxPageNumber),
- index = nextInt(maxIndexNumber),
- offset = nextInt(maxOffsetNumber)
- )
- }
-
- def nextExtractedDataMetaEvidence(): Meta.Evidence = {
- val (start, end) =
- genBoundedRange[ExtractedData.Meta.TextLayerPosition](
- nextExtractedDataMetaTextLayerPosition(),
- nextExtractedDataMetaTextLayerPosition()
- )
-
- ExtractedData.Meta.Evidence(
- pageRatio = nextDouble(),
- start = start,
- end = end
- )
- }
-
- def nextExtractedDataMeta(): Meta = {
- ExtractedData.Meta(
- nextOption(nextExtractedDataMetaKeyword()),
- nextOption(nextExtractedDataMetaEvidence())
- )
- }
-
- def nextExtractedDataMetaJson(): TextJson[Meta] =
- nextTextJson(nextExtractedDataMeta())
-
- def nextExtractedData(): ExtractedData = {
- ExtractedData(
- id = nextLongId[ExtractedData],
- documentId = nextLongId[Document],
- keywordId = nextOption(nextLongId[Keyword]),
- evidenceText = nextOption(nextString()),
- meta = nextOption(nextExtractedDataMetaJson())
- )
- }
-
- def nextExtractedDataLabel(): ExtractedDataLabel = {
- ExtractedDataLabel(
- id = nextLongId[ExtractedDataLabel],
- dataId = nextLongId[ExtractedData],
- labelId = nextOption(nextLongId[Label]),
- categoryId = nextOption(nextLongId[LabelCategory]),
- value = nextOption(generators.oneOf[LabelValue](LabelValue.Yes, LabelValue.No, LabelValue.Maybe))
- )
- }
-
- def nextRichExtractedData(): RichExtractedData = {
- val extractedData = nextExtractedData()
- RichExtractedData(
- extractedData = extractedData,
- labels = List.fill(
- nextInt(maxItemsInCollectionNumber)
- )(nextExtractedDataLabel())
- )
- }
-
- def nextMedicalRecordListResponse(): ListResponse[MedicalRecord] = {
- val xs: Seq[MedicalRecord] = Seq.fill(3)(nextMedicalRecord())
- nextListResponse(xs)
- }
-
- def nextMedicalRecordIssueListResponse(): ListResponse[MedicalRecordIssue] = {
- val xs: Seq[MedicalRecordIssue] = Seq.fill(3)(nextMedicalRecordIssue())
- nextListResponse(xs)
- }
-
- def nextMedicalRecordHistoryListResponse(): ListResponse[MedicalRecordHistory] = {
- val xs: Seq[MedicalRecordHistory] = Seq.fill(3)(nextMedicalRecordHistory())
- nextListResponse(xs)
- }
-
- def nextDocumentListResponse(): ListResponse[Document] = {
- val xs: Seq[Document] = Seq.fill(3)(nextDocument())
- nextListResponse(xs)
- }
-
- def nextDocumentIssueListResponse(): ListResponse[DocumentIssue] = {
- val xs: Seq[DocumentIssue] = Seq.fill(3)(nextDocumentIssue())
- nextListResponse(xs)
- }
-
- def nextDocumentHistoryListResponse(): ListResponse[DocumentHistory] = {
- val xs: Seq[DocumentHistory] = Seq.fill(3)(nextDocumentHistory())
- nextListResponse(xs)
- }
-
- def nextRichExtractedDataListResponse(): ListResponse[RichExtractedData] = {
- val xs: Seq[RichExtractedData] = Seq.fill(3)(nextRichExtractedData())
- nextListResponse(xs)
- }
-
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
deleted file mode 100644
index 8b13789..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala
deleted file mode 100644
index 190add6..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala
+++ /dev/null
@@ -1,233 +0,0 @@
-package xyz.driver.pdsuidomain.fakes.entities
-
-import eu.timepit.refined.numeric.NonNegative
-import xyz.driver.entities.labels.Label
-import xyz.driver.fakes
-import xyz.driver.pdsuicommon.domain.{LongId, StringId}
-import xyz.driver.pdsuidomain.ListResponse
-import xyz.driver.pdsuidomain.entities._
-import eu.timepit.refined.{refineMV, refineV}
-import xyz.driver.core.auth.User
-
-object treatmentmatching {
- import common._
- import xyz.driver.core.generators
-
- final case class DraftPatientCriterionList(list: List[DraftPatientCriterion])
- object DraftPatientCriterionList {
- import spray.json._
- import xyz.driver.pdsuidomain.formats.json.patientcriterion._
-
- implicit val draftPatientCriterionListFormat: RootJsonFormat[DraftPatientCriterionList] =
- new RootJsonFormat[DraftPatientCriterionList] {
- override def write(obj: DraftPatientCriterionList): JsValue = {
- JsArray(obj.list.map(_.toJson).toVector)
- }
-
- override def read(json: JsValue): DraftPatientCriterionList = json match {
- case j: JsObject =>
- DraftPatientCriterionList(draftPatientCriterionListReader.read(j))
-
- case _ => deserializationError(s"Expected List of DraftPatientCriterion json object, but got $json")
- }
- }
- }
-
- def nextPatientAction: PatientHistory.Action =
- generators.oneOf[PatientHistory.Action](PatientHistory.Action.All)
-
- def nextPatientState: PatientHistory.State =
- generators.oneOf[PatientHistory.State](PatientHistory.State.All)
-
- def nextPatient(): Patient = Patient(
- id = nextUuidId[Patient],
- status = nextPatientStatus,
- name = nextFullName[Patient],
- dob = nextLocalDate,
- assignee = generators.nextOption(generators.nextId[User]),
- previousStatus = generators.nextOption(generators.oneOf[Patient.Status](Patient.Status.AllPrevious)),
- previousAssignee = generators.nextOption(generators.nextId[User]),
- lastActiveUserId = generators.nextOption(generators.nextId[User]),
- isUpdateRequired = generators.nextBoolean(),
- disease = nextCancerType,
- orderId = generators.nextId(),
- lastUpdate = nextLocalDateTime
- )
-
- def nextPatientLabel(): PatientLabel = PatientLabel(
- id = nextLongId[PatientLabel],
- patientId = nextUuidId[Patient],
- labelId = nextLongId[Label],
- score = generators.nextInt(100),
- primaryValue = fakes.entities.labels.nextLabelValue(),
- verifiedPrimaryValue = fakes.entities.labels.nextLabelValue(),
- isImplicitMatch = generators.nextBoolean(),
- isVisible = generators.nextBoolean()
- )
-
- def nextRichPatientLabel(): RichPatientLabel = RichPatientLabel(
- patientLabel = nextPatientLabel(),
- isVerified = generators.nextBoolean()
- )
-
- def nextPatientCriterion(): PatientCriterion = PatientCriterion(
- id = nextLongId[PatientCriterion],
- patientLabelId = nextLongId[PatientLabel],
- trialId = generators.nextInt(Int.MaxValue).toLong,
- nctId = nextStringId[Trial],
- criterionId = nextLongId[Criterion],
- criterionText = generators.nextString(),
- criterionValue = generators.nextOption(generators.nextBoolean()),
- criterionIsDefining = generators.nextBoolean(),
- eligibilityStatus = fakes.entities.labels.nextLabelValue(),
- verifiedEligibilityStatus = fakes.entities.labels.nextLabelValue(),
- isVerified = generators.nextBoolean(),
- isVisible = generators.nextBoolean(),
- lastUpdate = nextLocalDateTime,
- inclusion = generators.nextOption(generators.nextBoolean())
- )
-
- def nextDraftPatientCriterion(): DraftPatientCriterion = DraftPatientCriterion(
- id = nextLongId[PatientCriterion],
- eligibilityStatus = generators.nextOption(fakes.entities.labels.nextLabelValue()),
- isVerified = generators.nextOption(generators.nextBoolean())
- )
-
- def nextDraftPatientCriterionList(): DraftPatientCriterionList = {
- DraftPatientCriterionList(List.fill(3)(nextDraftPatientCriterion()))
- }
-
- def nextPatientCriterionArm(criterionId: LongId[PatientCriterion]): PatientCriterionArm = PatientCriterionArm(
- patientCriterionId = criterionId,
- armId = nextLongId[Arm],
- armName = generators.nextString()
- )
-
- def nextRichPatientCriterion(): RichPatientCriterion = {
- val patientCriterion = nextPatientCriterion()
- RichPatientCriterion(
- patientCriterion = patientCriterion,
- labelId = nextLongId[Label],
- armList = List(
- nextPatientCriterionArm(patientCriterion.id),
- nextPatientCriterionArm(patientCriterion.id),
- nextPatientCriterionArm(patientCriterion.id)
- )
- )
- }
-
- def nextPatientLabelEvidenceView(): PatientLabelEvidenceView = PatientLabelEvidenceView(
- id = nextLongId[PatientLabelEvidence],
- value = fakes.entities.labels.nextLabelValue(),
- evidenceText = generators.nextString(),
- documentId = generators.nextOption(nextLongId[Document]),
- evidenceId = generators.nextOption(nextLongId[ExtractedData]),
- reportId = generators.nextOption(nextUuidId[DirectReport]),
- documentType = nextDocumentType(),
- date = generators.nextOption(nextLocalDate),
- providerType = nextProviderType(),
- patientId = nextUuidId[Patient],
- labelId = nextLongId[Label],
- isImplicitMatch = generators.nextBoolean()
- )
-
- def nextPatientTrialArmGroupView(trialId: StringId[Trial]): PatientTrialArmGroupView = PatientTrialArmGroupView(
- id = nextLongId[PatientTrialArmGroup],
- patientId = nextUuidId[Patient],
- trialId = trialId,
- hypothesisId = nextUuidId[Hypothesis],
- eligibilityStatus = fakes.entities.labels.nextLabelValue(),
- verifiedEligibilityStatus = fakes.entities.labels.nextLabelValue(),
- isVerified = generators.nextBoolean()
- )
-
- def nextRichPatientEligibleTrial(): RichPatientEligibleTrial = {
- val patientCriterionId = nextLongId[PatientCriterion]
- val trial = trialcuration.nextTrial()
- RichPatientEligibleTrial(
- trial = trial,
- group = nextPatientTrialArmGroupView(trial.id),
- arms = List(
- nextPatientCriterionArm(patientCriterionId),
- nextPatientCriterionArm(patientCriterionId),
- nextPatientCriterionArm(patientCriterionId)
- )
- )
- }
-
- def nextPatientHypothesis(): PatientHypothesis = PatientHypothesis(
- id = nextUuidId[PatientHypothesis],
- patientId = nextUuidId[Patient],
- hypothesisId = nextUuidId[Hypothesis],
- rationale = Option(generators.nextString()),
- matchedTrials = refineV[NonNegative](generators.nextInt(Int.MaxValue).toLong) match {
- case Left(_) => refineMV[NonNegative](0)
- case Right(nonNegative) => nonNegative
- }
- )
-
- def nextPatientIssue(): PatientIssue = PatientIssue(
- id = nextLongId[PatientIssue],
- userId = generators.nextId[User],
- patientId = nextUuidId[Patient],
- lastUpdate = nextLocalDateTime,
- isDraft = generators.nextBoolean(),
- text = generators.nextString(),
- archiveRequired = generators.nextBoolean()
- )
-
- def nextPatientHistory(): PatientHistory = PatientHistory(
- id = nextLongId[PatientHistory],
- executor = generators.nextId[User],
- patientId = nextUuidId[Patient],
- state = nextPatientState,
- action = nextPatientAction,
- created = nextLocalDateTime
- )
-
- def nextPatientListResponse(): ListResponse[Patient] = {
- val xs: Seq[Patient] = Seq.fill(3)(nextPatient())
- nextListResponse(xs)
- }
-
- def nextRichPatientLabelListResponse(): ListResponse[RichPatientLabel] = {
- val xs: Seq[RichPatientLabel] = Seq.fill(3)(nextRichPatientLabel())
- nextListResponse(xs)
- }
-
- def nextPatientLabelListResponse(): ListResponse[PatientLabel] = {
- val xs: Seq[PatientLabel] = Seq.fill(3)(nextPatientLabel())
- nextListResponse(xs)
- }
-
- def nextRichPatientCriterionListResponse(): ListResponse[RichPatientCriterion] = {
- val xs: Seq[RichPatientCriterion] = Seq.fill(3)(nextRichPatientCriterion())
- nextListResponse(xs)
- }
-
- def nextRichPatientEligibleTrialListResponse(): ListResponse[RichPatientEligibleTrial] = {
- val xs: Seq[RichPatientEligibleTrial] = Seq.fill(3)(nextRichPatientEligibleTrial())
- nextListResponse(xs)
- }
-
- def nextPatientHypothesisListResponse(): ListResponse[PatientHypothesis] = {
- val xs: Seq[PatientHypothesis] = Seq.fill(3)(nextPatientHypothesis())
- nextListResponse(xs)
- }
-
- def nextPatientLabelEvidenceViewListResponse(): ListResponse[PatientLabelEvidenceView] = {
- val xs: Seq[PatientLabelEvidenceView] = Seq.fill(3)(nextPatientLabelEvidenceView())
- nextListResponse(xs)
- }
-
- def nextPatientIssuesListResponse(): ListResponse[PatientIssue] = {
- val xs: Seq[PatientIssue] = Seq.fill(3)(nextPatientIssue())
- nextListResponse(xs)
- }
-
- def nextPatientHistoryListResponse(): ListResponse[PatientHistory] = {
- val xs: Seq[PatientHistory] = Seq.fill(3)(nextPatientHistory())
- nextListResponse(xs)
- }
-
-}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala
deleted file mode 100644
index 925a019..0000000
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala
+++ /dev/null
@@ -1,239 +0,0 @@
-package xyz.driver.pdsuidomain.fakes.entities
-
-import xyz.driver.core.auth.User
-import xyz.driver.core.generators._
-import xyz.driver.entities.labels.{Label, LabelCategory}
-import xyz.driver.pdsuicommon.domain.LongId
-import xyz.driver.pdsuidomain.ListResponse
-import xyz.driver.pdsuidomain.entities._
-import xyz.driver.pdsuidomain.services.CriterionService.RichCriterion
-
-object trialcuration {
-
- import common._
- import xyz.driver.core.generators
- import xyz.driver.pdsuidomain.entities.InterventionType._
-
- private val maxItemsInCollectionNumber: Int = 5
-
- def nextTrial(): Trial = Trial(
- id = nextStringId[Trial],
- externalId = nextUuidId[Trial],
- status = nextTrialStatus,
- assignee = Option(generators.nextId[User]),
- previousStatus = Option(nextPreviousTrialStatus),
- previousAssignee = Option(generators.nextId[User]),
- lastActiveUserId = Option(generators.nextId[User]),
- lastUpdate = nextLocalDateTime,
- phase = generators.nextString(),
- hypothesisId = Option(nextUuidId[Hypothesis]),
- studyDesignId = Option(nextLongId[StudyDesign]),
- originalStudyDesign = Option(generators.nextString()),
- isPartner = generators.nextBoolean(),
- overview = Option(generators.nextString()),
- overviewTemplate = generators.nextString(),
- isUpdated = generators.nextBoolean(),
- title = generators.nextString(),
- originalTitle = generators.nextString()
- )
-
- def nextArm(): Arm = Arm(
- id = nextLongId[Arm],
- name = generators.nextString(),
- originalName = generators.nextString(),
- trialId = nextStringId[Trial],
- deleted = Option(nextLocalDateTime)
- )
-
- def nextCriterion(): Criterion = Criterion(
- id = nextLongId[Criterion],
- trialId = nextStringId[Trial],
- text = Option(generators.nextString()),
- isCompound = generators.nextBoolean(),
- meta = generators.nextString(),
- inclusion = Option(generators.nextBoolean())
- )
-
- def nextCriterionLabel(criterionId: LongId[Criterion]): CriterionLabel = CriterionLabel(
- id = nextLongId[CriterionLabel],
- labelId = Option(nextLongId[Label]),
- criterionId = criterionId,
- categoryId = Option(nextLongId[LabelCategory]),
- value = Option(generators.nextBoolean()),
- isDefining = generators.nextBoolean()
- )
-
- def nextRichCriterion(): RichCriterion = {
- val criterion = nextCriterion()
- RichCriterion(
- criterion = criterion,
- armIds = Seq(nextLongId[EligibilityArm], nextLongId[EligibilityArm]),
- labels = Seq(
- nextCriterionLabel(criterion.id),
- nextCriterionLabel(criterion.id)
- )
- )
- }
-
- def nextIntervention(): Intervention = Intervention(
- id = nextLongId[Intervention],
- trialId = nextStringId[Trial],
- name = generators.nextString(),
- originalName = generators.nextString(),
- typeId = Option(nextLongId[InterventionType]),
- originalType = Option(generators.nextString()),
- dosage = generators.nextString(),
- originalDosage = generators.nextString(),
- isActive = generators.nextBoolean(),
- deliveryMethod = Option(generators.nextString())
- )
-
- def nextInterventionArm(interventionId: LongId[Intervention]): InterventionArm = InterventionArm(
- interventionId = interventionId,
- armId = nextLongId[SlotArm]
- )
-
- def nextInterventionWithArms(): InterventionWithArms = {
- val intervention = nextIntervention()
- InterventionWithArms(
- intervention = intervention,
- arms = List(
- nextInterventionArm(intervention.id),
- nextInterventionArm(intervention.id),
- nextInterventionArm(intervention.id)
- )
- )
- }
-
- def nextTrialIssue(): TrialIssue = TrialIssue(
- id = nextLongId[TrialIssue],
- userId = generators.nextId[User],
- trialId = nextStringId[Trial],
- lastUpdate = nextLocalDateTime,
- isDraft = generators.nextBoolean(),
- text = generators.nextString(),
- evidence = generators.nextString(),
- archiveRequired = generators.nextBoolean(),
- meta = generators.nextString()
- )
-
- def nextTrialHistory(): TrialHistory = TrialHistory(
- id = nextLongId[TrialHistory],
- executor = generators.nextId[User],
- trialId = nextStringId[Trial],
- state = nextTrialState,
- action = nextTrialAction,
- created = nextLocalDateTime,
- comment = generators.nextOption(generators.nextString())
- )
-
- def nextHypothesis(): Hypothesis = Hypothesis(
- id = nextUuidId[Hypothesis],
- name = generators.nextString(),
- treatmentType = generators.nextString(),
- description = generators.nextString()
- )
-
- def nextStudyDesign(): StudyDesign = generators.oneOf[StudyDesign](StudyDesign.All: _*)
-
- def nextInterventionType(): InterventionType = generators.oneOf[InterventionType](
- Chemotherapy,
- TargetedTherapy,
- Immunotherapy,
- HormoneTherapy,
- Other,
- Radiation,
- SurgeryProcedure
- )
-
- def nextEligibilityArm(): EligibilityArm = EligibilityArm(
- id = nextLongId,
- name = nextString(),
- originalName = nextString(),
- trialId = nextStringId
- )
-
- def nextEligibilityArmDisease(): EligibilityArmDisease = EligibilityArmDisease(
- eligibilityArmId = nextLongId,
- disease = nextCancerType
- )
-
- private def nextEligibilityArmDiseaseCollection(count: Int): Seq[EligibilityArmDisease] =
- Seq.fill(count)(nextEligibilityArmDisease())
-
- def nextEligibilityArmWithDiseases(): EligibilityArmWithDiseases = {
- val entity = nextEligibilityArm()
- val id = entity.id
- val collection = nextEligibilityArmDiseaseCollection(
- nextInt(maxItemsInCollectionNumber, minValue = 0)
- ).map(_.copy(eligibilityArmId = id))
-
- EligibilityArmWithDiseases(
- entity,
- collection
- )
- }
-
- def nextSlotArm(): SlotArm = SlotArm(
- id = nextLongId,
- name = nextString(),
- originalName = nextString(),
- trialId = nextStringId
- )
-
- def nextTrialListResponse(): ListResponse[Trial] = {
- val xs: Seq[Trial] = Seq.fill(3)(nextTrial())
- nextListResponse(xs)
- }
-
- def nextTrialIssueListResponse(): ListResponse[TrialIssue] = {
- val xs: Seq[TrialIssue] = Seq.fill(3)(nextTrialIssue())
- nextListResponse(xs)
- }
-
- def nextTrialHistoryListResponse(): ListResponse[TrialHistory] = {
- val xs: Seq[TrialHistory] = Seq.fill(3)(nextTrialHistory())
- nextListResponse(xs)
- }
-
- def nextArmListResponse(): ListResponse[Arm] = {
- val xs: Seq[Arm] = Seq.fill(3)(nextArm())
- nextListResponse(xs)
- }
-
- def nextInterventionWithArmsListResponse(): ListResponse[InterventionWithArms] = {
- val xs: Seq[InterventionWithArms] = Seq.fill(3)(nextInterventionWithArms())
- nextListResponse(xs)
- }
-
- def nextEligibilityArmWithDiseasesListResponse(): ListResponse[EligibilityArmWithDiseases] = {
- val xs: Seq[EligibilityArmWithDiseases] = Seq.fill(3)(nextEligibilityArmWithDiseases())
- nextListResponse(xs)
- }
-
- def nextSlotArmListResponse(): ListResponse[SlotArm] = {
- val xs: Seq[SlotArm] = Seq.fill(3)(nextSlotArm())
- nextListResponse(xs)
- }
-
- def nextRichCriterionListResponse(): ListResponse[RichCriterion] = {
- val xs: Seq[RichCriterion] = Seq.fill(3)(nextRichCriterion())
- nextListResponse(xs)
- }
-
- def nextInterventionTypeListResponse(): ListResponse[InterventionType] = {
- val xs: Seq[InterventionType] = Seq.fill(3)(nextInterventionType())
- nextListResponse(xs)
- }
-
- def nextStudyDesignListResponse(): ListResponse[StudyDesign] = {
- val xs: Seq[StudyDesign] = Seq.fill(3)(nextStudyDesign())
- nextListResponse(xs)
- }
-
- def nextHypothesesListResponse(): ListResponse[Hypothesis] = {
- val xs: Seq[Hypothesis] = Seq.fill(3)(nextHypothesis())
- nextListResponse(xs)
- }
-
-}