us_core_test_kit 0.6.5 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/us_core_test_kit/custom_groups/base_smart_granular_scopes_group.rb +42 -11
  3. data/lib/us_core_test_kit/custom_groups/granted_granular_scopes_test.rb +61 -0
  4. data/lib/us_core_test_kit/custom_groups/smart_scopes_constants.rb +5 -8
  5. data/lib/us_core_test_kit/custom_groups/v6.1.0/smart_granular_scopes_group.rb +94 -41
  6. data/lib/us_core_test_kit/custom_groups/v7.0.0-ballot/smart_granular_scopes_group.rb +6 -0
  7. data/lib/us_core_test_kit/fhir_resource_navigation.rb +11 -1
  8. data/lib/us_core_test_kit/generated/v3.1.1/metadata.yml +3 -0
  9. data/lib/us_core_test_kit/generated/v3.1.1/patient/metadata.yml +3 -0
  10. data/lib/us_core_test_kit/generated/v3.1.1/us_core_test_suite.rb +5 -4
  11. data/lib/us_core_test_kit/generated/v4.0.0/metadata.yml +3 -0
  12. data/lib/us_core_test_kit/generated/v4.0.0/patient/metadata.yml +3 -0
  13. data/lib/us_core_test_kit/generated/v4.0.0/us_core_test_suite.rb +5 -4
  14. data/lib/us_core_test_kit/generated/v5.0.1/condition_encounter_diagnosis/metadata.yml +1 -0
  15. data/lib/us_core_test_kit/generated/v5.0.1/condition_problems_health_concerns/metadata.yml +1 -0
  16. data/lib/us_core_test_kit/generated/v5.0.1/metadata.yml +8 -0
  17. data/lib/us_core_test_kit/generated/v5.0.1/patient/metadata.yml +4 -0
  18. data/lib/us_core_test_kit/generated/v5.0.1/questionnaire_response/metadata.yml +2 -0
  19. data/lib/us_core_test_kit/generated/v5.0.1/us_core_test_suite.rb +5 -4
  20. data/lib/us_core_test_kit/generated/v6.1.0/condition_encounter_diagnosis/metadata.yml +1 -0
  21. data/lib/us_core_test_kit/generated/v6.1.0/condition_granular_scope1_group.rb +2 -0
  22. data/lib/us_core_test_kit/generated/v6.1.0/condition_problems_health_concerns/metadata.yml +1 -0
  23. data/lib/us_core_test_kit/generated/v6.1.0/granular_scope_tests/condition/metadata.yml +3 -2
  24. data/lib/us_core_test_kit/generated/v6.1.0/granular_scope_tests/observation/metadata.yml +2 -2
  25. data/lib/us_core_test_kit/generated/v6.1.0/granular_scopes1_group.rb +5 -1
  26. data/lib/us_core_test_kit/generated/v6.1.0/metadata.yml +9 -6
  27. data/lib/us_core_test_kit/generated/v6.1.0/observation_granular_scope1_group.rb +3 -1
  28. data/lib/us_core_test_kit/generated/v6.1.0/patient/metadata.yml +5 -0
  29. data/lib/us_core_test_kit/generated/v6.1.0/questionnaire_response/metadata.yml +2 -0
  30. data/lib/us_core_test_kit/generated/v6.1.0/us_core_test_suite.rb +7 -6
  31. data/lib/us_core_test_kit/generated/v7.0.0-ballot/condition_encounter_diagnosis/metadata.yml +1 -0
  32. data/lib/us_core_test_kit/generated/v7.0.0-ballot/condition_problems_health_concerns/metadata.yml +1 -0
  33. data/lib/us_core_test_kit/generated/v7.0.0-ballot/granular_scope_tests/condition/metadata.yml +1 -0
  34. data/lib/us_core_test_kit/generated/v7.0.0-ballot/medication_request/metadata.yml +1 -0
  35. data/lib/us_core_test_kit/generated/v7.0.0-ballot/metadata.yml +10 -0
  36. data/lib/us_core_test_kit/generated/v7.0.0-ballot/patient/metadata.yml +5 -0
  37. data/lib/us_core_test_kit/generated/v7.0.0-ballot/questionnaire_response/metadata.yml +2 -0
  38. data/lib/us_core_test_kit/generated/v7.0.0-ballot/us_core_test_suite.rb +6 -5
  39. data/lib/us_core_test_kit/generator/granular_scope_group_generator.rb +7 -0
  40. data/lib/us_core_test_kit/generator/granular_scope_resource_type_group_generator.rb +1 -1
  41. data/lib/us_core_test_kit/generator/granular_scope_test_generator.rb +2 -2
  42. data/lib/us_core_test_kit/generator/group_metadata.rb +1 -1
  43. data/lib/us_core_test_kit/generator/must_support_metadata_extractor.rb +1 -0
  44. data/lib/us_core_test_kit/generator/must_support_metadata_extractor_us_core_4.rb +3 -0
  45. data/lib/us_core_test_kit/generator/must_support_metadata_extractor_us_core_5.rb +1 -0
  46. data/lib/us_core_test_kit/generator/special_cases.rb +3 -5
  47. data/lib/us_core_test_kit/generator/suite_generator.rb +5 -2
  48. data/lib/us_core_test_kit/must_support_test.rb +25 -6
  49. data/lib/us_core_test_kit/reference_resolution_test.rb +2 -1
  50. data/lib/us_core_test_kit/search_test.rb +2 -0
  51. data/lib/us_core_test_kit/version.rb +1 -1
  52. metadata +4 -6
  53. data/lib/us_core_test_kit/generated/v6.1.0/condition_granular_scope2_group.rb +0 -43
  54. data/lib/us_core_test_kit/generated/v6.1.0/granular_scopes2_group.rb +0 -52
  55. data/lib/us_core_test_kit/generated/v6.1.0/observation_granular_scope2_group.rb +0 -32
