From 7d8712a62d30b412717e1b730c0ad267cd207aa4 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 9 Oct 2017 12:24:59 -0700 Subject: Getting rid of the FuzzyValues, Name as a string, and condition --- .../formats/json/sprayformats/ExportFormatSuite.scala | 11 ++++++----- .../json/sprayformats/ExtractedDataFormatSuite.scala | 11 ++++++----- .../json/sprayformats/PatientCriterionFormatSuite.scala | 9 +++++---- .../json/sprayformats/PatientEligibleTrialFormatSuite.scala | 7 ++++--- .../formats/json/sprayformats/PatientFormatSuite.scala | 11 +++++++---- .../formats/json/sprayformats/PatientLabelFormatSuite.scala | 13 +++++++------ 6 files changed, 35 insertions(+), 27 deletions(-) (limited to 'src/test/scala/xyz') diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala index a451905..05f5863 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala @@ -5,7 +5,8 @@ import java.util.UUID import spray.json._ import org.scalatest.{FlatSpec, Matchers} -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId} +import xyz.driver.entities.labels.LabelValue +import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} import xyz.driver.pdsuidomain.entities.{DocumentType, ProviderType, RecordRequestId} class ExportFormatSuite extends FlatSpec with Matchers { @@ -27,13 +28,13 @@ class ExportFormatSuite extends FlatSpec with Matchers { evidences = List( ExportPatientLabelEvidence( id = LongId(11), - value = FuzzyValue.Yes, + value = LabelValue.Yes, evidenceText = "evidence text 11", document = document ), ExportPatientLabelEvidence( id = LongId(12), - value = FuzzyValue.No, + value = LabelValue.No, evidenceText = "evidence text 12", document = document ) @@ -44,13 +45,13 @@ class ExportFormatSuite extends FlatSpec with Matchers { evidences = List( ExportPatientLabelEvidence( id = LongId(12), - value = FuzzyValue.Yes, + value = LabelValue.Yes, evidenceText = "evidence text 12", document = document ), ExportPatientLabelEvidence( id = LongId(13), - value = FuzzyValue.Yes, + value = LabelValue.Yes, evidenceText = "evidence text 13", document = document ) diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala index a4b8bab..aa82b98 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala @@ -2,7 +2,8 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats import spray.json._ import org.scalatest.{FlatSpec, Matchers} -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, TextJson} +import xyz.driver.entities.labels.LabelValue +import xyz.driver.pdsuicommon.domain.{LongId, TextJson} import xyz.driver.pdsuidomain.entities.ExtractedData.Meta import xyz.driver.pdsuidomain.entities.{ExtractedData, ExtractedDataLabel} import xyz.driver.pdsuidomain.services.ExtractedDataService.RichExtractedData @@ -24,14 +25,14 @@ class ExtractedDataFormatSuite extends FlatSpec with Matchers { dataId = extractedData.id, labelId = None, categoryId = None, - value = Some(FuzzyValue.Yes) + value = Some(LabelValue.Yes) ), ExtractedDataLabel( id = LongId(2), dataId = extractedData.id, labelId = Some(LongId(12)), categoryId = Some(LongId(1)), - value = Some(FuzzyValue.No) + value = Some(LabelValue.No) ) ) val origRichExtractedData = RichExtractedData( @@ -64,14 +65,14 @@ class ExtractedDataFormatSuite extends FlatSpec with Matchers { dataId = extractedData.id, labelId = Some(LongId(20)), categoryId = Some(LongId(1)), - value = Some(FuzzyValue.Yes) + value = Some(LabelValue.Yes) ), ExtractedDataLabel( id = LongId(0), dataId = extractedData.id, labelId = Some(LongId(12)), categoryId = Some(LongId(1)), - value = Some(FuzzyValue.No) + value = Some(LabelValue.No) ) ) val expectedUpdatedExtractedData = origRichExtractedData.copy( diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala index 623b3a9..fc206c7 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala @@ -4,7 +4,8 @@ import java.time.LocalDateTime import spray.json._ import org.scalatest.{FlatSpec, Matchers} -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId} +import xyz.driver.entities.labels.LabelValue +import xyz.driver.pdsuicommon.domain.{LongId, StringId} import xyz.driver.pdsuidomain.entities.{PatientCriterion, PatientCriterionArm} import xyz.driver.pdsuidomain.services.PatientCriterionService.{DraftPatientCriterion, RichPatientCriterion} @@ -21,7 +22,7 @@ class PatientCriterionFormatSuite extends FlatSpec with Matchers { criterionText = "criterion text", criterionValue = Some(true), criterionIsDefining = false, - eligibilityStatus = Some(FuzzyValue.Yes), + eligibilityStatus = Some(LabelValue.Yes), verifiedEligibilityStatus = None, isVisible = true, isVerified = true, @@ -40,13 +41,13 @@ class PatientCriterionFormatSuite extends FlatSpec with Matchers { "isVisible":true,"isVerified":true,"lastUpdate":"2017-08-10T18:00Z","arms":["arm 31","arm 32"]}""".parseJson) val updatePatientCriterionJson = """{"verifiedEligibilityStatus":"No"}""".parseJson - val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = Some(FuzzyValue.No)) + val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = Some(LabelValue.No)) val parsedUpdatePatientCriterion = applyUpdateToPatientCriterion(updatePatientCriterionJson, orig) parsedUpdatePatientCriterion should be(expectedUpdatedPatientCriterion) val updateBulkPatientCriterionJson = """[{"id":1,"eligibilityStatus":"No"},{"id":2,"isVerified":false}]""".parseJson val expectedDraftPatientCriterionList = List( - DraftPatientCriterion(id = LongId(1), eligibilityStatus = Some(FuzzyValue.No), isVerified = None), + DraftPatientCriterion(id = LongId(1), eligibilityStatus = Some(LabelValue.No), isVerified = None), DraftPatientCriterion(id = LongId(2), eligibilityStatus = None, isVerified = Some(false)) ) val parsedDraftPatientCriterionList = draftPatientCriterionListReader.read(updateBulkPatientCriterionJson) diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala index ad54946..f48625c 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala @@ -4,7 +4,8 @@ import java.time.LocalDateTime import spray.json._ import org.scalatest.{FlatSpec, Matchers} -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId} +import xyz.driver.entities.labels.LabelValue +import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} import xyz.driver.pdsuidomain.entities.{PatientCriterionArm, PatientTrialArmGroupView, Trial} import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial @@ -38,8 +39,8 @@ class PatientEligibleTrialFormatSuite extends FlatSpec with Matchers { patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), trialId = StringId("NCT000001"), hypothesisId = UuidId("e76e2fc4-a29c-44fb-a81b-8856d06bb1d4"), - eligibilityStatus = Some(FuzzyValue.Yes), - verifiedEligibilityStatus = Some(FuzzyValue.Yes), + eligibilityStatus = Some(LabelValue.Yes), + verifiedEligibilityStatus = Some(LabelValue.Yes), isVerified = false ) val arms = List( diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala index 2761d6a..443c8e8 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala @@ -4,6 +4,8 @@ import java.time.{LocalDate, LocalDateTime} import spray.json._ import org.scalatest.{FlatSpec, Matchers} +import xyz.driver.entities.common.FullName +import xyz.driver.entities.patient.CancerType import xyz.driver.pdsuicommon.domain.UuidId import xyz.driver.pdsuidomain.entities.{Patient, PatientOrderId} @@ -14,23 +16,24 @@ class PatientFormatSuite extends FlatSpec with Matchers { val orig = Patient( id = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), status = Patient.Status.New, - name = "John Doe", + name = FullName.fromStrings("John", "", "Doe"), dob = LocalDate.parse("1980-06-30"), assignee = None, previousStatus = None, previousAssignee = None, lastActiveUserId = None, isUpdateRequired = false, - condition = "breast", + cancerType = CancerType.Breast, orderId = PatientOrderId("7b54a75d-4197-4b27-9045-b9b6cb131be9"), lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00") ) val writtenJson = patientWriter.write(orig) writtenJson should be ( - """{"id":"748b5884-3528-4cb9-904b-7a8151d6e343","dob":"1980-06-30","name":"John Doe","status":"New","assignee":null, + """{"id":"748b5884-3528-4cb9-904b-7a8151d6e343","dob":"1980-06-30", + "name":{"firstName":"John","middleName":"","lastName":"Doe"},"status":"New","assignee":null, "previousStatus":null,"previousAssignee":null,"lastActiveUser":null,"lastUpdate":"2017-08-10T18:00Z", - "orderId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","condition":"breast"}""".parseJson) + "orderId":"7b54a75d-4197-4b27-9045-b9b6cb131be9","condition":"Breast"}""".parseJson) } } diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala index 3ef286d..47b251a 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala @@ -4,7 +4,8 @@ import java.time.LocalDate import spray.json._ import org.scalatest.{FlatSpec, Matchers} -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, UuidId} +import xyz.driver.entities.labels.LabelValue +import xyz.driver.pdsuicommon.domain.{LongId, UuidId} import xyz.driver.pdsuidomain.entities.{PatientLabel, PatientLabelEvidenceView} import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel @@ -16,7 +17,7 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { id = LongId(1), patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), labelId = LongId(20), - primaryValue = Some(FuzzyValue.Yes), + primaryValue = Some(LabelValue.Yes), verifiedPrimaryValue = None, isVisible = true, score = 1, @@ -29,7 +30,7 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { "score":1,"isImplicitMatch":false}""".parseJson) val updatePatientLabelJson = """{"verifiedPrimaryValue":"No"}""".parseJson - val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = Some(FuzzyValue.No)) + val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = Some(LabelValue.No)) val parsedUpdatePatientLabel = applyUpdateToPatientLabel(updatePatientLabelJson, orig) parsedUpdatePatientLabel should be(expectedUpdatedPatientLabel) } @@ -38,7 +39,7 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { import patientlabel._ val orig = PatientLabelEvidenceView( id = LongId(1), - value = FuzzyValue.Maybe, + value = LabelValue.Maybe, evidenceText = "evidence text", documentId = Some(LongId(21)), evidenceId = Some(LongId(10)), @@ -63,8 +64,8 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { id = LongId(1), patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), labelId = LongId(20), - primaryValue = Some(FuzzyValue.Yes), - verifiedPrimaryValue = Some(FuzzyValue.Yes), + primaryValue = Some(LabelValue.Yes), + verifiedPrimaryValue = Some(LabelValue.Yes), isVisible = true, score = 1, isImplicitMatch = false -- cgit v1.2.3