diff options
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala | 4 | ||||
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala | 129 |
2 files changed, 130 insertions, 3 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala index 279ea38..d2a648c 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala @@ -105,7 +105,7 @@ object recordprocessing { def nextMedicalRecord(): MedicalRecord = MedicalRecord( id = nextLongId[MedicalRecord], status = nextMedicalRecordStatus(), - previousStatus = None, + previousStatus = nextOption(generators.oneOf[MedicalRecord.Status](MedicalRecord.Status.AllPrevious)), assignee = nextOption(nextStringId), previousAssignee = nextOption(nextStringId), lastActiveUserId = nextOption(nextStringId), @@ -168,7 +168,7 @@ object recordprocessing { Document( id = nextLongId[Document], status = nextDocumentStatus(), - previousStatus = None, + previousStatus = nextOption(generators.oneOf[Document.Status](Document.Status.AllPrevious)), assignee = nextOption(nextStringId[User]), previousAssignee = nextOption(nextStringId[User]), lastActiveUserId = nextOption(nextStringId[User]), diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala index 35aa5ef..b0ca136 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala @@ -4,6 +4,7 @@ import xyz.driver.entities.labels.Label import xyz.driver.fakes import xyz.driver.pdsuicommon.domain.{LongId, StringId, User} import xyz.driver.pdsuidomain.entities._ +import xyz.driver.pdsuidomain.formats.json.sprayformats.ListResponse import xyz.driver.pdsuidomain.services.PatientCriterionService.{DraftPatientCriterion, RichPatientCriterion} import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial import xyz.driver.pdsuidomain.services.PatientHypothesisService.RichPatientHypothesis @@ -27,7 +28,7 @@ object treatmentmatching { name = nextFullName[Patient], dob = nextLocalDate, assignee = generators.nextOption(nextStringId[User]), - previousStatus = generators.nextOption(nextPatientStatus), + previousStatus = generators.nextOption(generators.oneOf[Patient.Status](Patient.Status.AllPrevious)), previousAssignee = generators.nextOption(nextStringId[User]), lastActiveUserId = generators.nextOption(nextStringId[User]), isUpdateRequired = generators.nextBoolean(), @@ -164,4 +165,130 @@ object treatmentmatching { created = nextLocalDateTime ) + def nextPatientListResponse(): ListResponse[Patient] = { + val xs: Seq[Patient] = Seq.fill(3)(nextPatient()) + 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) + ) + ) + } + + def nextRichPatientLabelListResponse(): ListResponse[RichPatientLabel] = { + val xs: Seq[RichPatientLabel] = Seq.fill(3)(nextRichPatientLabel()) + 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) + ) + ) + } + + def nextPatientLabelListResponse(): ListResponse[PatientLabel] = { + val xs: Seq[PatientLabel] = Seq.fill(3)(nextPatientLabel()) + 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) + ) + ) + } + + def nextRichPatientCriterionListResponse(): ListResponse[RichPatientCriterion] = { + val xs: Seq[RichPatientCriterion] = Seq.fill(3)(nextRichPatientCriterion()) + 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) + ) + ) + } + + def nextRichPatientEligibleTrialListResponse(): ListResponse[RichPatientEligibleTrial] = { + val xs: Seq[RichPatientEligibleTrial] = Seq.fill(3)(nextRichPatientEligibleTrial()) + 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) + ) + ) + } + + def nextRichPatientHypothesisListResponse(): ListResponse[RichPatientHypothesis] = { + val xs: Seq[RichPatientHypothesis] = Seq.fill(3)(nextRichPatientHypothesis()) + 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) + ) + ) + } + + def nextPatientLabelEvidenceViewListResponse(): ListResponse[PatientLabelEvidenceView] = { + val xs: Seq[PatientLabelEvidenceView] = Seq.fill(3)(nextPatientLabelEvidenceView()) + 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) + ) + ) + } + + def nextPatientIssuesListResponse(): ListResponse[PatientIssue] = { + val xs: Seq[PatientIssue] = Seq.fill(3)(nextPatientIssue()) + 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) + ) + ) + } + + def nextPatientHistoryListResponse(): ListResponse[PatientHistory] = { + val xs: Seq[PatientHistory] = Seq.fill(3)(nextPatientHistory()) + 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) + ) + ) + } + } |