us_core_test_kit 0.2.1 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/lib/us_core_test_kit/custom_groups/clinical_note_attachment_test.rb +2 -2
  3. data/lib/us_core_test_kit/custom_groups/clinical_note_type_test.rb +11 -6
  4. data/lib/us_core_test_kit/fhir_resource_navigation.rb +11 -3
  5. data/lib/us_core_test_kit/generated/v3.1.1/allergy_intolerance/allergy_intolerance_validation_test.rb +5 -2
  6. data/lib/us_core_test_kit/generated/v3.1.1/bodyheight/bodyheight_validation_test.rb +5 -2
  7. data/lib/us_core_test_kit/generated/v3.1.1/bodytemp/bodytemp_validation_test.rb +5 -2
  8. data/lib/us_core_test_kit/generated/v3.1.1/bodyweight/bodyweight_validation_test.rb +5 -2
  9. data/lib/us_core_test_kit/generated/v3.1.1/bp/bp_validation_test.rb +5 -2
  10. data/lib/us_core_test_kit/generated/v3.1.1/care_plan/care_plan_validation_test.rb +5 -2
  11. data/lib/us_core_test_kit/generated/v3.1.1/care_team/care_team_validation_test.rb +5 -2
  12. data/lib/us_core_test_kit/generated/v3.1.1/condition/condition_validation_test.rb +5 -2
  13. data/lib/us_core_test_kit/generated/v3.1.1/device/device_must_support_test.rb +1 -2
  14. data/lib/us_core_test_kit/generated/v3.1.1/device/device_validation_test.rb +5 -2
  15. data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_lab/diagnostic_report_lab_validation_test.rb +5 -2
  16. data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_note/diagnostic_report_note_validation_test.rb +5 -2
  17. data/lib/us_core_test_kit/generated/v3.1.1/document_reference/document_reference_must_support_test.rb +1 -2
  18. data/lib/us_core_test_kit/generated/v3.1.1/document_reference/document_reference_validation_test.rb +5 -2
  19. data/lib/us_core_test_kit/generated/v3.1.1/encounter/encounter_validation_test.rb +5 -2
  20. data/lib/us_core_test_kit/generated/v3.1.1/goal/goal_validation_test.rb +5 -2
  21. data/lib/us_core_test_kit/generated/v3.1.1/head_circumference/head_circumference_validation_test.rb +5 -2
  22. data/lib/us_core_test_kit/generated/v3.1.1/heartrate/heartrate_validation_test.rb +5 -2
  23. data/lib/us_core_test_kit/generated/v3.1.1/immunization/immunization_validation_test.rb +5 -2
  24. data/lib/us_core_test_kit/generated/v3.1.1/medication_request/medication_request_validation_test.rb +5 -2
  25. data/lib/us_core_test_kit/generated/v3.1.1/medication_request/medication_validation_test.rb +4 -2
  26. data/lib/us_core_test_kit/generated/v3.1.1/observation_lab/observation_lab_validation_test.rb +5 -2
  27. data/lib/us_core_test_kit/generated/v3.1.1/organization/organization_validation_test.rb +5 -2
  28. data/lib/us_core_test_kit/generated/v3.1.1/patient/patient_validation_test.rb +5 -2
  29. data/lib/us_core_test_kit/generated/v3.1.1/pediatric_bmi_for_age/pediatric_bmi_for_age_validation_test.rb +5 -2
  30. data/lib/us_core_test_kit/generated/v3.1.1/pediatric_weight_for_height/pediatric_weight_for_height_validation_test.rb +5 -2
  31. data/lib/us_core_test_kit/generated/v3.1.1/practitioner/practitioner_validation_test.rb +5 -2
  32. data/lib/us_core_test_kit/generated/v3.1.1/procedure/procedure_validation_test.rb +5 -2
  33. data/lib/us_core_test_kit/generated/v3.1.1/provenance/provenance_validation_test.rb +5 -2
  34. data/lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry/pulse_oximetry_validation_test.rb +5 -2
  35. data/lib/us_core_test_kit/generated/v3.1.1/resprate/resprate_validation_test.rb +5 -2
  36. data/lib/us_core_test_kit/generated/v3.1.1/smokingstatus/smokingstatus_validation_test.rb +5 -2
  37. data/lib/us_core_test_kit/generated/v3.1.1/us_core_test_suite.rb +2 -2
  38. data/lib/us_core_test_kit/generated/v4.0.0/allergy_intolerance/allergy_intolerance_validation_test.rb +5 -2
  39. data/lib/us_core_test_kit/generated/v4.0.0/blood_pressure/blood_pressure_validation_test.rb +5 -2
  40. data/lib/us_core_test_kit/generated/v4.0.0/bmi/bmi_validation_test.rb +5 -2
  41. data/lib/us_core_test_kit/generated/v4.0.0/body_height/body_height_validation_test.rb +5 -2
  42. data/lib/us_core_test_kit/generated/v4.0.0/body_temperature/body_temperature_validation_test.rb +5 -2
  43. data/lib/us_core_test_kit/generated/v4.0.0/body_weight/body_weight_validation_test.rb +5 -2
  44. data/lib/us_core_test_kit/generated/v4.0.0/care_plan/care_plan_validation_test.rb +5 -2
  45. data/lib/us_core_test_kit/generated/v4.0.0/care_team/care_team_validation_test.rb +5 -2
  46. data/lib/us_core_test_kit/generated/v4.0.0/condition/condition_validation_test.rb +5 -2
  47. data/lib/us_core_test_kit/generated/v4.0.0/device/device_validation_test.rb +5 -2
  48. data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_lab/diagnostic_report_lab_validation_test.rb +5 -2
  49. data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_note/diagnostic_report_note_validation_test.rb +5 -2
  50. data/lib/us_core_test_kit/generated/v4.0.0/document_reference/document_reference_must_support_test.rb +1 -2
  51. data/lib/us_core_test_kit/generated/v4.0.0/document_reference/document_reference_validation_test.rb +5 -2
  52. data/lib/us_core_test_kit/generated/v4.0.0/encounter/encounter_must_support_test.rb +2 -4
  53. data/lib/us_core_test_kit/generated/v4.0.0/encounter/encounter_validation_test.rb +5 -2
  54. data/lib/us_core_test_kit/generated/v4.0.0/goal/goal_validation_test.rb +5 -2
  55. data/lib/us_core_test_kit/generated/v4.0.0/head_circumference/head_circumference_validation_test.rb +5 -2
  56. data/lib/us_core_test_kit/generated/v4.0.0/head_circumference_percentile/head_circumference_percentile_validation_test.rb +5 -2
  57. data/lib/us_core_test_kit/generated/v4.0.0/heart_rate/heart_rate_validation_test.rb +5 -2
  58. data/lib/us_core_test_kit/generated/v4.0.0/immunization/immunization_validation_test.rb +5 -2
  59. data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_request_must_support_test.rb +1 -2
  60. data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_request_validation_test.rb +5 -2
  61. data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_validation_test.rb +4 -2
  62. data/lib/us_core_test_kit/generated/v4.0.0/metadata.yml +20 -2
  63. data/lib/us_core_test_kit/generated/v4.0.0/observation_lab/observation_lab_validation_test.rb +5 -2
  64. data/lib/us_core_test_kit/generated/v4.0.0/organization/organization_validation_test.rb +5 -2
  65. data/lib/us_core_test_kit/generated/v4.0.0/patient/metadata.yml +20 -1
  66. data/lib/us_core_test_kit/generated/v4.0.0/patient/patient_must_support_test.rb +9 -5
  67. data/lib/us_core_test_kit/generated/v4.0.0/patient/patient_validation_test.rb +5 -2
  68. data/lib/us_core_test_kit/generated/v4.0.0/pediatric_bmi_for_age/pediatric_bmi_for_age_validation_test.rb +5 -2
  69. data/lib/us_core_test_kit/generated/v4.0.0/pediatric_weight_for_height/pediatric_weight_for_height_validation_test.rb +5 -2
  70. data/lib/us_core_test_kit/generated/v4.0.0/practitioner/practitioner_validation_test.rb +5 -2
  71. data/lib/us_core_test_kit/generated/v4.0.0/procedure/procedure_validation_test.rb +5 -2
  72. data/lib/us_core_test_kit/generated/v4.0.0/provenance/metadata.yml +0 -1
  73. data/lib/us_core_test_kit/generated/v4.0.0/provenance/provenance_validation_test.rb +5 -2
  74. data/lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry/pulse_oximetry_validation_test.rb +5 -2
  75. data/lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/respiratory_rate_validation_test.rb +5 -2
  76. data/lib/us_core_test_kit/generated/v4.0.0/smokingstatus/smokingstatus_validation_test.rb +5 -2
  77. data/lib/us_core_test_kit/generated/v4.0.0/us_core_test_suite.rb +2 -2
  78. data/lib/us_core_test_kit/generator/must_support_metadata_extractor.rb +35 -22
  79. data/lib/us_core_test_kit/generator/must_support_test_generator.rb +26 -3
  80. data/lib/us_core_test_kit/generator/validation_test_generator.rb +7 -0
  81. data/lib/us_core_test_kit/must_support_test.rb +19 -3
  82. data/lib/us_core_test_kit/search_test.rb +104 -46
  83. data/lib/us_core_test_kit/validation_test.rb +9 -3
  84. data/lib/us_core_test_kit/version.rb +3 -1
  85. metadata +2 -2
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_heart_rate_validation_test
9
9
  title 'Observation resources returned during previous tests conform to the US Core Heart Rate Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Heart Rate Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_immunization_validation_test
