aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuicommon/utils
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2017-10-17 16:28:11 +0700
committerAleksandr <ognelisar@gmail.com>2017-10-17 16:28:11 +0700
commitf1bf26efdbc0f9546ffc7327e9932b48c1d648e4 (patch)
tree3279b5f8596f0760c0144abc32ffbebd5922bad7 /src/main/scala/xyz/driver/pdsuicommon/utils
parentfec0a0315ace61d63d05e1bcd71900777a229463 (diff)
parenteb9a75c226b005e5989d2a6494160ebe0dd9d9e7 (diff)
downloadrest-query-f1bf26efdbc0f9546ffc7327e9932b48c1d648e4.tar.gz
rest-query-f1bf26efdbc0f9546ffc7327e9932b48c1d648e4.tar.bz2
rest-query-f1bf26efdbc0f9546ffc7327e9932b48c1d648e4.zip
Merge branch 'master' into PDSUI-additional-formats
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuicommon/utils')
-rw-r--r--src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala237
1 files changed, 133 insertions, 104 deletions
diff --git a/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala b/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala
index b718c1f..55311ac 100644
--- a/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala
+++ b/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala
@@ -4,23 +4,25 @@ import java.time.{LocalDate, LocalDateTime}
import io.swagger.models.properties.Property
import spray.json.JsValue
-import xyz.driver.pdsuicommon.domain.{LongId, StringId, TextJson, UuidId}
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuidomain.entities._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.arm._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.slotarm._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.eligibilityarm._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.criterion._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.intervention._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.hypothesis._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.studydesign._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.trial._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.trialhistory._
-import xyz.driver.pdsuidomain.formats.json.sprayformats.trialissue._
+import xyz.driver.pdsuidomain.formats.json.sprayformats.ListResponse._
import xyz.driver.core.swagger.CustomSwaggerJsonConverter._
import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue
+import xyz.driver.pdsuidomain.entities.export.patient.ExportPatientWithLabels
+import xyz.driver.pdsuidomain.entities.export.trial.ExportTrialWithLabels
+import xyz.driver.pdsuidomain.fakes.entities.common
+import xyz.driver.pdsuidomain.formats.json.sprayformats.ListResponse
+import xyz.driver.pdsuidomain.formats.json.sprayformats.bridgeuploadqueue._
+import xyz.driver.pdsuidomain.formats.json.sprayformats.record._
+import xyz.driver.pdsuidomain.formats.json.sprayformats.document._
import xyz.driver.pdsuidomain.services.CriterionService.RichCriterion
import xyz.driver.pdsuidomain.services.ExtractedDataService.RichExtractedData
+import xyz.driver.pdsuidomain.services.PatientCriterionService.{DraftPatientCriterion, RichPatientCriterion}
+import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial
+import xyz.driver.pdsuidomain.services.PatientHypothesisService.RichPatientHypothesis
+import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel
import scala.collection.immutable
@@ -31,103 +33,130 @@ object CustomSwaggerJsonFormats {
classOf[LocalDate] -> stringProperty(example = Some("2010-12-31")),
classOf[UuidId[_]] -> stringProperty(example = Some("370b0450-35cb-4aab-ba74-0145be75add5")),
classOf[StringId[_]] -> stringProperty(),
- classOf[LongId[_]] -> stringProperty()
+ classOf[LongId[_]] -> stringProperty(),
+ classOf[CancerType] -> stringProperty()
)
- val customTrialCurationProperties = immutable.Map[Class[_], Property](
- classOf[Trial.Status] -> stringProperty(),
- classOf[CancerType] -> stringProperty(),
- classOf[TrialHistory.Action] -> stringProperty(),
- classOf[TrialHistory.State] -> stringProperty()
- ) ++ customCommonProperties
-
- val customTrialCurationObjectsExamples = immutable.Map[Class[_], JsValue](
- classOf[Trial] -> trialWriter.write(xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextTrial()),
- classOf[Arm] -> armFormat.write(xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextArm()),
- classOf[TrialHistory] -> trialHistoryFormat.write(
- xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextTrialHistory()),
- classOf[TrialIssue] -> trialIssueWriter.write(
- xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextTrialIssue()),
- classOf[RichCriterion] -> richCriterionFormat.write(
- xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextRichCriterion()),
- classOf[InterventionWithArms] -> interventionFormat.write(
- xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextInterventionWithArms()),
- classOf[InterventionType] -> interventionTypeFormat.write(
- xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextInterventionType()),
- classOf[Hypothesis] -> hypothesisFormat.write(
- xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextHypothesis()),
- classOf[StudyDesign] -> studyDesignFormat.write(
- xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextStudyDesign()),
- classOf[EligibilityArmWithDiseases] -> eligibilityArmWithDiseasesWriter.write(
- xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextEligibilityArmWithDiseases()),
- classOf[SlotArm] -> slotArmFormat.write(xyz.driver.pdsuidomain.fakes.entities.trialcuration.nextSlotArm())
+
+ val customCommonObjectsExamples = immutable.Map[Class[_], JsValue](
+ classOf[BridgeUploadQueue.Item] -> queueUploadItemFormat.write(common.nextBridgeUploadQueueItem()),
+ classOf[ProviderType] -> providerTypeFormat.write(common.nextProviderType()),
+ classOf[DocumentType] -> documentTypeFormat.write(common.nextDocumentType())
)
- // records-processing-service
- object Rep {
- import xyz.driver.pdsuidomain.fakes.entities.rep
- import xyz.driver.pdsuidomain.formats.json.sprayformats.document
- import xyz.driver.pdsuidomain.formats.json.sprayformats.documentissue
- import xyz.driver.pdsuidomain.formats.json.sprayformats.documenthistory
- import xyz.driver.pdsuidomain.formats.json.sprayformats.record
- import xyz.driver.pdsuidomain.formats.json.sprayformats.recordissue
- import xyz.driver.pdsuidomain.formats.json.sprayformats.recordhistory
- import xyz.driver.pdsuidomain.formats.json.sprayformats.bridgeuploadqueue
- import xyz.driver.pdsuidomain.formats.json.sprayformats.extracteddata
-
- val customRepObjectsExamples = immutable.Map[Class[_], JsValue](
- classOf[Document] ->
- document.documentFormat.write(rep.DocumentGen.nextDocument()),
- classOf[Document.Meta] ->
- document.documentMetaFormat.write(rep.DocumentGen.nextDocumentMeta()),
- classOf[TextJson[Document.Meta]] ->
- document.fullDocumentMetaFormat.write(rep.DocumentGen.nextDocumentMetaJson()),
- classOf[Document.RequiredType] ->
- document.requiredTypeFormat.write(rep.DocumentGen.nextDocumentRequiredType()),
- classOf[Document.Status] ->
- document.documentStatusFormat.write(rep.DocumentGen.nextDocumentStatus()),
- classOf[DocumentIssue] ->
- documentissue.documentIssueFormat.write(rep.DocumentGen.nextDocumentIssue()),
- classOf[DocumentHistory] ->
- documenthistory.documentHistoryFormat.write(rep.DocumentGen.nextDocumentHistory()),
- classOf[DocumentHistory.Action] ->
- documenthistory.documentActionFormat.write(rep.DocumentGen.nextDocumentHistoryAction()),
- classOf[DocumentHistory.State] ->
- documenthistory.documentStateFormat.write(rep.DocumentGen.nextDocumentHistoryState()),
- classOf[ProviderType] ->
- record.providerTypeFormat.write(rep.MedicalRecordGen.nextProviderType()),
- classOf[TextJson[List[MedicalRecord.Meta]]] ->
- record.recordMetaFormat.write(rep.MedicalRecordGen.nextMedicalRecordMetasJson()),
- classOf[MedicalRecord] ->
- record.recordFormat.write(rep.MedicalRecordGen.nextMedicalRecord()),
- classOf[MedicalRecord.Meta] ->
- record.recordMetaTypeFormat.write(rep.MedicalRecordGen.nextMedicalRecordMeta()),
- classOf[MedicalRecord.Status] ->
- record.recordStatusFormat.write(rep.MedicalRecordGen.nextMedicalRecordStatus()),
- classOf[MedicalRecordIssue] ->
- recordissue.recordIssueFormat.write(rep.MedicalRecordGen.nextMedicalRecordIssue()),
- classOf[MedicalRecordHistory] ->
- recordhistory.recordHistoryFormat.write(rep.MedicalRecordGen.nextMedicalRecordHistory()),
- classOf[MedicalRecordHistory.Action] ->
- recordhistory.recordActionFormat.write(rep.MedicalRecordGen.nextMedicalRecordHistoryAction()),
- classOf[MedicalRecordHistory.State] ->
- recordhistory.recordStateFormat.write(rep.MedicalRecordGen.nextMedicalRecordHistoryState()),
- classOf[BridgeUploadQueue.Item] ->
- bridgeuploadqueue.queueUploadItemFormat.write(rep.BridgeUploadQueueGen.nextBridgeUploadQueueItem()),
- classOf[ExtractedData.Meta] ->
- extracteddata.extractedDataMetaFormat.write(rep.ExtractedDataGen.nextExtractedDataMeta()),
- classOf[ExtractedData.Meta.Evidence] ->
- extracteddata.metaEvidenceFormat.write(rep.ExtractedDataGen.nextExtractedDataMetaEvidence()),
- classOf[ExtractedData.Meta.Keyword] ->
- extracteddata.metaKeywordFormat.write(rep.ExtractedDataGen.nextExtractedDataMetaKeyword()),
- classOf[ExtractedData.Meta.TextLayerPosition] ->
- extracteddata.metaTextLayerPositionFormat.write(rep.ExtractedDataGen.nextExtractedDataMetaTextLayerPosition()),
- classOf[TextJson[ExtractedData.Meta]] ->
- extracteddata.fullExtractedDataMetaFormat.write(rep.ExtractedDataGen.nextExtractedDataMetaJson()),
- classOf[RichExtractedData] ->
- extracteddata.extractedDataFormat.write(rep.ExtractedDataGen.nextRichExtractedData()),
- classOf[ExtractedDataLabel] ->
- extracteddata.extractedDataLabelWriter.write(rep.ExtractedDataGen.nextExtractedDataLabel())
+ object trialcuration {
+ import xyz.driver.pdsuidomain.fakes.entities.trialcuration._
+ import xyz.driver.pdsuidomain.fakes.entities.export
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.export._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.arm._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.slotarm._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.eligibilityarm._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.criterion._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.intervention._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.hypothesis._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.studydesign._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.trial._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.trialhistory._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.trialissue._
+
+ val customTrialCurationProperties = immutable.Map[Class[_], Property](
+ classOf[Trial.Status] -> stringProperty(),
+ classOf[TrialHistory.Action] -> stringProperty(),
+ classOf[TrialHistory.State] -> stringProperty()
+ ) ++ customCommonProperties
+
+ val customTrialCurationObjectsExamples = immutable.Map[Class[_], JsValue](
+ classOf[Trial] -> trialWriter.write(nextTrial()),
+ classOf[Arm] -> armFormat.write(nextArm()),
+ classOf[TrialHistory] -> trialHistoryFormat.write(nextTrialHistory()),
+ classOf[TrialIssue] -> trialIssueWriter.write(nextTrialIssue()),
+ classOf[RichCriterion] -> richCriterionFormat.write(nextRichCriterion()),
+ classOf[InterventionWithArms] -> interventionFormat.write(nextInterventionWithArms()),
+ classOf[InterventionType] -> interventionTypeFormat.write(nextInterventionType()),
+ classOf[Hypothesis] -> hypothesisFormat.write(nextHypothesis()),
+ classOf[StudyDesign] -> studyDesignFormat.write(nextStudyDesign()),
+ classOf[ExportTrialWithLabels] -> trialWithLabelsFormat.write(export.nextExportTrialWithLabels()),
+ classOf[EligibilityArmWithDiseases] -> eligibilityArmWithDiseasesWriter.write(nextEligibilityArmWithDiseases()),
+ classOf[SlotArm] -> slotArmFormat.write(nextSlotArm())
)
}
+ object recordprocessing {
+ import xyz.driver.pdsuidomain.fakes.entities.recordprocessing._
+ import xyz.driver.pdsuidomain.fakes.entities.export
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.export._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.documentissue._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.documenthistory._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.recordissue._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.recordhistory._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.extracteddata._
+
+ val customRecordProcessingProperties = immutable.Map[Class[_], Property](
+ classOf[MedicalRecord.Status] -> stringProperty(),
+ classOf[MedicalRecordHistory.Action] -> stringProperty(),
+ classOf[MedicalRecordHistory.State] -> stringProperty(),
+ classOf[Document.Status] -> stringProperty(),
+ classOf[Document.RequiredType] -> stringProperty(),
+ classOf[DocumentHistory.Action] -> stringProperty(),
+ classOf[DocumentHistory.State] -> stringProperty()
+ ) ++ customCommonProperties
+
+ val customRecordProcessingObjectsExamples = immutable.Map[Class[_], JsValue](
+ classOf[Document] -> documentFormat.write(nextDocument()),
+ classOf[DocumentIssue] -> documentIssueFormat.write(nextDocumentIssue()),
+ classOf[DocumentHistory] -> documentHistoryFormat.write(nextDocumentHistory()),
+ classOf[MedicalRecord] -> recordFormat.write(nextMedicalRecord()),
+ classOf[MedicalRecordIssue] -> recordIssueFormat.write(nextMedicalRecordIssue()),
+ classOf[MedicalRecordHistory] -> recordHistoryFormat.write(nextMedicalRecordHistory()),
+ classOf[RichExtractedData] -> extractedDataFormat.write(nextRichExtractedData()),
+ classOf[ExportPatientWithLabels] -> patientWithLabelsFormat.write(export.nextExportPatientWithLabels())
+ ) ++ customCommonObjectsExamples
+ }
+
+ object treatmentmatching {
+ import xyz.driver.pdsuidomain.fakes.entities.treatmentmatching._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.patient._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.patientcriterion._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.patientdefiningcriteria._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.patienteligibletrial._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.patientlabel._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.patienthypothesis._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.patienthistory._
+ import xyz.driver.pdsuidomain.formats.json.sprayformats.patientissue._
+
+ val customTreatmentMatchingProperties = immutable.Map[Class[_], Property](
+ classOf[Patient.Status] -> stringProperty(),
+ classOf[PatientHistory.Action] -> stringProperty(),
+ classOf[PatientHistory.State] -> stringProperty()
+ ) ++ customCommonProperties
+
+ val customTreatmentMatchingObjectsExamples = immutable.Map[Class[_], JsValue](
+ classOf[Patient] -> patientWriter.write(nextPatient()),
+ classOf[RichPatientLabel] -> richPatientLabelWriter.write(nextRichPatientLabel()),
+ classOf[PatientLabel] -> patientLabelDefiningCriteriaWriter.write(nextPatientLabel()),
+ classOf[RichPatientCriterion] -> patientCriterionWriter.write(nextRichPatientCriterion()),
+ classOf[DraftPatientCriterion] -> draftPatientCriterionFormat.write(nextDraftPatientCriterion()),
+ classOf[PatientLabelEvidenceView] -> patientLabelEvidenceWriter.write(nextPatientLabelEvidenceView()),
+ classOf[RichPatientEligibleTrial] -> patientEligibleTrialWriter.write(nextRichPatientEligibleTrial()),
+ classOf[PatientHypothesis] -> patientHypothesisWriter.write(nextPatientHypothesis()),
+ classOf[RichPatientHypothesis] -> richPatientHypothesisWriter.write(nextRichPatientHypothesis()),
+ classOf[PatientHistory] -> patientHistoryFormat.write(nextPatientHistory()),
+ classOf[PatientIssue] -> patientIssueWriter.write(nextPatientIssue()),
+ classOf[ListResponse[Patient]] -> listResponseWriter[Patient].write(nextPatientListResponse()),
+ classOf[ListResponse[PatientLabel]] -> listResponseWriter[PatientLabel].write(nextPatientLabelListResponse()),
+ classOf[ListResponse[RichPatientLabel]] -> listResponseWriter[RichPatientLabel].write(
+ nextRichPatientLabelListResponse()),
+ classOf[ListResponse[RichPatientCriterion]] -> listResponseWriter[RichPatientCriterion].write(
+ nextRichPatientCriterionListResponse()),
+ classOf[ListResponse[PatientLabelEvidenceView]] -> listResponseWriter[PatientLabelEvidenceView].write(
+ nextPatientLabelEvidenceViewListResponse()),
+ classOf[ListResponse[RichPatientEligibleTrial]] -> listResponseWriter[RichPatientEligibleTrial].write(
+ nextRichPatientEligibleTrialListResponse()),
+ classOf[ListResponse[RichPatientHypothesis]] -> listResponseWriter[RichPatientHypothesis].write(
+ nextRichPatientHypothesisListResponse()),
+ classOf[ListResponse[PatientIssue]] -> listResponseWriter[PatientIssue].write(nextPatientIssuesListResponse()),
+ classOf[ListResponse[PatientHistory]] -> listResponseWriter[PatientHistory].write(
+ nextPatientHistoryListResponse())
+ ) ++ customCommonObjectsExamples
+ }
+
}