aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
diff options
context:
space:
mode:
authorVlad Uspensky <v.uspenskiy@icloud.com>2017-09-29 12:42:35 -0700
committerGitHub <noreply@github.com>2017-09-29 12:42:35 -0700
commit46b354b6a49c0843fefc5794f2351f52b98102bd (patch)
tree20e9a10e87f0859c5c0342f3eee45d04aa214c64 /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
parentdeba20326e3269fee3ef51f8e6841f17453b4155 (diff)
parent642f98c2ddd8af6c83d3de5a51c643ba93b23f96 (diff)
downloadrest-query-46b354b6a49c0843fefc5794f2351f52b98102bd.tar.gz
rest-query-46b354b6a49c0843fefc5794f2351f52b98102bd.tar.bz2
rest-query-46b354b6a49c0843fefc5794f2351f52b98102bd.zip
Merge pull request #32 from drivergroup/PDSUI-rep-fixtures
Implemented generators of entities for ReP; Implemented json objects for swagger model
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.scala69
1 files changed, 69 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..c2909f3
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala
@@ -0,0 +1,69 @@
+package xyz.driver.pdsuidomain.fakes.entities.rep
+
+import xyz.driver.core.generators._
+import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
+import xyz.driver.pdsuidomain.entities._
+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 nextDocumentType(documentTypeId: LongId[DocumentType] = nextLongId): DocumentType = {
+ DocumentType(
+ documentTypeId,
+ nextString()
+ )
+ }
+
+ def nextProviderType(providerTypeId: LongId[ProviderType] = nextLongId): ProviderType = {
+ ProviderType(
+ providerTypeId,
+ nextString()
+ )
+ }
+
+ def nextExportPatientLabelEvidenceDocument(documentId: LongId[Document]): ExportPatientLabelEvidenceDocument = {
+ ExportPatientLabelEvidenceDocument(
+ documentId = documentId,
+ requestId = RecordRequestId(nextUuid()),
+ documentType = nextDocumentType(),
+ providerType = nextProviderType(),
+ 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))
+ )
+ }
+
+}