9
9
  title 'Immunization resources returned during previous tests conform to the US Core Immunization Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Immunization Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -19,8 +19,7 @@ module USCoreTestKit
19
19
  * MedicationRequest.encounter
20
20
  * MedicationRequest.intent
21
21
  * MedicationRequest.medication[x]
22
- * MedicationRequest.reportedBoolean
23
- * MedicationRequest.reportedReference
22
+ * MedicationRequest.reportedBoolean or MedicationRequest.reportedReference
24
23
  * MedicationRequest.requester
25
24
  * MedicationRequest.status
26
25
  * MedicationRequest.subject
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_medication_request_validation_test
9
9
  title 'MedicationRequest resources returned during previous tests conform to the US Core MedicationRequest Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core MedicationRequest Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,7 +8,7 @@ module USCoreTestKit
8
8
  id :us_core_v400_medication_validation_test
9
9
  title 'Medication resources returned during previous tests conform to the US Core Medication Profile'
10
10
  description %(
11
- This test verifies resources returned from previous tests conform to
11
+ This test verifies resources returned from previous tests conform to
12
12
  the [US Core Medication Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication).
13
13
 
14
14
  It verifies the presence of mandatory elements and that elements with
@@ -29,7 +29,9 @@ fail if their code/system are not found in the valueset.
29
29
  end
30
30
 
31
31
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication')
32
+ perform_validation_test(scratch_resources[:all] || [],
33
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication',
34
+ skip_if_empty: false)
33
35
  end
34
36
  end
35
37
  end
@@ -12119,10 +12119,13 @@
12119
12119
  :extensions:
12120
12120
  - :id: Patient.extension:race
12121
12121
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-race
12122
+ :uscdi_only: true
12122
12123
  - :id: Patient.extension:ethnicity
12123
12124
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity
12125
+ :uscdi_only: true
12124
12126
  - :id: Patient.extension:birthsex
12125
12127
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex
12128
+ :uscdi_only: true
12126
12129
  :slices: []
12127
12130
  :elements:
12128
12131
  - :path: identifier
@@ -12132,8 +12135,11 @@
12132
12135
  - :path: name.family
12133
12136
  - :path: name.given
12134
12137
  - :path: telecom.system
12138
+ :uscdi_only: true
12135
12139
  - :path: telecom.value
12140
+ :uscdi_only: true
12136
12141
  - :path: telecom.use
12142
+ :uscdi_only: true
12137
12143
  - :path: gender
12138
12144
  - :path: birthDate
12139
12145
  - :path: address
@@ -12143,10 +12149,23 @@
12143
12149
  - :path: address.postalCode
12144
12150
  - :path: address.period
12145
12151
  - :path: communication.language
12146
- - :path: telecom
12152
+ :uscdi_only: true
12147
12153
  - :path: name.suffix
12154
+ :uscdi_only: true
12148
12155
  - :path: name.use
12149
12156
  :fixed_value: old
12157
+ :uscdi_only: true
12158
+ - :path: name.period.end
12159
+ :uscdi_only: true
12160
+ - :path: telecom
12161
+ :uscdi_only: true
12162
+ - :path: communication
12163
+ :uscdi_only: true
12164
+ :choices:
12165
+ - :paths:
12166
+ - name.period.end
12167
+ - name.use
12168
+ :uscdi_only: true
12150
12169
  :mandatory_elements:
12151
12170
  - Patient.identifier
12152
12171
  - Patient.identifier.system
@@ -13976,7 +13995,6 @@
13976
13995
  - Reference
13977
13996
  :target_profiles:
13978
13997
  - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner
13979
- - http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization
13980
13998
  - :path: agent.onBehalfOf
13981
13999
  :types:
13982
14000
  - Reference
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_observation_lab_validation_test
9
9
  title 'Observation resources returned during previous tests conform to the US Core Laboratory Result Observation Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Laboratory Result Observation Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_organization_validation_test
9
9
  title 'Organization resources returned during previous tests conform to the US Core Organization Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Organization Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -151,10 +151,13 @@
151
151
  :extensions:
152
152
  - :id: Patient.extension:race
153
153
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-race
154
+ :uscdi_only: true
154
155
  - :id: Patient.extension:ethnicity
155
156
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity
157
+ :uscdi_only: true
156
158
  - :id: Patient.extension:birthsex
157
159
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex
160
+ :uscdi_only: true
158
161
  :slices: []
159
162
  :elements:
160
163
  - :path: identifier
@@ -164,8 +167,11 @@
164
167
  - :path: name.family
165
168
  - :path: name.given
166
169
  - :path: telecom.system
170
+ :uscdi_only: true
167
171
  - :path: telecom.value
172
+ :uscdi_only: true
168
173
  - :path: telecom.use
174
+ :uscdi_only: true
169
175
  - :path: gender
170
176
  - :path: birthDate
171
177
  - :path: address
@@ -175,10 +181,23 @@
175
181
  - :path: address.postalCode
176
182
  - :path: address.period
177
183
  - :path: communication.language
178
- - :path: telecom
184
+ :uscdi_only: true
179
185
  - :path: name.suffix
186
+ :uscdi_only: true
180
187
  - :path: name.use
181
188
  :fixed_value: old
189
+ :uscdi_only: true
190
+ - :path: name.period.end
191
+ :uscdi_only: true
192
+ - :path: telecom
193
+ :uscdi_only: true
194
+ - :path: communication
195
+ :uscdi_only: true
196
+ :choices:
197
+ - :paths:
198
+ - name.period.end
199
+ - name.use
200
+ :uscdi_only: true
182
201
  :mandatory_elements:
183
202
  - Patient.identifier
184
203
  - Patient.identifier.system
@@ -19,10 +19,6 @@ module USCoreTestKit
19
19
  * Patient.address.postalCode
20
20
  * Patient.address.state
21
21
  * Patient.birthDate
22
- * Patient.communication.language
23
- * Patient.extension:birthsex
24
- * Patient.extension:ethnicity
25
- * Patient.extension:race
26
22
  * Patient.gender
27
23
  * Patient.identifier
28
24
  * Patient.identifier.system
@@ -30,8 +26,16 @@ module USCoreTestKit
30
26
  * Patient.name
31
27
  * Patient.name.family
32
28
  * Patient.name.given
29
+
30
+ For ONC USCDI requirements, each Patient must support the following additional elements:
31
+
32
+ * Patient.communication
33
+ * Patient.communication.language
34
+ * Patient.extension:birthsex
35
+ * Patient.extension:ethnicity
36
+ * Patient.extension:race
37
+ * Patient.name.period.end or Patient.name.use
33
38
  * Patient.name.suffix
34
- * Patient.name.use
35
39
  * Patient.telecom
36
40
  * Patient.telecom.system
37
41
  * Patient.telecom.use
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_patient_validation_test
9
9
  title 'Patient resources returned during previous tests conform to the US Core Patient Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Patient Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_pediatric_bmi_for_age_validation_test
9
9
  title 'Observation resources returned during previous tests conform to the US Core Pediatric BMI for Age Observation Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Pediatric BMI for Age Observation Profile](http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_pediatric_weight_for_height_validation_test
9
9
  title 'Observation resources returned during previous tests conform to the US Core Pediatric Weight for Height Observation Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Pediatric Weight for Height Observation Profile](http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_practitioner_validation_test
9
9
  title 'Practitioner resources returned during previous tests conform to the US Core Practitioner Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Practitioner Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_procedure_validation_test
9
9
  title 'Procedure resources returned during previous tests conform to the US Core Procedure Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Procedure Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -64,7 +64,6 @@
64
64
  - Reference
65
65
  :target_profiles:
66
66
  - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner
67
- - http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization
68
67
  - :path: agent.onBehalfOf
69
68
  :types:
70
69
  - Reference
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_provenance_validation_test
9
9
  title 'Provenance resources returned during previous tests conform to the US Core Provenance Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Provenance Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_pulse_oximetry_validation_test
9
9
  title 'Observation resources returned during previous tests conform to the US Core Pulse Oximetry Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Pulse Oximetry Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_respiratory_rate_validation_test
9
9
  title 'Observation resources returned during previous tests conform to the US Core Respiratory Rate Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Respiratory Rate Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -8,8 +8,9 @@ module USCoreTestKit
8
8
  id :us_core_v400_smokingstatus_validation_test
9
9
  title 'Observation resources returned during previous tests conform to the US Core Smoking Status Observation Profile'
10
10
  description %(
11
- This test verifies resources returned from the first search conform to
11
+ This test verifies resources returned from the first search conform to
12
12
  the [US Core Smoking Status Observation Profile](http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
13
14
 
14
15
  It verifies the presence of mandatory elements and that elements with
15
16
  required bindings contain appropriate values. CodeableConcept element
@@ -29,7 +30,9 @@ fail if their code/system are not found in the valueset.
29
30
  end
30
31
 
31
32
  run do
32
- perform_validation_test(scratch_resources[:all] || [], 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus')
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus',
35
+ skip_if_empty: true)
33
36
  end
34
37
  end
35
38
  end
@@ -44,8 +44,8 @@ module USCoreTestKit
44
44
  VALIDATION_MESSAGE_FILTERS = [
45
45
  %r{Sub-extension url 'introspect' is not defined by the Extension http://fhir-registry\.smarthealthit\.org/StructureDefinition/oauth-uris$},
46
46
  %r{Sub-extension url 'revoke' is not defined by the Extension http://fhir-registry\.smarthealthit\.org/StructureDefinition/oauth-uris$},
47
- /^Observation\.effective\.ofType\(Period\): vs-1:/, # Invalid invariant in FHIR v4.0.1
48
- /^Observation\.effective\.ofType\(Period\): us-core-1:/ # Invalid invariant in US Core v3.1.1
47
+ /Observation\.effective\.ofType\(Period\): vs-1:/, # Invalid invariant in FHIR v4.0.1
48
+ /Observation\.effective\.ofType\(Period\): us-core-1:/ # Invalid invariant in US Core v3.1.1
49
49
  ].freeze
50
50
 
51
51
  def self.metadata
@@ -277,7 +277,6 @@ module USCoreTestKit
277
277
  when '4.0.0'
278
278
  add_device_distinct_identifier
279
279
  add_patient_uscdi_elements
280
- add_provenance_agent_who
281
280
  end
282
281
  end
283
282
 
@@ -344,18 +343,23 @@ module USCoreTestKit
344
343
  def add_must_support_choices
345
344
  choices = []
346
345
 
347
- choices << {paths: ['content.attachment.data', 'content.attachment.url']} if profile.type == 'DocumentReference'
346
+ choices << { paths: ['content.attachment.data', 'content.attachment.url'] } if profile.type == 'DocumentReference'
348
347
 
349
348
  case profile.version
350
349
  when '3.1.1'
351
- choices << {paths: ['udiCarrier.carrierAIDC', 'udiCarrier.carrierHRF']} if profile.type == 'Device'
350
+ choices << { paths: ['udiCarrier.carrierAIDC', 'udiCarrier.carrierHRF'] } if profile.type == 'Device'
352
351
  when '4.0.0'
353
352
  case profile.type
354
353
  when 'Encounter'
355
- choices << {paths: ['reasonCode', 'reasonReference']}
356
- choices << {paths: ['location.location', 'serviceProvider']}
354
+ choices << { paths: ['reasonCode', 'reasonReference'] }
355
+ choices << { paths: ['location.location', 'serviceProvider'] }
357
356
  when 'MedicationRequest'
358
- choices << {paths: ['reportedBoolean', 'reportedReference']}
357
+ choices << { paths: ['reportedBoolean', 'reportedReference'] }
358
+ when 'Patient'
359
+ choices << {
360
+ paths: ['name.period.end', 'name.use'],
361
+ uscdi_only: true
362
+ }
359
363
  end
360
364
  end
361
365
 
@@ -377,35 +381,44 @@ module USCoreTestKit
377
381
  #US Core 4.0.0 Section 10.112.1.1 Additional USCDI v1 Requirement:
378
382
  @must_supports[:extensions] << {
379
383
  id: 'Patient.extension:race',
380
- url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'
384
+ url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race',
385
+ uscdi_only: true
381
386
  }
382
387
  @must_supports[:extensions] << {
383
388
  id: 'Patient.extension:ethnicity',
384
- url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'
389
+ url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity',
390
+ uscdi_only: true
385
391
  }
386
392
  @must_supports[:extensions] << {
387
393
  id: 'Patient.extension:birthsex',
388
- url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex'
394
+ url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex',
395
+ uscdi_only: true
389
396
  }
390
397
  @must_supports[:elements] << {
391
- path: 'telecom'
398
+ path: 'name.suffix',
399
+ uscdi_only: true
392
400
  }
393
401
  @must_supports[:elements] << {
394
- path: 'name.suffix'
402
+ path: 'name.use',
403
+ fixed_value: 'old',
404
+ uscdi_only: true
395
405
  }
396
406
  @must_supports[:elements] << {
397
- path: 'name.use',
398
- fixed_value: 'old'
407
+ path: 'name.period.end',
408
+ uscdi_only: true
399
409
  }
400
- end
401
- end
402
-
403
- def add_provenance_agent_who
404
- # FHIR-36344 US Core 4.0.0 mistakenly not lable us-core-organization as MS for Provenance.agent.who
405
- # This will be fixed in US Core 5.0.0
406
- if profile.type == 'Provenance'
407
- target_element = @must_supports[:elements].find { |element| element[:path] == 'agent.who'}
408
- target_element[:target_profiles] << 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization'
410
+ @must_supports[:elements] << {
411
+ path: 'telecom',
412
+ uscdi_only: true
413
+ }
414
+ @must_supports[:elements] << {
415
+ path: 'communication',
416
+ uscdi_only: true
417
+ }
418
+ @must_supports[:elements].each do |element|
419
+ path = element[:path]
420
+ element[:uscdi_only] = true if path.include?('telecom.') || path.include?('communication.')
421
+ end
409
422
  end
410
423
  end
411
424
  end
@@ -68,9 +68,32 @@ module USCoreTestKit
68
68
  end
69
69
 
70
70
  def must_support_list_string
71
- slice_names = group_metadata.must_supports[:slices].map { |slice| slice[:name] }
72
- element_names = group_metadata.must_supports[:elements].map { |slice| "#{resource_type}.#{slice[:path]}" }
73
- extension_names = group_metadata.must_supports[:extensions].map { |slice| slice[:id] }
71
+ build_must_support_list_string(false)
72
+ end
73
+
74
+ def uscdi_list_string
75
+ build_must_support_list_string(true)
76
+ end
77
+
78
+ def build_must_support_list_string(uscdi_only)
79
+ slice_names = group_metadata.must_supports[:slices]
80
+ .select { |slice| slice[:uscdi_only].presence == uscdi_only.presence }
81
+ .map { |slice| slice[:name] }
82
+
83
+ element_names = group_metadata.must_supports[:elements]
84
+ .select { |element| element[:uscdi_only].presence == uscdi_only.presence }
85
+ .map { |element| "#{resource_type}.#{element[:path]}" }
86
+
87
+ extension_names = group_metadata.must_supports[:extensions]
88
+ .select { |extension| extension[:uscdi_only].presence == uscdi_only.presence }
89
+ .map { |extension| extension[:id] }
90
+
91
+ group_metadata.must_supports[:choices]&.each do |choice|
92
+ next unless choice[:uscdi_only].presence == uscdi_only.presence
93
+ choice[:paths].each { |path| element_names.delete("#{resource_type}.#{path}") }
94
+ element_names << choice[:paths].map { |path| "#{resource_type}.#{path}" }.join(' or ')
95
+ end
96
+
74
97
  (slice_names + element_names + extension_names)
75
98
  .uniq
76
99
  .sort