aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2017-10-09 20:00:22 -0700
committervlad <vlad@driver.xyz>2017-10-09 20:00:22 -0700
commitc404ab936d5c2ebaae8246ed658086d66e7c9a61 (patch)
tree2deec9cab3030754d77b14a4845d57fb292796ab
parent9cfd099d063016c313d4fb8d69202a6184ecdffc (diff)
downloadrest-query-c404ab936d5c2ebaae8246ed658086d66e7c9a61.tar.gz
rest-query-c404ab936d5c2ebaae8246ed658086d66e7c9a61.tar.bz2
rest-query-c404ab936d5c2ebaae8246ed658086d66e7c9a61.zip
Update PatientLabelEvidenceView to support to Provider and Document typev0.7.3
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/PatientLabelEvidenceView.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/evidence/ApiPatientLabelEvidence.scala4
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/patientlabel.scala2
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala9
4 files changed, 11 insertions, 8 deletions
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 {