diff options
author | Vlad Uspensky <v.uspenskiy@icloud.com> | 2017-11-02 20:40:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 20:40:31 -0700 |
commit | aedb5274932db81a32f9d89938636df114dc9a44 (patch) | |
tree | 13a0a8a51f477a4fce2bb8f4d5cd8248de54a73b /src/main/scala/xyz/driver/pdsuidomain/fakes | |
parent | 4583af5213b9f7b1e8a06f58321813556763f2d1 (diff) | |
parent | 5515c834853cbe3ce60460a4819a94805cfe24f7 (diff) | |
download | rest-query-aedb5274932db81a32f9d89938636df114dc9a44.tar.gz rest-query-aedb5274932db81a32f9d89938636df114dc9a44.tar.bz2 rest-query-aedb5274932db81a32f9d89938636df114dc9a44.zip |
Merge pull request #59 from drivergroup/common-contextsv0.13.1
Using common request contexts and user objects
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes')
4 files changed, 37 insertions, 39 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala index 33da392..12eff61 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/export.scala @@ -1,13 +1,10 @@ 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.{ - ExportPatientLabel, - ExportPatientLabelEvidence, - ExportPatientLabelEvidenceDocument, - ExportPatientWithLabels -} +import xyz.driver.pdsuidomain.entities.export.patient._ import xyz.driver.pdsuidomain.entities.export.trial._ import xyz.driver.pdsuidomain.entities._ @@ -45,7 +42,7 @@ object export { def nextExportPatientLabelEvidenceDocument(): ExportPatientLabelEvidenceDocument = { ExportPatientLabelEvidenceDocument( documentId = nextLongId[Document], - requestId = recordprocessing.nextRecordRequestId(), + requestId = generators.nextId[ClinicalRecord](), documentType = nextDocumentType(), providerType = nextProviderType(), date = nextLocalDate 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 3a018fa..5903dc8 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/recordprocessing.scala @@ -2,10 +2,13 @@ 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, User} +import xyz.driver.pdsuicommon.domain.{LongId, TextJson} import xyz.driver.pdsuidomain.ListResponse import xyz.driver.pdsuidomain.entities.ExtractedData.Meta import xyz.driver.pdsuidomain.entities._ @@ -101,19 +104,17 @@ object recordprocessing { def nextMedicalRecordMeta(): MedicalRecord.Meta = generators.oneOf(medicalRecordMeta)() - def nextRecordRequestId(): RecordRequestId = RecordRequestId(generators.nextUuid()) - def nextMedicalRecord(): MedicalRecord = MedicalRecord( id = nextLongId[MedicalRecord], status = nextMedicalRecordStatus(), previousStatus = nextOption(generators.oneOf[MedicalRecord.Status](MedicalRecord.Status.AllPrevious)), - assignee = nextOption(nextStringId), - previousAssignee = nextOption(nextStringId), - lastActiveUserId = nextOption(nextStringId), - patientId = nextUuidId, - requestId = nextRecordRequestId(), + 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(CaseId(generators.nextString())), + caseId = nextOption(generators.nextId[PatientCase]()), physician = nextOption(generators.nextString()), meta = nextOption(nextMedicalRecordMetaJson()), lastUpdate = nextLocalDateTime, @@ -122,7 +123,7 @@ object recordprocessing { def nextMedicalRecordHistory(): MedicalRecordHistory = MedicalRecordHistory( id = nextLongId[MedicalRecordHistory], - executor = nextStringId[User], + executor = generators.nextId[User], recordId = nextLongId[MedicalRecord], state = nextMedicalRecordHistoryState(), action = nextMedicalRecordHistoryAction(), @@ -134,7 +135,7 @@ object recordprocessing { MedicalRecordIssue( id = nextLongId[MedicalRecordIssue], - userId = nextStringId[User], + userId = generators.nextId[User], recordId = nextLongId[MedicalRecord], startPage = startPage, endPage = endPage, @@ -170,9 +171,9 @@ object recordprocessing { id = nextLongId[Document], status = nextDocumentStatus(), previousStatus = nextOption(generators.oneOf[Document.Status](Document.Status.AllPrevious)), - assignee = nextOption(nextStringId[User]), - previousAssignee = nextOption(nextStringId[User]), - lastActiveUserId = nextOption(nextStringId[User]), + 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]), @@ -192,7 +193,7 @@ object recordprocessing { val (startPage, endPage) = nextStartAndEndPagesOption DocumentIssue( id = nextLongId[DocumentIssue], - userId = nextStringId[User], + userId = generators.nextId[User], documentId = nextLongId[Document], startPage = startPage, endPage = endPage, @@ -205,7 +206,7 @@ object recordprocessing { def nextDocumentHistory(): DocumentHistory = DocumentHistory( id = nextLongId[DocumentHistory], - executor = nextStringId[User], + executor = generators.nextId[User], documentId = nextLongId[Document], state = nextDocumentHistoryState(), action = nextDocumentHistoryAction(), 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 f350f0f..441c1db 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/treatmentmatching.scala @@ -3,13 +3,14 @@ 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, User} +import xyz.driver.pdsuicommon.domain.{LongId, StringId} import xyz.driver.pdsuidomain.ListResponse import xyz.driver.pdsuidomain.entities._ import xyz.driver.pdsuidomain.services.PatientCriterionService.{DraftPatientCriterion, RichPatientCriterion} import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel -import eu.timepit.refined.{refineV, refineMV} +import eu.timepit.refined.{refineMV, refineV} +import xyz.driver.core.auth.User object treatmentmatching { import common._ @@ -35,8 +36,6 @@ object treatmentmatching { } } - def nextPatientOrderId: PatientOrderId = PatientOrderId(generators.nextUuid()) - def nextPatientAction: PatientHistory.Action = generators.oneOf[PatientHistory.Action](PatientHistory.Action.All) @@ -48,13 +47,13 @@ object treatmentmatching { status = nextPatientStatus, name = nextFullName[Patient], dob = nextLocalDate, - assignee = generators.nextOption(nextStringId[User]), + assignee = generators.nextOption(generators.nextId[User]), previousStatus = generators.nextOption(generators.oneOf[Patient.Status](Patient.Status.AllPrevious)), - previousAssignee = generators.nextOption(nextStringId[User]), - lastActiveUserId = generators.nextOption(nextStringId[User]), + previousAssignee = generators.nextOption(generators.nextId[User]), + lastActiveUserId = generators.nextOption(generators.nextId[User]), isUpdateRequired = generators.nextBoolean(), disease = nextCancerType, - orderId = nextPatientOrderId, + orderId = generators.nextId(), lastUpdate = nextLocalDateTime ) @@ -172,7 +171,7 @@ object treatmentmatching { def nextPatientIssue(): PatientIssue = PatientIssue( id = nextLongId[PatientIssue], - userId = nextStringId[User], + userId = generators.nextId[User], patientId = nextUuidId[Patient], lastUpdate = nextLocalDateTime, isDraft = generators.nextBoolean(), @@ -182,7 +181,7 @@ object treatmentmatching { def nextPatientHistory(): PatientHistory = PatientHistory( id = nextLongId[PatientHistory], - executor = nextStringId[User], + executor = generators.nextId[User], patientId = nextUuidId[Patient], state = nextPatientState, action = nextPatientAction, diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala index eeec577..94bc27a 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/trialcuration.scala @@ -1,8 +1,9 @@ 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, User} +import xyz.driver.pdsuicommon.domain.LongId import xyz.driver.pdsuidomain.ListResponse import xyz.driver.pdsuidomain.entities._ import xyz.driver.pdsuidomain.services.CriterionService.RichCriterion @@ -19,10 +20,10 @@ object trialcuration { id = nextStringId[Trial], externalId = nextUuidId[Trial], status = nextTrialStatus, - assignee = Option(nextStringId[User]), + assignee = Option(generators.nextId[User]), previousStatus = Option(nextPreviousTrialStatus), - previousAssignee = Option(nextStringId[User]), - lastActiveUserId = Option(nextStringId[User]), + previousAssignee = Option(generators.nextId[User]), + lastActiveUserId = Option(generators.nextId[User]), lastUpdate = nextLocalDateTime, phase = generators.nextString(), hypothesisId = Option(nextUuidId[Hypothesis]), @@ -106,7 +107,7 @@ object trialcuration { def nextTrialIssue(): TrialIssue = TrialIssue( id = nextLongId[TrialIssue], - userId = nextStringId[User], + userId = generators.nextId[User], trialId = nextStringId[Trial], lastUpdate = nextLocalDateTime, isDraft = generators.nextBoolean(), @@ -118,7 +119,7 @@ object trialcuration { def nextTrialHistory(): TrialHistory = TrialHistory( id = nextLongId[TrialHistory], - executor = nextStringId[User], + executor = generators.nextId[User], trialId = nextStringId[Trial], state = nextTrialState, action = nextTrialAction, |