us_core_test_kit 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/us_core_test_kit/generated/v3.1.1/document_reference/document_reference_must_support_test.rb +0 -1
- data/lib/us_core_test_kit/generated/v3.1.1/document_reference/document_reference_reference_resolution_test.rb +0 -1
- data/lib/us_core_test_kit/generated/v3.1.1/document_reference/metadata.yml +0 -3
- data/lib/us_core_test_kit/generated/v3.1.1/goal/metadata.yml +1 -1
- data/lib/us_core_test_kit/generated/v3.1.1/metadata.yml +1 -4
- data/lib/us_core_test_kit/generated/v4.0.0/goal/metadata.yml +1 -1
- data/lib/us_core_test_kit/generated/v4.0.0/metadata.yml +1 -1
- data/lib/us_core_test_kit/generated/v5.0.1/goal/metadata.yml +1 -1
- data/lib/us_core_test_kit/generated/v5.0.1/medication_request/metadata.yml +5 -1
- data/lib/us_core_test_kit/generated/v5.0.1/metadata.yml +6 -2
- data/lib/us_core_test_kit/generator/must_support_metadata_extractor.rb +17 -7
- data/lib/us_core_test_kit/generator/search_definition_metadata_extractor.rb +9 -40
- data/lib/us_core_test_kit/generator/value_extractor.rb +50 -0
- data/lib/us_core_test_kit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2165ec13e4df3f34f052db84ac66517f2c05287f7337a262419c67c35e8b166
|
4
|
+
data.tar.gz: f05531ac89796f43c6199889370741b1f2f78e187169f7c5153df2264fa87dbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81d0e3b1eb27d76f15855b378fe50596f9c75dc639f3a824ed4871e7b7a102ebc4a500a56773d818ac1ec19bb148d0c9fc9ddc4a8270e38c6827b31f2e5454de
|
7
|
+
data.tar.gz: 2960026760e8b35b815016a76388125d5730b2074d4b10155b5eeb654f3b40028df7311ac241b3706c58541f8140cac59ed23d6f9a9bb2a346696c40ef37a72b
|
@@ -4645,9 +4645,6 @@
|
|
4645
4645
|
- :path: author
|
4646
4646
|
:types:
|
4647
4647
|
- Reference
|
4648
|
-
- :path: custodian
|
4649
|
-
:types:
|
4650
|
-
- Reference
|
4651
4648
|
- :path: content
|
4652
4649
|
- :path: content.attachment
|
4653
4650
|
- :path: content.attachment.contentType
|
@@ -5279,7 +5276,7 @@
|
|
5279
5276
|
:path: target.measure
|
5280
5277
|
- :type: Quantity
|
5281
5278
|
:strength: example
|
5282
|
-
:system:
|
5279
|
+
:system:
|
5283
5280
|
:path: target.detail
|
5284
5281
|
- :type: CodeableConcept
|
5285
5282
|
:strength: example
|
@@ -6904,7 +6904,7 @@
|
|
6904
6904
|
:path: target.measure
|
6905
6905
|
- :type: Quantity
|
6906
6906
|
:strength: example
|
6907
|
-
:system:
|
6907
|
+
:system:
|
6908
6908
|
:path: target.detail
|
6909
6909
|
- :type: CodeableConcept
|
6910
6910
|
:strength: example
|
@@ -7534,7 +7534,11 @@
|
|
7534
7534
|
:discriminator:
|
7535
7535
|
:type: requiredBinding
|
7536
7536
|
:path: ''
|
7537
|
-
:values:
|
7537
|
+
:values:
|
7538
|
+
- inpatient
|
7539
|
+
- outpatient
|
7540
|
+
- community
|
7541
|
+
- discharge
|
7538
7542
|
:elements:
|
7539
7543
|
- :path: status
|
7540
7544
|
- :path: intent
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'value_extractor'
|
2
|
+
|
1
3
|
module USCoreTestKit
|
2
4
|
class Generator
|
3
5
|
class MustSupportMetadataExtractor
|
@@ -97,13 +99,10 @@ module USCoreTestKit
|
|
97
99
|
elsif pattern_element.binding&.strength == 'required' &&
|
98
100
|
pattern_element.binding&.valueSet.present?
|
99
101
|
|
100
|
-
|
101
|
-
bound_systems = value_set&.compose&.include&.reject { |code| code.concept.blank? }
|
102
|
-
values = []
|
102
|
+
value_extractor = ValueExactor.new(ig_resources, resource)
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
end
|
104
|
+
values = value_extractor.values_from_value_set_binding(pattern_element).presence ||
|
105
|
+
value_extractor.values_from_resource_metadata([metadata[:path]]).presence || []
|
107
106
|
|
108
107
|
{
|
109
108
|
type: 'requiredBinding',
|
@@ -292,6 +291,8 @@ module USCoreTestKit
|
|
292
291
|
add_must_support_choices
|
293
292
|
|
294
293
|
case profile.version
|
294
|
+
when '3.1.1'
|
295
|
+
remove_document_reference_custodian
|
295
296
|
when '4.0.0'
|
296
297
|
add_device_distinct_identifier
|
297
298
|
add_patient_uscdi_elements
|
@@ -354,6 +355,15 @@ module USCoreTestKit
|
|
354
355
|
end
|
355
356
|
end
|
356
357
|
|
358
|
+
# US Core clarified that server implmentation is not required to support DocumentReference.custodian (FHIR-28393)
|
359
|
+
def remove_document_reference_custodian
|
360
|
+
if profile.type == 'DocumentReference'
|
361
|
+
@must_supports[:elements].delete_if do |element|
|
362
|
+
element[:path] == 'custodian'
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
357
367
|
def remove_document_reference_attachment_data_url
|
358
368
|
if profile.type == 'DocumentReference'
|
359
369
|
@must_supports[:elements].delete_if do |element|
|
@@ -482,7 +492,7 @@ module USCoreTestKit
|
|
482
492
|
|
483
493
|
slice = @must_supports[:slices].find{|slice| slice[:path] == 'category'}
|
484
494
|
|
485
|
-
slice[:discriminator][:values]
|
495
|
+
slice[:discriminator][:values] = ['clinical-note'] if slice.present?
|
486
496
|
end
|
487
497
|
|
488
498
|
# FHIR-37794 Server systems are not required to support US Core QuestionnaireResponse
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'value_extractor'
|
2
|
+
|
1
3
|
module USCoreTestKit
|
2
4
|
class Generator
|
3
5
|
class SearchDefinitionMetadataExtractor
|
@@ -113,14 +115,15 @@ module USCoreTestKit
|
|
113
115
|
|
114
116
|
def values
|
115
117
|
values = (
|
116
|
-
(
|
117
118
|
values_from_pattern_codeable_concept_slices +
|
118
119
|
values_from_required_binding_slices +
|
119
120
|
values_from_fixed_codes +
|
120
121
|
values_from_pattern_coding +
|
121
122
|
values_from_pattern_codeable_concept
|
122
|
-
).uniq.presence ||
|
123
|
-
|
123
|
+
).uniq.presence ||
|
124
|
+
value_extractor.values_from_value_set_binding(profile_element).presence ||
|
125
|
+
value_extractor.values_from_resource_metadata(paths).presence || []
|
126
|
+
|
124
127
|
values
|
125
128
|
end
|
126
129
|
|
@@ -146,7 +149,7 @@ module USCoreTestKit
|
|
146
149
|
def values_from_required_binding_slices
|
147
150
|
slices.map do |slice|
|
148
151
|
if slice.binding.present? && slice.binding.strength == 'required'
|
149
|
-
values_from_value_set_binding(slice)
|
152
|
+
value_extractor.values_from_value_set_binding(slice)
|
150
153
|
end
|
151
154
|
end.flatten.compact
|
152
155
|
end
|
@@ -173,42 +176,8 @@ module USCoreTestKit
|
|
173
176
|
[profile_element.patternCodeableConcept.coding.first.code]
|
174
177
|
end
|
175
178
|
|
176
|
-
def
|
177
|
-
|
178
|
-
end
|
179
|
-
|
180
|
-
def value_set(the_element)
|
181
|
-
ig_resources.value_set_by_url(value_set_binding(the_element)&.valueSet)
|
182
|
-
end
|
183
|
-
|
184
|
-
def bound_systems(the_element)
|
185
|
-
value_set(the_element)&.compose&.include&.reject { |code| code.concept.nil? }
|
186
|
-
end
|
187
|
-
|
188
|
-
def values_from_value_set_binding(the_element)
|
189
|
-
bound_systems = bound_systems(the_element)
|
190
|
-
|
191
|
-
return [] if bound_systems.blank?
|
192
|
-
|
193
|
-
bound_systems.flat_map { |system| system.concept.map { |code| code.code } }.uniq
|
194
|
-
end
|
195
|
-
|
196
|
-
def fhir_metadata(current_path)
|
197
|
-
FHIR.const_get(resource)::METADATA[current_path]
|
198
|
-
end
|
199
|
-
|
200
|
-
def values_from_resource_metadata
|
201
|
-
values = []
|
202
|
-
|
203
|
-
paths.each do |current_path|
|
204
|
-
current_metadata = fhir_metadata(current_path)
|
205
|
-
|
206
|
-
if current_metadata&.dig('valid_codes').present?
|
207
|
-
values = values + current_metadata['valid_codes'].values.flatten
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
values
|
179
|
+
def value_extractor
|
180
|
+
@value_extractor ||= ValueExactor.new(ig_resources, resource)
|
212
181
|
end
|
213
182
|
end
|
214
183
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module USCoreTestKit
|
2
|
+
class Generator
|
3
|
+
class ValueExactor
|
4
|
+
attr_accessor :ig_resources, :resource
|
5
|
+
|
6
|
+
def initialize(ig_resources, resource)
|
7
|
+
self.ig_resources = ig_resources
|
8
|
+
self.resource = resource
|
9
|
+
end
|
10
|
+
|
11
|
+
def value_set_binding(the_element)
|
12
|
+
the_element&.binding
|
13
|
+
end
|
14
|
+
|
15
|
+
def value_set(the_element)
|
16
|
+
ig_resources.value_set_by_url(value_set_binding(the_element)&.valueSet)
|
17
|
+
end
|
18
|
+
|
19
|
+
def bound_systems(the_element)
|
20
|
+
value_set(the_element)&.compose&.include&.reject { |code| code.concept.nil? }
|
21
|
+
end
|
22
|
+
|
23
|
+
def values_from_value_set_binding(the_element)
|
24
|
+
bound_systems = bound_systems(the_element)
|
25
|
+
|
26
|
+
return [] if bound_systems.blank?
|
27
|
+
|
28
|
+
bound_systems.flat_map { |system| system.concept.map { |code| code.code } }.uniq
|
29
|
+
end
|
30
|
+
|
31
|
+
def fhir_metadata(current_path)
|
32
|
+
FHIR.const_get(resource)::METADATA[current_path]
|
33
|
+
end
|
34
|
+
|
35
|
+
def values_from_resource_metadata(paths)
|
36
|
+
values = []
|
37
|
+
|
38
|
+
paths.each do |current_path|
|
39
|
+
current_metadata = fhir_metadata(current_path)
|
40
|
+
|
41
|
+
if current_metadata&.dig('valid_codes').present?
|
42
|
+
values = values + current_metadata['valid_codes'].values.flatten
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
values
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: us_core_test_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen MacVicar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|
@@ -1292,6 +1292,7 @@ files:
|
|
1292
1292
|
- lib/us_core_test_kit/generator/suite_generator.rb
|
1293
1293
|
- lib/us_core_test_kit/generator/terminology_binding_metadata_extractor.rb
|
1294
1294
|
- lib/us_core_test_kit/generator/validation_test_generator.rb
|
1295
|
+
- lib/us_core_test_kit/generator/value_extractor.rb
|
1295
1296
|
- lib/us_core_test_kit/igs/us_core_311.tgz
|
1296
1297
|
- lib/us_core_test_kit/igs/us_core_311/StructureDefinition-bodyheight.json
|
1297
1298
|
- lib/us_core_test_kit/igs/us_core_311/StructureDefinition-bodytemp.json
|