aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2017-09-28 14:32:21 +0700
committerAleksandr <ognelisar@gmail.com>2017-09-28 14:32:21 +0700
commit1f569ac1a31f88334c25976d94e7c495a7bbde80 (patch)
tree584162d344db1ea767adb72dc6a67164a1e89e68 /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
parentd8e71e0a9ee7db58032384d059403bc227a35138 (diff)
downloadrest-query-1f569ac1a31f88334c25976d94e7c495a7bbde80.tar.gz
rest-query-1f569ac1a31f88334c25976d94e7c495a7bbde80.tar.bz2
rest-query-1f569ac1a31f88334c25976d94e7c495a7bbde80.zip
Implemented all generator for REP's entities
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
new file mode 100644
index 0000000..4a4164a
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
@@ -0,0 +1,55 @@
+package xyz.driver.pdsuidomain.fakes.entities.rep
+
+import xyz.driver.core.generators._
+import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
+import xyz.driver.pdsuidomain.entities.{Document, ExtractedData, Label, RecordRequestId}
+import xyz.driver.pdsuidomain.entities.export.patient.{
+ExportPatientLabel,
+ExportPatientLabelEvidence,
+ExportPatientLabelEvidenceDocument,
+ExportPatientWithLabels
+}
+import xyz.driver.pdsuidomain.fakes.entities.common.{nextLocalDate, nextLongId}
+
+object ExportPatientGen {
+ private val maxItemsInCollectionNumber = 3
+
+ def nextExportPatientLabelEvidenceDocument(documentId: LongId[Document]): ExportPatientLabelEvidenceDocument = {
+ ExportPatientLabelEvidenceDocument(
+ documentId = documentId,
+ requestId = RecordRequestId(nextUuid()),
+ documentType = nextString(),
+ providerType = nextString(),
+ date = nextLocalDate
+ )
+ }
+
+ def nextExportPatientLabelEvidence(documentId: LongId[Document]): ExportPatientLabelEvidence = {
+ ExportPatientLabelEvidence(
+ id = nextLongId[ExtractedData],
+ value = Common.nextFuzzyValue(),
+ evidenceText = nextString(),
+ document = nextExportPatientLabelEvidenceDocument(documentId)
+ )
+ }
+
+ def nextExportPatientLabel(documentId: LongId[Document]): ExportPatientLabel = {
+ ExportPatientLabel(
+ id = nextLongId[Label],
+ evidences = List.fill(
+ nextInt(maxItemsInCollectionNumber, minValue = 0)
+ )(nextExportPatientLabelEvidence(documentId))
+ )
+ }
+
+ def nextExportPatientWithLabels(documentId: LongId[Document]): ExportPatientWithLabels = {
+ ExportPatientWithLabels(
+ patientId = UuidId[xyz.driver.pdsuidomain.entities.Patient](nextUuid()),
+ labelVersion = scala.util.Random.nextLong(),
+ labels = List.fill(
+ nextInt(maxItemsInCollectionNumber, minValue = 0)
+ )(nextExportPatientLabel(documentId))
+ )
+ }
+
+}