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/PatientLabelFormatSuite.scala | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala') 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 From c404ab936d5c2ebaae8246ed658086d66e7c9a61 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 9 Oct 2017 20:00:22 -0700 Subject: Update PatientLabelEvidenceView to support to Provider and Document type --- .../driver/pdsuidomain/entities/PatientLabelEvidenceView.scala | 4 ++-- .../formats/json/evidence/ApiPatientLabelEvidence.scala | 4 ++-- .../pdsuidomain/formats/json/sprayformats/patientlabel.scala | 2 ++ .../formats/json/sprayformats/PatientLabelFormatSuite.scala | 9 +++++---- 4 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala') diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala index 2dbe099..6055921 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala @@ -21,9 +21,9 @@ final case class PatientLabelEvidenceView(id: LongId[PatientLabelEvidence], documentId: Option[LongId[Document]], evidenceId: Option[LongId[ExtractedData]], reportId: Option[UuidId[DirectReport]], - documentType: String, + documentType: DocumentType, date: Option[LocalDate], // Document.startDate is optional - providerType: String, + providerType: ProviderType, patientId: UuidId[Patient], labelId: LongId[Label], isImplicitMatch: Boolean) diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala index 7409e90..c7a6de9 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala @@ -26,8 +26,8 @@ object ApiPatientLabelEvidence { documentId = x.documentId.map(_.id), evidenceId = x.evidenceId.map(_.id), reportId = x.reportId.map(_.toString), - documentType = x.documentType, + documentType = x.documentType.name, date = x.date.get, - providerType = x.providerType + providerType = x.providerType.name ) } diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala index ff6d24d..57dca1e 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala @@ -5,6 +5,8 @@ import xyz.driver.entities.labels.LabelValue import xyz.driver.pdsuidomain.entities._ import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel import xyz.driver.formats.json.labels._ +import xyz.driver.pdsuidomain.formats.json.sprayformats.record._ +import xyz.driver.pdsuidomain.formats.json.sprayformats.document._ object patientlabel { import DefaultJsonProtocol._ 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 47b251a..e837861 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 @@ -6,7 +6,7 @@ import spray.json._ import org.scalatest.{FlatSpec, Matchers} import xyz.driver.entities.labels.LabelValue import xyz.driver.pdsuicommon.domain.{LongId, UuidId} -import xyz.driver.pdsuidomain.entities.{PatientLabel, PatientLabelEvidenceView} +import xyz.driver.pdsuidomain.entities._ import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel class PatientLabelFormatSuite extends FlatSpec with Matchers { @@ -44,9 +44,9 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { documentId = Some(LongId(21)), evidenceId = Some(LongId(10)), reportId = None, - documentType = "document type", + documentType = DocumentType.LaboratoryReport, date = Some(LocalDate.parse("2017-08-10")), - providerType = "provider type", + providerType = ProviderType.EmergencyMedicine, patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), labelId = LongId(20), isImplicitMatch = false @@ -55,7 +55,8 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { writtenJson should be ( """{"id":1,"value":"Maybe","evidenceText":"evidence text","documentId":21,"evidenceId":10,"reportId":null, - "documentType":"document type","date":"2017-08-10","providerType":"provider type"}""".parseJson) + "documentType":{"id":3,"name":"Laboratory Report"},"date":"2017-08-10", + "providerType":{"id":26,"name":"Emergency Medicine"}}""".parseJson) } "Json format for PatientLabelDefiningCriteria" should "read and write correct JSON" in { -- cgit v1.2.3