@@ -77,6 +77,7 @@ module USCoreTestKit
77
77
  /Provenance.agent\[\d*\]: Rule provenance-1/, #Invalid invariant in US Core v5.0.1
78
78
  %r{Unknown Code System 'http://hl7.org/fhir/us/core/CodeSystem/us-core-tags'}, # Validator has an issue with this US Core 5 code system in US Core 6 resource
79
79
  %r{URL value 'http://hl7.org/fhir/us/core/CodeSystem/us-core-tags' does not resolve}, # Validator has an issue with this US Core 5 code system in US Core 6 resource
80
+ /\A\S+: \S+: URL value '.*' does not resolve/,
80
81
  %r{Observation.component\[\d+\].value.ofType\(Quantity\): The code provided \(http://unitsofmeasure.org#L/min\) was not found in the value set 'Vital Signs Units'} # Known issue with the Pulse Oximetry Profile
81
82
  ].freeze
82
83
 
@@ -88,8 +89,10 @@ module USCoreTestKit
88
89
  end
89
90
  end
90
91
 
91
- validator do
92
- url ENV.fetch('V501_VALIDATOR_URL', 'http://validator_service:4567')
92
+ id :us_core_v501
93
+
94
+ fhir_resource_validator do
95
+ igs 'hl7.fhir.us.core#5.0.1'
93
96
  message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS
94
97
 
95
98
  exclude_message do |message|
@@ -102,8 +105,6 @@ module USCoreTestKit
102
105
  end
103
106
  end
104
107
 
105
- id :us_core_v501
106
-
107
108
  input :url,
108
109
  title: 'FHIR Endpoint',
109
110
  description: 'URL of the FHIR endpoint'
@@ -242,6 +242,7 @@
242
242
  :must_supports:
243
243
  :extensions:
244
244
  - :id: Condition.extension:assertedDate
245
+ :path: extension
245
246
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
246
247
  :slices:
247
248
  - :slice_id: Condition.category:us-core
@@ -20,6 +20,8 @@ FHIR API tests, and verify that the resources returned are filtered
20
20
  based on the following granular scopes:
21
21
 
22
22
  * `Condition.rs?category=http://terminology.hl7.org/CodeSystem/condition-category|encounter-diagnosis`
23
+ * `Condition.rs?category=http://hl7.org/fhir/us/core/CodeSystem/condition-category|health-concern`
24
+ * `Condition.rs?category=http://terminology.hl7.org/CodeSystem/condition-category|problem-list-item`
23
25
 
24
26
  )
25
27
 
@@ -245,6 +245,7 @@
245
245
  :must_supports:
246
246
  :extensions:
247
247
  - :id: Condition.extension:assertedDate
248
+ :path: extension
248
249
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
249
250
  :slices:
250
251
  - :slice_id: Condition.category:us-core
@@ -242,6 +242,7 @@
242
242
  :must_supports:
243
243
  :extensions:
