Skip to content

Commit

Permalink
- Add test cases for general slice validation against the observation-bp
Browse files Browse the repository at this point in the history
  profile.

PiperOrigin-RevId: 557946041
  • Loading branch information
waltaskew authored and copybara-github committed Aug 17, 2023
1 parent 1dde339 commit 04f3e3a
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ issue {
value: VALUE
}
diagnostics {
value: "Field size: `3` is higher than max size: `1`"
value: "Constraint from slice Condition.code.coding:icd9 not met. The slice implies the following constraint: coding.where(system = \'http://hl7.org/fhir/sid/icd-9-cm/diagnosis\').count() <= 1"
}
expression {
value: "Condition.code.coding:icd9"
Expand All @@ -20,9 +20,9 @@ issue {
value: VALUE
}
diagnostics {
value: "Field size: `2` is higher than max size: `1`"
value: "Constraint from slice Condition.code.coding:icd10 not met. The slice implies the following constraint: coding.where(system = \'http://hl7.org/fhir/sid/icd-10\').count() <= 1"
}
expression {
value: "Condition.code.coding:icd10"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
issue {
severity {
value: ERROR
}
code {
value: VALUE
}
diagnostics {
value: "Constraint from slice Observation.category:VSCat not met. The slice implies the following constraint: category.where(coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' and coding.code = 'vital-signs').count() = 1"
}
expression {
value: "Observation.category:VSCat"
}
}
issue {
severity {
value: ERROR
}
code {
value: VALUE
}
diagnostics {
value: "Constraint from slice Observation.code.coding:BPCode not met. The slice implies the following constraint: coding.where(system = 'http://loinc.org' and code = '85354-9').count() = 1"
}
expression {
value: "Observation.code.coding:BPCode"
}
}
issue {
severity {
value: ERROR
}
code {
value: VALUE
}
diagnostics {
value: "Constraint from slice Observation.component:SystolicBP not met. The slice implies the following constraint: component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8480-6' and value.system = 'http://unitsofmeasure.org' and value.code = 'mm[Hg]').count() = 1"
}
expression {
value: "Observation.component:SystolicBP"
}
}
issue {
severity {
value: ERROR
}
code {
value: VALUE
}
diagnostics {
value: "Constraint from slice Observation.component:DiastolicBP not met. The slice implies the following constraint: component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8462-4' and value.system = 'http://unitsofmeasure.org' and value.code = 'mm[Hg]').count() = 1"
}
expression {
value: "Observation.component:DiastolicBP"
}
}
59 changes: 59 additions & 0 deletions testdata/r4/validation/observation_bp_invalid_codes.prototxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
id { value: "123" }
status { value: FINAL }
# wrong vital signs code
category {
coding {
system { value: "http://terminology.hl7.org/CodeSystem/observation-category" }
code { value: "non-vital-signs" }
}
}
# wrong blood pressure code
code {
coding {
system { value: "http://loinc.org" }
code { value: "blood-no-pressure" }
}
}
# wrong systolic code
component {
code {
coding {
system { value: "http://loinc.org" }
code { value: "wrong-code" }
}
}
value {
quantity {
system { value: "http://unitsofmeasure.org" }
code { value: "mm[Hg]" }
value { value: "100" }
}
}
}
# wrong diastolic code
component {
code {
coding {
system { value: "http://loinc.org" }
code { value: "another-wrong-code" }
}
}
value {
quantity {
system { value: "http://unitsofmeasure.org" }
code { value: "mm[Hg]" }
value { value: "70" }
}
}
}
effective {
date_time {
value_us: 0
timezone: "UTC"
precision: DAY
}
}
subject {
type { value: "http://a-person.com" }
uri { value: "http://person-id.com" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
issue {
severity {
value: ERROR
}
code {
value: VALUE
}
diagnostics {
value: "Constraint from slice Observation.code.coding:BPCode not met. The slice implies the following constraint: coding.where(system = 'http://loinc.org' and code = '85354-9').count() = 1"
}
expression {
value: "Observation.code.coding:BPCode"
}
}
issue {
severity {
value: ERROR
}
code {
value: VALUE
}
diagnostics {
value: "Constraint from slice Observation.component:SystolicBP not met. The slice implies the following constraint: component.where(code.coding.system = 'http://loinc.org' and code.coding.code = '8480-6' and value.system = 'http://unitsofmeasure.org' and value.code = 'mm[Hg]').count() = 1"
}
expression {
value: "Observation.component:SystolicBP"
}
}
59 changes: 59 additions & 0 deletions testdata/r4/validation/observation_bp_invalid_systems.prototxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
id { value: "123" }
status { value: FINAL }
# category = vital-signs
category {
coding {
system { value: "http://terminology.hl7.org/CodeSystem/observation-category" }
code { value: "vital-signs" }
}
}
# wrong blood pressure system
code {
coding {
system { value: "http://oink-oink.org" }
code { value: "85354-9" }
}
}
# wrong systolic system
component {
code {
coding {
system { value: "http://oink-oink.org" }
code { value: "8480-6" }
}
}
value {
quantity {
system { value: "http://unitsofmeasure.org" }
code { value: "mm[Hg]" }
value { value: "100" }
}
}
}
# diastolic
component {
code {
coding {
system { value: "http://loinc.org" }
code { value: "8462-4" }
}
}
value {
quantity {
system { value: "http://unitsofmeasure.org" }
code { value: "mm[Hg]" }
value { value: "70" }
}
}
}
effective {
date_time {
value_us: 0
timezone: "UTC"
precision: DAY
}
}
subject {
type { value: "http://a-person.com" }
uri { value: "http://person-id.com" }
}
59 changes: 59 additions & 0 deletions testdata/r4/validation/observation_bp_valid.prototxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
id { value: "123" }
status { value: FINAL }
# category = vital-signs
category {
coding {
system { value: "http://terminology.hl7.org/CodeSystem/observation-category" }
code { value: "vital-signs" }
}
}
# code = blood pressure panel
code {
coding {
system { value: "http://loinc.org" }
code { value: "85354-9" }
}
}
# systolic
component {
code {
coding {
system { value: "http://loinc.org" }
code { value: "8480-6" }
}
}
value {
quantity {
system { value: "http://unitsofmeasure.org" }
code { value: "mm[Hg]" }
value { value: "100" }
}
}
}
# diastolic
component {
code {
coding {
system { value: "http://loinc.org" }
code { value: "8462-4" }
}
}
value {
quantity {
system { value: "http://unitsofmeasure.org" }
code { value: "mm[Hg]" }
value { value: "70" }
}
}
}
effective {
date_time {
value_us: 0
timezone: "UTC"
precision: DAY
}
}
subject {
type { value: "http://a-person.com" }
uri { value: "http://person-id.com" }
}

0 comments on commit 04f3e3a

Please sign in to comment.