aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2017-10-10 16:41:33 +0700
committerAleksandr <ognelisar@gmail.com>2017-10-10 16:41:33 +0700
commit4c22afe6a34641f5b35ff4953a5821a2bc940255 (patch)
tree4f77275d4460a184cf64085e9d7597841a50fbc9 /src/test/scala/xyz/driver
parentc32f965212481e4d26c2ae1ae5616f2d4b3e22ae (diff)
parent4f83461cba1f78e607ca2a4edb6fa26f6e16e732 (diff)
downloadrest-query-4c22afe6a34641f5b35ff4953a5821a2bc940255.tar.gz
rest-query-4c22afe6a34641f5b35ff4953a5821a2bc940255.tar.bz2
rest-query-4c22afe6a34641f5b35ff4953a5821a2bc940255.zip
All merge conflicts are resolved
Diffstat (limited to 'src/test/scala/xyz/driver')
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExportFormatSuite.scala13
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/ExtractedDataFormatSuite.scala11
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala11
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientEligibleTrialFormatSuite.scala10
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientFormatSuite.scala11
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala22
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala5
7 files changed, 47 insertions, 36 deletions
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..402e893 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
)
@@ -106,7 +107,7 @@ class ExportFormatSuite extends FlatSpec with Matchers {
val trialWithLabels = ExportTrialWithLabels(
nctId = StringId("NCT000001"),
trialId = UuidId("40892a07-c638-49d2-9795-1edfefbbcc7c"),
- condition = "Breast",
+ disease = "Breast",
lastReviewed = LocalDateTime.parse("2017-08-10T18:00:00"),
labelVersion = 1L,
arms = arms,
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 054a1df..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,
@@ -39,14 +40,14 @@ class PatientCriterionFormatSuite extends FlatSpec with Matchers {
"criterionIsDefining":false,"criterionIsCompound":false,"eligibilityStatus":"Yes","verifiedEligibilityStatus":null,
"isVisible":true,"isVerified":true,"lastUpdate":"2017-08-10T18:00Z","arms":["arm 31","arm 32"]}""".parseJson)
- val updatePatientCriterionJson = """{"verifiedEligibilityStatus":"No","eligibilityStatus":null}""".parseJson
- val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = Some(FuzzyValue.No),eligibilityStatus = None)
+ val updatePatientCriterionJson = """{"verifiedEligibilityStatus":"No"}""".parseJson
+ 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..31f541f 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,9 @@ 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.entities.patient.CancerType
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuidomain.entities.{PatientCriterionArm, PatientTrialArmGroupView, Trial}
import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEligibleTrial
@@ -21,7 +23,7 @@ class PatientEligibleTrialFormatSuite extends FlatSpec with Matchers {
previousAssignee = None,
lastActiveUserId = None,
lastUpdate = LocalDateTime.parse("2017-08-10T18:16:19"),
- condition = Trial.Condition.Breast,
+ disease = CancerType.Breast,
phase = "",
hypothesisId = Some(UuidId("e76e2fc4-a29c-44fb-a81b-8856d06bb1d4")),
studyDesignId = Some(LongId(321)),
@@ -38,8 +40,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..ad12b3b 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",
+ disease = 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","disease":"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..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
@@ -4,8 +4,9 @@ import java.time.LocalDate
import spray.json._
import org.scalatest.{FlatSpec, Matchers}
-import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, UuidId}
-import xyz.driver.pdsuidomain.entities.{PatientLabel, PatientLabelEvidenceView}
+import xyz.driver.entities.labels.LabelValue
+import xyz.driver.pdsuicommon.domain.{LongId, UuidId}
+import xyz.driver.pdsuidomain.entities._
import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel
class PatientLabelFormatSuite extends FlatSpec with Matchers {
@@ -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,14 +39,14 @@ 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)),
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
@@ -54,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 {
@@ -63,8 +65,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
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala
index 59cf779..beb69c4 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/TrialFormatSuite.scala
@@ -4,6 +4,7 @@ import java.time.LocalDateTime
import spray.json._
import org.scalatest.{FlatSpec, Matchers}
+import xyz.driver.entities.patient.CancerType
import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
import xyz.driver.pdsuidomain.entities.Trial
@@ -20,7 +21,7 @@ class TrialFormatSuite extends FlatSpec with Matchers {
previousAssignee = None,
lastActiveUserId = None,
lastUpdate = LocalDateTime.parse("2017-08-10T18:16:19"),
- condition = Trial.Condition.Breast,
+ disease = CancerType.Breast,
phase = "",
hypothesisId = Some(UuidId("3b80b2e2-5372-4cf5-a342-6e4ebe10fafd")),
studyDesignId = Some(LongId(321)),
@@ -39,7 +40,7 @@ class TrialFormatSuite extends FlatSpec with Matchers {
"isUpdated":false,"overviewTemplate":"","phase":"","originalStudyDesignId":null,
"hypothesisId":"3b80b2e2-5372-4cf5-a342-6e4ebe10fafd","originalTitle":"orig trial title",
"studyDesignId":321,"lastActiveUser":null,"externalid":"40892a07-c638-49d2-9795-1edfefbbcc7c",
- "id":"NCT000001","condition":"Breast","status":"New","overview":null,"previousAssignee":null,"title":"trial title"}""".parseJson)
+ "id":"NCT000001","disease":"Breast","status":"New","overview":null,"previousAssignee":null,"title":"trial title"}""".parseJson)
val updateTrialJson = """{"hypothesisId":null,"overview":"new overview"}""".parseJson
val expectedUpdatedTrial = orig.copy(hypothesisId = None, overview = Some("new overview"))