244
244
  - :id: Condition.extension:assertedDate
245
+ :path: extension
245
246
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
246
247
  :slices:
247
248
  - :slice_id: Condition.category:us-core
@@ -369,6 +370,6 @@
369
370
  :file_name: condition_patient_category_encounter_granular_scope_test.rb
370
371
  - :id: us_core_v610_Condition_patient_code_granular_scope_test
371
372
  :file_name: condition_patient_code_granular_scope_test.rb
372
- :id: us_core_v610_condition_granular_scope_2_group
373
- :file_name: condition_granular_scope2_group.rb
373
+ :id: us_core_v610_condition_granular_scope_1_group
374
+ :file_name: condition_granular_scope1_group.rb
374
375
  :delayed_references: []
@@ -273,8 +273,8 @@
273
273
  :file_name: observation_patient_category_date_granular_scope_test.rb
274
274
  - :id: us_core_v610_Observation_patient_code_granular_scope_test
275
275
  :file_name: observation_patient_code_granular_scope_test.rb
276
- :id: us_core_v610_observation_granular_scope_2_group
277
- :file_name: observation_granular_scope2_group.rb
276
+ :id: us_core_v610_observation_granular_scope_1_group
277
+ :file_name: observation_granular_scope1_group.rb
278
278
  :delayed_references:
279
279
  - :path: specimen
280
280
  :resources:
@@ -13,9 +13,13 @@ FHIR API tests, and verify that the resources returned are filtered
13
13
  based on the following granular scopes:
14
14
 
15
15
  * `Condition.rs?category=http://terminology.hl7.org/CodeSystem/condition-category|encounter-diagnosis`
16
+ * `Condition.rs?category=http://hl7.org/fhir/us/core/CodeSystem/condition-category|health-concern`
17
+ * `Condition.rs?category=http://terminology.hl7.org/CodeSystem/condition-category|problem-list-item`
16
18
  * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|laboratory`
17
19
  * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|social-history`
18
- * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|procedure`
20
+ * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|vital-signs`
21
+ * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|survey`
22
+ * `Observation.rs?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-category|sdoh`
19
23
 
20
24
  )
21
25
 
@@ -856,6 +856,7 @@
856
856
  :must_supports:
857
857
  :extensions:
858
858
  - :id: Condition.extension:assertedDate
859
+ :path: extension
859
860
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
860
861
  :slices:
861
862
  - :slice_id: Condition.category:us-core
@@ -1231,6 +1232,7 @@
1231
1232
  :must_supports:
1232
1233
  :extensions:
1233
1234
  - :id: Condition.extension:assertedDate
1235
+ :path: extension
1234
1236
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
1235
1237
  :slices:
1236
1238
  - :slice_id: Condition.category:us-core
@@ -10369,18 +10371,23 @@
10369
10371
  :must_supports:
10370
10372
  :extensions:
10371
10373
  - :id: Patient.extension:race
10374
+ :path: extension
10372
10375
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-race
10373
10376
  :uscdi_only: true
10374
10377
  - :id: Patient.extension:ethnicity
10378
+ :path: extension
10375
10379
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity
10376
10380
  :uscdi_only: true
10377
10381
  - :id: Patient.extension:tribalAffiliation
10382
+ :path: extension
10378
10383
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-tribal-affiliation
10379
10384
  :uscdi_only: true
10380
10385
  - :id: Patient.extension:sex
10386
+ :path: extension
10381
10387
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex
10382
10388
  :uscdi_only: true
10383
10389
  - :id: Patient.extension:genderIdentity
10390
+ :path: extension
10384
10391
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-genderIdentity
10385
10392
  :uscdi_only: true
10386
10393
  :slices: []
@@ -11432,8 +11439,10 @@
11432
11439
  :must_supports:
11433
11440
  :extensions:
11434
11441
  - :id: QuestionnaireResponse.questionnaire.extension:questionnaireDisplay
11442
+ :path: questionnaire.extension
11435
11443
  :url: http://hl7.org/fhir/StructureDefinition/display
11436
11444
  - :id: QuestionnaireResponse.questionnaire.extension:url
11445
+ :path: questionnaire.extension
11437
11446
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-extension-questionnaire-uri
11438
11447
  :slices: []
11439
11448
  :elements:
@@ -12115,15 +12124,9 @@
12115
12124
  Condition:
12116
12125
  - :id: us_core_v610_condition_granular_scope_1_group
12117
12126
  :file_name: condition_granular_scope1_group.rb
12118
- - :id: us_core_v610_condition_granular_scope_2_group
12119
- :file_name: condition_granular_scope2_group.rb
12120
12127
  Observation:
12121
12128
  - :id: us_core_v610_observation_granular_scope_1_group
12122
12129
  :file_name: observation_granular_scope1_group.rb
12123
- - :id: us_core_v610_observation_granular_scope_2_group
12124
- :file_name: observation_granular_scope2_group.rb
12125
12130
  :granular_scope_groups:
12126
12131
  - :id: us_core_v610_smart_granular_scopes_1
12127
12132
  :file_name: granular_scopes1_group.rb
12128
- - :id: us_core_v610_smart_granular_scopes_2
12129
- :file_name: granular_scopes2_group.rb
@@ -16,7 +16,9 @@ based on the following granular scopes:
16
16
 
17
17
  * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|laboratory`
18
18
  * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|social-history`
19
- * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|procedure`
19
+ * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|vital-signs`
20
+ * `Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|survey`
21
+ * `Observation.rs?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-category|sdoh`
20
22
 
21
23
  )
22
24
 
@@ -173,18 +173,23 @@
173
173
  :must_supports:
174
174
  :extensions:
175
175
  - :id: Patient.extension:race
176
+ :path: extension
176
177
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-race
177
178
  :uscdi_only: true
178
179
  - :id: Patient.extension:ethnicity
180
+ :path: extension
179
181
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity
180
182
  :uscdi_only: true
181
183
  - :id: Patient.extension:tribalAffiliation
184
+ :path: extension
182
185
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-tribal-affiliation
183
186
  :uscdi_only: true
184
187
  - :id: Patient.extension:sex
188
+ :path: extension
185
189
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex
186
190
  :uscdi_only: true
187
191
  - :id: Patient.extension:genderIdentity
192
+ :path: extension
188
193
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-genderIdentity
189
194
  :uscdi_only: true
190
195
  :slices: []
@@ -132,8 +132,10 @@
132
132
  :must_supports:
133
133
  :extensions:
134
134
  - :id: QuestionnaireResponse.questionnaire.extension:questionnaireDisplay
135
+ :path: questionnaire.extension
135
136
  :url: http://hl7.org/fhir/StructureDefinition/display
136
137
  - :id: QuestionnaireResponse.questionnaire.extension:url
138
+ :path: questionnaire.extension
137
139
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-extension-questionnaire-uri
138
140
  :slices: []
139
141
  :elements:
@@ -61,7 +61,7 @@ module USCoreTestKit
61
61
  title 'US Core v6.1.0'
62
62
  description %(
63
63
  The US Core Test Kit tests systems for their conformance to the [US Core
64
- Implementation Guide]().
64
+ Implementation Guide](http://hl7.org/fhir/us/core/STU6).
65
65
 
66
66
  HL7® FHIR® resources are validated with the Java validator using
67
67
  `tx.fhir.org` as the terminology server. Users should note that the
@@ -83,6 +83,7 @@ module USCoreTestKit
83
83
  /Provenance.agent\[\d*\]: Rule provenance-1/, #Invalid invariant in US Core v5.0.1
84
84
  %r{Unknown Code System 'http://hl7.org/fhir/us/core/CodeSystem/us-core-tags'}, # Validator has an issue with this US Core 5 code system in US Core 6 resource
85
85
  %r{URL value 'http://hl7.org/fhir/us/core/CodeSystem/us-core-tags' does not resolve}, # Validator has an issue with this US Core 5 code system in US Core 6 resource
86
+ /\A\S+: \S+: URL value '.*' does not resolve/,
86
87
  %r{Observation.component\[\d+\].value.ofType\(Quantity\): The code provided \(http://unitsofmeasure.org#L/min\) was not found in the value set 'Vital Signs Units'} # Known issue with the Pulse Oximetry Profile
87
88
  ].freeze
88
89
 
@@ -94,8 +95,10 @@ module USCoreTestKit
94
95
  end
95
96
  end
96
97
 
97
- validator do
98
- url ENV.fetch('V610_VALIDATOR_URL', 'http://validator_service:4567')
98
+ id :us_core_v610
99
+
100
+ fhir_resource_validator do
101
+ igs 'hl7.fhir.us.core#6.1.0'
99
102
  message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS
100
103
 
101
104
  exclude_message do |message|
@@ -108,8 +111,6 @@ module USCoreTestKit
108
111
  end
109
112
  end
110
113
 
111
- id :us_core_v610
112
-
113
114
  input :url,
114
115
  title: 'FHIR Endpoint',
115
116
  description: 'URL of the FHIR endpoint'
@@ -201,7 +202,7 @@ module USCoreTestKit
201
202
  group from: :us_core_311_data_absent_reason
202
203
  end
203
204
 
204
- group from: :us_core_v610_smart_granular_scopes,
205
+ group from: :'us_core_v610_smart_granular_scopes',
205
206
  required_suite_options: USCoreOptions::SMART_2_REQUIREMENT
206
207
 
207
208
  end
@@ -242,6 +242,7 @@
242
242
  :must_supports:
243
243
  :extensions:
244
244
  - :id: Condition.extension:assertedDate
245
+ :path: extension
245
246
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
246
247
  :slices:
247
248
  - :slice_id: Condition.category:us-core
@@ -245,6 +245,7 @@
245
245
  :must_supports:
246
246
  :extensions:
247
247
  - :id: Condition.extension:assertedDate
248
+ :path: extension
248
249
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
249
250
  :slices:
250
251
  - :slice_id: Condition.category:us-core
@@ -242,6 +242,7 @@
242
242
  :must_supports:
243
243
  :extensions:
244
244
  - :id: Condition.extension:assertedDate
245
+ :path: extension
245
246
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
246
247
  :slices:
247
248
  - :slice_id: Condition.category:us-core
@@ -144,6 +144,7 @@
144
144
  :must_supports:
145
145
  :extensions:
146
146
  - :id: MedicationRequest.extension:medicationAdherence
147
+ :path: extension
147
148
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication-adherence
148
149
  :uscdi_only: true
149
150
  :slices:
@@ -858,6 +858,7 @@
858
858
  :must_supports:
859
859
  :extensions:
860
860
  - :id: Condition.extension:assertedDate
861
+ :path: extension
861
862
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
862
863
  :slices:
863
864
  - :slice_id: Condition.category:us-core
@@ -1234,6 +1235,7 @@
1234
1235
  :must_supports:
1235
1236
  :extensions:
1236
1237
  - :id: Condition.extension:assertedDate
1238
+ :path: extension
1237
1239
  :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate
1238
1240
  :slices:
1239
1241
  - :slice_id: Condition.category:us-core
@@ -3978,6 +3980,7 @@
3978
3980
  :must_supports:
3979
3981
  :extensions:
3980
3982
  - :id: MedicationRequest.extension:medicationAdherence
3983
+ :path: extension
3981
3984
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication-adherence
3982
3985
  :uscdi_only: true
3983
3986
  :slices:
@@ -11389,18 +11392,23 @@
11389
11392
  :must_supports:
11390
11393
  :extensions:
11391
11394
  - :id: Patient.extension:race
11395
+ :path: extension
11392
11396
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-race
11393
11397
  :uscdi_only: true
11394
11398
  - :id: Patient.extension:ethnicity
11399
+ :path: extension
11395
11400
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity
11396
11401
  :uscdi_only: true
11397
11402
  - :id: Patient.extension:tribalAffiliation
11403
+ :path: extension
11398
11404
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-tribal-affiliation
11399
11405
  :uscdi_only: true
11400
11406
  - :id: Patient.extension:sex
11407
+ :path: extension
11401
11408
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex
11402
11409
  :uscdi_only: true
11403
11410
  - :id: Patient.extension:genderIdentity
11411
+ :path: extension
11404
11412
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-genderIdentity
11405
11413
  :uscdi_only: true
11406
11414
  :slices: []
@@ -12474,8 +12482,10 @@
12474
12482
  :must_supports:
12475
12483
  :extensions:
12476
12484
  - :id: QuestionnaireResponse.questionnaire.extension:questionnaireDisplay
12485
+ :path: questionnaire.extension
12477
12486
  :url: http://hl7.org/fhir/StructureDefinition/display
12478
12487
  - :id: QuestionnaireResponse.questionnaire.extension:url
12488
+ :path: questionnaire.extension
12479
12489
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-extension-questionnaire-uri
12480
12490
  :slices: []
12481
12491
  :elements:
@@ -173,18 +173,23 @@
173
173
  :must_supports:
174
174
  :extensions:
175
175
  - :id: Patient.extension:race
176
+ :path: extension
176
177
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-race
177
178
  :uscdi_only: true
178
179
  - :id: Patient.extension:ethnicity
180
+ :path: extension
179
181
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity
180
182
  :uscdi_only: true
181
183
  - :id: Patient.extension:tribalAffiliation
184
+ :path: extension
182
185
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-tribal-affiliation
183
186
  :uscdi_only: true
184
187
  - :id: Patient.extension:sex
188
+ :path: extension
185
189
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex
186
190
  :uscdi_only: true
187
191
  - :id: Patient.extension:genderIdentity
192
+ :path: extension
188
193
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-genderIdentity
189
194
  :uscdi_only: true
190
195
  :slices: []
@@ -132,8 +132,10 @@
132
132
  :must_supports:
133
133
  :extensions:
134
134
  - :id: QuestionnaireResponse.questionnaire.extension:questionnaireDisplay
135
+ :path: questionnaire.extension
135
136
  :url: http://hl7.org/fhir/StructureDefinition/display
136
137
  - :id: QuestionnaireResponse.questionnaire.extension:url
138
+ :path: questionnaire.extension
137
139
  :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-extension-questionnaire-uri
138
140
  :slices: []
139
141
  :elements:
@@ -87,6 +87,7 @@ module USCoreTestKit
87
87
  /Provenance.agent\[\d*\]: Rule provenance-1/, #Invalid invariant in US Core v5.0.1
88
88
  %r{Unknown Code System 'http://hl7.org/fhir/us/core/CodeSystem/us-core-tags'}, # Validator has an issue with this US Core 5 code system in US Core 6 resource
89
89
  %r{URL value 'http://hl7.org/fhir/us/core/CodeSystem/us-core-tags' does not resolve}, # Validator has an issue with this US Core 5 code system in US Core 6 resource
90
+ /\A\S+: \S+: URL value '.*' does not resolve/,
90
91
  %r{Observation.component\[\d+\].value.ofType\(Quantity\): The code provided \(http://unitsofmeasure.org#L/min\) was not found in the value set 'Vital Signs Units'} # Known issue with the Pulse Oximetry Profile
91
92
  ].freeze
92
93
 
@@ -98,8 +99,10 @@ module USCoreTestKit
98
99
  end
99
100
  end
100
101
 
101
- validator do
102
- url ENV.fetch('V700_BALLOT_VALIDATOR_URL', 'http://validator_service:4567')
102
+ id :us_core_v700_ballot
103
+
104
+ fhir_resource_validator do
105
+ igs 'hl7.fhir.us.core#7.0.0-ballot'
103
106
  message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS
104
107
 
105
108
  exclude_message do |message|
@@ -112,8 +115,6 @@ module USCoreTestKit
112
115
  end
113
116
  end
114
117
 
115
- id :us_core_v700_ballot
116
-
117
118
  input :url,
118
119
  title: 'FHIR Endpoint',
119
120
  description: 'URL of the FHIR endpoint'
@@ -209,7 +210,7 @@ module USCoreTestKit
209
210
  group from: :us_core_311_data_absent_reason
210
211
  end
211
212
 
212
- group from: :us_core_v700_ballot_smart_granular_scopes,
213
+ group from: :'us_core_v700_ballot_smart_granular_scopes',
213
214
  required_suite_options: USCoreOptions::SMART_2_REQUIREMENT
214
215
 
215
216
  end
@@ -4,11 +4,18 @@ require_relative '../custom_groups/smart_scopes_constants'
4
4
  module USCoreTestKit
5
5
  class Generator
6
6
  class GranularScopeGroupGenerator
7
+ include SmartScopesConstants
8
+
7
9
  class << self
8
10
  def generate(ig_metadata, base_output_dir)
9
11
  return unless ['6', '7'].include? ig_metadata.ig_version[1]
10
12
 
11
13
  [1, 2].each do |group_number|
14
+ scopes =
15
+ SmartScopesConstants
16
+ .const_get("SMART_GRANULAR_SCOPES_GROUP#{group_number}")[ig_metadata.reformatted_version]
17
+ next if scopes.blank?
18
+
12
19
  new(ig_metadata, base_output_dir, group_number).generate
13
20
  end
14
21
  end
@@ -16,7 +16,7 @@ module USCoreTestKit
16
16
  .const_get("SMART_GRANULAR_SCOPES_GROUP#{group_number}")[ig_metadata.reformatted_version]
17
17
 
18
18
  groups.each do |group_metadata|
19
- next if scopes.none? { |scope| scope.start_with? "patient/#{group_metadata.resource}" }
19
+ next if scopes.blank? || scopes.none? { |scope| scope.start_with? "patient/#{group_metadata.resource}" }
20
20
 
21
21
  new(GroupMetadata.new(group_metadata.to_hash), ig_metadata, base_output_dir, group_number).generate
22
22
  end
@@ -11,12 +11,12 @@ module USCoreTestKit
11
11
 
12
12
  scopes =
13
13
  SmartScopesConstants::SMART_GRANULAR_SCOPES_GROUP1[ig_metadata.reformatted_version] +
14
- SmartScopesConstants::SMART_GRANULAR_SCOPES_GROUP2[ig_metadata.reformatted_version]
14
+ (SmartScopesConstants::SMART_GRANULAR_SCOPES_GROUP2[ig_metadata.reformatted_version] || [])
15
15
 
16
16
  SmartScopesConstants::SMART_GRANULAR_SCOPE_RESOURCES.each do |resource_type|
17
17
  group = ig_metadata.groups.find { |group| group.resource == resource_type }
18
18
 
19
- next if scopes.none? { |scope| scope.start_with? "patient/#{group.resource}" }
19
+ next if scopes.blank? || scopes.none? { |scope| scope.start_with? "patient/#{group.resource}" }
20
20
 
21
21
  group.searches
22
22
  .each { |search| new(group, search, base_output_dir).generate }
@@ -56,7 +56,7 @@ module USCoreTestKit
56
56
  end
57
57
 
58
58
  def no_patient_searches?
59
- searches.none? { |search| search[:names].include? 'patient' }
59
+ searches.none? { |search| search[:names].include?('patient') && search[:expectation] == 'SHALL' }
60
60
  end
61
61
 
62
62
  def non_uscdi_resource?
@@ -48,6 +48,7 @@ module USCoreTestKit
48
48
  must_support_extension_elements.map do |element|
49
49
  {
50
50
  id: element.id,
51
+ path: element.path.gsub("#{resource}.", ''),
51
52
  url: element.type.first.profile.first
52
53
  }.tap do |metadata|
53
54
  if is_uscdi_requirement_element?(element)
@@ -52,16 +52,19 @@ module USCoreTestKit
52
52
  #US Core 4.0.0 Section 10.112.1.1 Additional USCDI v1 Requirement:
53
53
  must_supports[:extensions] << {
54
54
  id: 'Patient.extension:race',
55
+ path: 'extension',
55
56
  url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race',
56
57
  uscdi_only: true
57
58
  }
58
59
  must_supports[:extensions] << {
59
60
  id: 'Patient.extension:ethnicity',
61
+ path: 'extension',
60
62
  url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity',
61
63
  uscdi_only: true
62
64
  }
63
65
  must_supports[:extensions] << {
64
66
  id: 'Patient.extension:birthsex',
67
+ path: 'extension',
65
68
  url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex',
66
69
  uscdi_only: true
67
70
  }
@@ -54,6 +54,7 @@ module USCoreTestKit
54
54
 
55
55
  must_supports[:extensions] << {
56
56
  id: 'Patient.extension:genderIdentity',
57
+ path: 'extension',
57
58
  url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-genderIdentity',
58
59
  uscdi_only: true
59
60
  }
@@ -25,16 +25,14 @@ module USCoreTestKit
25
25
  'Encounter' => ['v311', 'v400'],
26
26
  'Location' => ['v311', 'v400', 'v501', 'v610'],
27
27
  'Organization' => ['v311', 'v400', 'v501', 'v610', 'v700_ballot'],
28
- 'Practitioner' => ['v311', 'v400'],
28
+ 'Practitioner' => ['v311', 'v400', 'v501', 'v610', 'v700_ballot'],
29
29
  'PractitionerRole' => ['v311', 'v400', 'v501', 'v610', 'v700_ballot'],
30
30
  'Provenance' => ['v311', 'v400', 'v501', 'v610', 'v700_ballot'],
31
- 'RelatedPerson' => ['v501', 'v610', 'v700_ballot'],
32
- 'Specimen' => ['v610', 'v700_ballot']
31
+ 'RelatedPerson' => ['v501', 'v610', 'v700_ballot']
33
32
  }.freeze
34
33
 
35
34
  SEARCHABLE_DELAYED_RESOURCES = {
36
- 'Location' => ['v700_ballot'],
37
- 'Practitioner' => ['v501', 'v610', 'v700_ballot']
35
+ 'Location' => ['v700_ballot']
38
36
  }.freeze
39
37
 
40
38
  ALL_VERSION_CATEGORY_FIRST_PROFILES = [
@@ -57,12 +57,15 @@ module USCoreTestKit
57
57
  "US Core #{ig_metadata.ig_version}"
58
58
  end
59
59
 
60
- def validator_env_name
61
- "#{ig_metadata.reformatted_version.upcase}_VALIDATOR_URL"
60
+ def ig_identifier
61
+ version = ig_metadata.ig_version[1..] # Remove leading 'v'
62
+ "hl7.fhir.us.core##{version}"
62
63
  end
63
64
 
64
65
  def ig_link
65
66
  case ig_metadata.ig_version
67
+ when 'v6.1.0'
68
+ 'http://hl7.org/fhir/us/core/STU6'
66
69
  when 'v5.0.1'
67
70
  'http://hl7.org/fhir/us/core/STU5.0.1'
68
71
  when 'v4.0.0'
@@ -83,7 +83,17 @@ module USCoreTestKit
83
83
  @missing_extensions ||=
84
84
  must_support_extensions.select do |extension_definition|
85
85
  resources.none? do |resource|
86
- resource.extension.any? { |extension| extension.url == extension_definition[:url] }
86
+ path = extension_definition[:path]
87
+
88
+ if path == 'extension'
89
+ resource.extension.any? { |extension| extension.url == extension_definition[:url] }
90
+ else
91
+ extension = find_a_value_at(resource, path) do |el|
92
+ el.url == extension_definition[:url]
93
+ end
94
+
95
+ extension.present?
96
+ end
87
97
  end
88
98
  end
89
99
  end
@@ -100,14 +110,23 @@ module USCoreTestKit
100
110
  @missing_elements ||=
101
111
  must_support_elements.select do |element_definition|
102
112
  resources.none? do |resource|
103
- path = element_definition[:path] #.delete_suffix('[x]')
113
+ path = element_definition[:path]
114
+ ms_extension_urls = must_support_extensions.select { |ex| ex[:path] == "#{path}.extension" }
115
+ .map { |ex| ex[:url] }
116
+
104
117
  value_found = find_a_value_at(resource, path) do |value|
105
- value_without_extensions =
106
- value.respond_to?(:to_hash) ? value.to_hash.reject { |key, _| key == 'extension' } : value
118
+ if value.respond_to?(:extension) && ms_extension_urls.present?
119
+ urls = value.extension.map(&:url)
120
+ has_ms_extension = (urls & ms_extension_urls).present?
121
+ end
107
122
 
108
- (value_without_extensions.present? || value_without_extensions == false) &&
109
- (element_definition[:fixed_value].blank? || value == element_definition[:fixed_value])
123
+ unless has_ms_extension
124
+ value_without_extensions =
125
+ value.respond_to?(:to_hash) ? value.to_hash.reject { |key, _| key == 'extension' } : value
126
+ end
110
127
 
128
+ (has_ms_extension || value_without_extensions.present? || value_without_extensions == false) &&
129
+ (element_definition[:fixed_value].blank? || value == element_definition[:fixed_value])
111
130
  end
112
131
  # Note that false.present? => false, which is why we need to add this extra check
113
132
  value_found.present? || value_found == false
@@ -165,7 +165,8 @@ module USCoreTestKit
165
165
 
166
166
  target_profile_with_version = target_profile.include?('|') ? target_profile : "#{target_profile}|#{metadata.profile_version}"
167
167
 
168
- outcome = FHIR::OperationOutcome.new(JSON.parse(validator.validate(resource, target_profile_with_version)))
168
+ validator_response = validator.validate(resource, target_profile_with_version)
169
+ outcome = validator.operation_outcome_from_hl7_wrapped_response(validator_response)
169
170
 
170
171
  message_hashes = outcome.issue&.map { |issue| validator.message_hash_from_issue(issue, resource) } || []
171
172
 
@@ -676,6 +676,8 @@ module USCoreTestKit
676
676
  (element.family || element.given&.first || element.text).present?
677
677
  when FHIR::Address
678
678
  (element.text || element.city || element.state || element.postalCode || element.country).present?
679
+ when FHIR::Element
680
+ false
679
681
  else
680
682
  true
681
683
  end