us_core_test_kit 0.4.6 → 0.4.7
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/fhir_resource_navigation.rb +9 -3
- data/lib/us_core_test_kit/generated/v3.1.1/metadata.yml +9 -1
- data/lib/us_core_test_kit/generated/v3.1.1/patient/metadata.yml +9 -1
- data/lib/us_core_test_kit/generated/v3.1.1/patient/patient_must_support_test.rb +5 -1
- data/lib/us_core_test_kit/generated/v4.0.0/metadata.yml +9 -3
- data/lib/us_core_test_kit/generated/v4.0.0/patient/metadata.yml +9 -3
- data/lib/us_core_test_kit/generated/v4.0.0/patient/patient_must_support_test.rb +2 -2
- data/lib/us_core_test_kit/generated/v5.0.1/condition_encounter_diagnosis/metadata.yml +4 -4
- data/lib/us_core_test_kit/generated/v5.0.1/condition_problems_health_concerns/metadata.yml +4 -4
- data/lib/us_core_test_kit/generated/v5.0.1/metadata.yml +17 -11
- data/lib/us_core_test_kit/generated/v5.0.1/patient/metadata.yml +9 -3
- data/lib/us_core_test_kit/generated/v5.0.1/patient/patient_must_support_test.rb +2 -4
- data/lib/us_core_test_kit/generator/must_support_metadata_extractor_us_core_3.rb +23 -0
- data/lib/us_core_test_kit/generator/must_support_metadata_extractor_us_core_4.rb +24 -4
- data/lib/us_core_test_kit/generator/must_support_metadata_extractor_us_core_5.rb +5 -0
- data/lib/us_core_test_kit/generator/search_definition_metadata_extractor.rb +52 -4
- data/lib/us_core_test_kit/igs/us_core_501/StructureDefinition-condition-assertedDate.json +280 -0
- data/lib/us_core_test_kit/search_test.rb +1 -1
- 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: 9580bce91af645498d5ca61297a7900bfd2ed2abd400ae55308c2f209a4e14ff
|
4
|
+
data.tar.gz: 2945d9afa14d016011f3c84a2d4d035ec1bfa05117a1b5d20aa6d549fb368a05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 134c8e48cc4731b4be03739b99ab90011c30de23d379699db6b91cc993f8f0d5fee1b52f9f0c1759c383d1a87bfa2fbef008c60eec9b3ef21261e0908efd9f66
|
7
|
+
data.tar.gz: c9deea8845664b41cb335ffa428edeeabe26ad94cd11cd69ae0832a892fcfb13f3b910a54a29cb8e775c8d9e14b8fcaddd6a949bb1ae465eee3c881d1a68be20
|
@@ -6,7 +6,7 @@ module USCoreTestKit
|
|
6
6
|
elements = Array.wrap(elements)
|
7
7
|
return elements if path.blank?
|
8
8
|
|
9
|
-
paths = path.split(
|
9
|
+
paths = path.split(/(?<!hl7)\./)
|
10
10
|
segment = paths.first
|
11
11
|
remaining_path = paths.drop(1).join('.')
|
12
12
|
|
@@ -33,7 +33,7 @@ module USCoreTestKit
|
|
33
33
|
return elements.first
|
34
34
|
end
|
35
35
|
|
36
|
-
path_segments = path.split(
|
36
|
+
path_segments = path.split(/(?<!hl7)\./)
|
37
37
|
segment = path_segments.shift.delete_suffix('[x]').to_sym
|
38
38
|
|
39
39
|
no_elements_present =
|
@@ -63,7 +63,13 @@ module USCoreTestKit
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def get_next_value(element, property)
|
66
|
-
|
66
|
+
extension_url = property[/(?<=where\(url=').*(?='\))/]
|
67
|
+
|
68
|
+
if extension_url.present?
|
69
|
+
element.url == extension_url ? element : nil
|
70
|
+
else
|
71
|
+
element.send(property)
|
72
|
+
end
|
67
73
|
rescue NoMethodError
|
68
74
|
nil
|
69
75
|
end
|
@@ -6040,9 +6040,17 @@
|
|
6040
6040
|
- :path: address.city
|
6041
6041
|
- :path: address.state
|
6042
6042
|
- :path: address.postalCode
|
6043
|
-
- :path: address.period
|
6044
6043
|
- :path: communication
|
6045
6044
|
- :path: communication.language
|
6045
|
+
:choices:
|
6046
|
+
- :paths:
|
6047
|
+
- address.period.end
|
6048
|
+
- address.use
|
6049
|
+
:uscdi_only: true
|
6050
|
+
- :paths:
|
6051
|
+
- name.period.end
|
6052
|
+
- name.use
|
6053
|
+
:uscdi_only: true
|
6046
6054
|
:mandatory_elements:
|
6047
6055
|
- Patient.identifier
|
6048
6056
|
- Patient.identifier.system
|
@@ -171,9 +171,17 @@
|
|
171
171
|
- :path: address.city
|
172
172
|
- :path: address.state
|
173
173
|
- :path: address.postalCode
|
174
|
-
- :path: address.period
|
175
174
|
- :path: communication
|
176
175
|
- :path: communication.language
|
176
|
+
:choices:
|
177
|
+
- :paths:
|
178
|
+
- address.period.end
|
179
|
+
- address.use
|
180
|
+
:uscdi_only: true
|
181
|
+
- :paths:
|
182
|
+
- name.period.end
|
183
|
+
- name.use
|
184
|
+
:uscdi_only: true
|
177
185
|
:mandatory_elements:
|
178
186
|
- Patient.identifier
|
179
187
|
- Patient.identifier.system
|
@@ -15,7 +15,6 @@ module USCoreTestKit
|
|
15
15
|
* Patient.address
|
16
16
|
* Patient.address.city
|
17
17
|
* Patient.address.line
|
18
|
-
* Patient.address.period
|
19
18
|
* Patient.address.postalCode
|
20
19
|
* Patient.address.state
|
21
20
|
* Patient.birthDate
|
@@ -35,6 +34,11 @@ module USCoreTestKit
|
|
35
34
|
* Patient.telecom.system
|
36
35
|
* Patient.telecom.use
|
37
36
|
* Patient.telecom.value
|
37
|
+
|
38
|
+
For ONC USCDI requirements, each Patient must support the following additional elements:
|
39
|
+
|
40
|
+
* Patient.address.period.end or Patient.address.use
|
41
|
+
* Patient.name.period.end or Patient.name.use
|
38
42
|
)
|
39
43
|
|
40
44
|
id :us_core_v311_patient_must_support_test
|
@@ -6543,17 +6543,23 @@
|
|
6543
6543
|
- :path: address.city
|
6544
6544
|
- :path: address.state
|
6545
6545
|
- :path: address.postalCode
|
6546
|
-
- :path: address.period
|
6547
6546
|
- :path: communication.language
|
6548
6547
|
:uscdi_only: true
|
6549
6548
|
- :path: name.suffix
|
6550
6549
|
:uscdi_only: true
|
6551
|
-
- :path: name.period.end
|
6552
|
-
:uscdi_only: true
|
6553
6550
|
- :path: telecom
|
6554
6551
|
:uscdi_only: true
|
6555
6552
|
- :path: communication
|
6556
6553
|
:uscdi_only: true
|
6554
|
+
:choices:
|
6555
|
+
- :paths:
|
6556
|
+
- address.period.end
|
6557
|
+
- address.use
|
6558
|
+
:uscdi_only: true
|
6559
|
+
- :paths:
|
6560
|
+
- name.period.end
|
6561
|
+
- name.use
|
6562
|
+
:uscdi_only: true
|
6557
6563
|
:mandatory_elements:
|
6558
6564
|
- Patient.identifier
|
6559
6565
|
- Patient.identifier.system
|
@@ -176,17 +176,23 @@
|
|
176
176
|
- :path: address.city
|
177
177
|
- :path: address.state
|
178
178
|
- :path: address.postalCode
|
179
|
-
- :path: address.period
|
180
179
|
- :path: communication.language
|
181
180
|
:uscdi_only: true
|
182
181
|
- :path: name.suffix
|
183
182
|
:uscdi_only: true
|
184
|
-
- :path: name.period.end
|
185
|
-
:uscdi_only: true
|
186
183
|
- :path: telecom
|
187
184
|
:uscdi_only: true
|
188
185
|
- :path: communication
|
189
186
|
:uscdi_only: true
|
187
|
+
:choices:
|
188
|
+
- :paths:
|
189
|
+
- address.period.end
|
190
|
+
- address.use
|
191
|
+
:uscdi_only: true
|
192
|
+
- :paths:
|
193
|
+
- name.period.end
|
194
|
+
- name.use
|
195
|
+
:uscdi_only: true
|
190
196
|
:mandatory_elements:
|
191
197
|
- Patient.identifier
|
192
198
|
- Patient.identifier.system
|
@@ -15,7 +15,6 @@ module USCoreTestKit
|
|
15
15
|
* Patient.address
|
16
16
|
* Patient.address.city
|
17
17
|
* Patient.address.line
|
18
|
-
* Patient.address.period
|
19
18
|
* Patient.address.postalCode
|
20
19
|
* Patient.address.state
|
21
20
|
* Patient.birthDate
|
@@ -29,12 +28,13 @@ module USCoreTestKit
|
|
29
28
|
|
30
29
|
For ONC USCDI requirements, each Patient must support the following additional elements:
|
31
30
|
|
31
|
+
* Patient.address.period.end or Patient.address.use
|
32
32
|
* Patient.communication
|
33
33
|
* Patient.communication.language
|
34
34
|
* Patient.extension:birthsex
|
35
35
|
* Patient.extension:ethnicity
|
36
36
|
* Patient.extension:race
|
37
|
-
* Patient.name.period.end
|
37
|
+
* Patient.name.period.end or Patient.name.use
|
38
38
|
* Patient.name.suffix
|
39
39
|
* Patient.telecom
|
40
40
|
* Patient.telecom.system
|
@@ -120,9 +120,9 @@
|
|
120
120
|
:multiple_or: MAY
|
121
121
|
:asserted-date:
|
122
122
|
:paths:
|
123
|
-
- extension
|
123
|
+
- extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime
|
124
124
|
:full_paths:
|
125
|
-
- Condition.extension
|
125
|
+
- Condition.extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime
|
126
126
|
:comparators:
|
127
127
|
:eq: MAY
|
128
128
|
:ne: MAY
|
@@ -134,8 +134,8 @@
|
|
134
134
|
:eb: MAY
|
135
135
|
:ap: MAY
|
136
136
|
:values: []
|
137
|
-
:type:
|
138
|
-
:contains_multiple:
|
137
|
+
:type: dateTime
|
138
|
+
:contains_multiple: false
|
139
139
|
:multiple_or: MAY
|
140
140
|
:code:
|
141
141
|
:paths:
|
@@ -121,9 +121,9 @@
|
|
121
121
|
:multiple_or: MAY
|
122
122
|
:asserted-date:
|
123
123
|
:paths:
|
124
|
-
- extension
|
124
|
+
- extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime
|
125
125
|
:full_paths:
|
126
|
-
- Condition.extension
|
126
|
+
- Condition.extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime
|
127
127
|
:comparators:
|
128
128
|
:eq: MAY
|
129
129
|
:ne: MAY
|
@@ -135,8 +135,8 @@
|
|
135
135
|
:eb: MAY
|
136
136
|
:ap: MAY
|
137
137
|
:values: []
|
138
|
-
:type:
|
139
|
-
:contains_multiple:
|
138
|
+
:type: dateTime
|
139
|
+
:contains_multiple: false
|
140
140
|
:multiple_or: MAY
|
141
141
|
:code:
|
142
142
|
:paths:
|
@@ -669,9 +669,9 @@
|
|
669
669
|
:multiple_or: MAY
|
670
670
|
:asserted-date:
|
671
671
|
:paths:
|
672
|
-
- extension
|
672
|
+
- extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime
|
673
673
|
:full_paths:
|
674
|
-
- Condition.extension
|
674
|
+
- Condition.extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime
|
675
675
|
:comparators:
|
676
676
|
:eq: MAY
|
677
677
|
:ne: MAY
|
@@ -683,8 +683,8 @@
|
|
683
683
|
:eb: MAY
|
684
684
|
:ap: MAY
|
685
685
|
:values: []
|
686
|
-
:type:
|
687
|
-
:contains_multiple:
|
686
|
+
:type: dateTime
|
687
|
+
:contains_multiple: false
|
688
688
|
:multiple_or: MAY
|
689
689
|
:code:
|
690
690
|
:paths:
|
@@ -976,9 +976,9 @@
|
|
976
976
|
:multiple_or: MAY
|
977
977
|
:asserted-date:
|
978
978
|
:paths:
|
979
|
-
- extension
|
979
|
+
- extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime
|
980
980
|
:full_paths:
|
981
|
-
- Condition.extension
|
981
|
+
- Condition.extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime
|
982
982
|
:comparators:
|
983
983
|
:eq: MAY
|
984
984
|
:ne: MAY
|
@@ -990,8 +990,8 @@
|
|
990
990
|
:eb: MAY
|
991
991
|
:ap: MAY
|
992
992
|
:values: []
|
993
|
-
:type:
|
994
|
-
:contains_multiple:
|
993
|
+
:type: dateTime
|
994
|
+
:contains_multiple: false
|
995
995
|
:multiple_or: MAY
|
996
996
|
:code:
|
997
997
|
:paths:
|
@@ -8780,13 +8780,10 @@
|
|
8780
8780
|
- :path: address.city
|
8781
8781
|
- :path: address.state
|
8782
8782
|
- :path: address.postalCode
|
8783
|
-
- :path: address.period
|
8784
8783
|
- :path: communication.language
|
8785
8784
|
:uscdi_only: true
|
8786
8785
|
- :path: name.suffix
|
8787
8786
|
:uscdi_only: true
|
8788
|
-
- :path: name.period.end
|
8789
|
-
:uscdi_only: true
|
8790
8787
|
- :path: telecom
|
8791
8788
|
:uscdi_only: true
|
8792
8789
|
- :path: communication
|
@@ -8797,6 +8794,15 @@
|
|
8797
8794
|
- :path: name.use
|
8798
8795
|
:fixed_value: old
|
8799
8796
|
:uscdi_only: true
|
8797
|
+
:choices:
|
8798
|
+
- :paths:
|
8799
|
+
- address.period.end
|
8800
|
+
- address.use
|
8801
|
+
:uscdi_only: true
|
8802
|
+
- :paths:
|
8803
|
+
- name.period.end
|
8804
|
+
- name.use
|
8805
|
+
:uscdi_only: true
|
8800
8806
|
:mandatory_elements:
|
8801
8807
|
- Patient.identifier
|
8802
8808
|
- Patient.identifier.system
|
@@ -179,13 +179,10 @@
|
|
179
179
|
- :path: address.city
|
180
180
|
- :path: address.state
|
181
181
|
- :path: address.postalCode
|
182
|
-
- :path: address.period
|
183
182
|
- :path: communication.language
|
184
183
|
:uscdi_only: true
|
185
184
|
- :path: name.suffix
|
186
185
|
:uscdi_only: true
|
187
|
-
- :path: name.period.end
|
188
|
-
:uscdi_only: true
|
189
186
|
- :path: telecom
|
190
187
|
:uscdi_only: true
|
191
188
|
- :path: communication
|
@@ -196,6 +193,15 @@
|
|
196
193
|
- :path: name.use
|
197
194
|
:fixed_value: old
|
198
195
|
:uscdi_only: true
|
196
|
+
:choices:
|
197
|
+
- :paths:
|
198
|
+
- address.period.end
|
199
|
+
- address.use
|
200
|
+
:uscdi_only: true
|
201
|
+
- :paths:
|
202
|
+
- name.period.end
|
203
|
+
- name.use
|
204
|
+
:uscdi_only: true
|
199
205
|
:mandatory_elements:
|
200
206
|
- Patient.identifier
|
201
207
|
- Patient.identifier.system
|
@@ -15,7 +15,6 @@ module USCoreTestKit
|
|
15
15
|
* Patient.address
|
16
16
|
* Patient.address.city
|
17
17
|
* Patient.address.line
|
18
|
-
* Patient.address.period
|
19
18
|
* Patient.address.postalCode
|
20
19
|
* Patient.address.state
|
21
20
|
* Patient.birthDate
|
@@ -29,16 +28,15 @@ module USCoreTestKit
|
|
29
28
|
|
30
29
|
For ONC USCDI requirements, each Patient must support the following additional elements:
|
31
30
|
|
32
|
-
* Patient.address.use
|
31
|
+
* Patient.address.period.end or Patient.address.use
|
33
32
|
* Patient.communication
|
34
33
|
* Patient.communication.language
|
35
34
|
* Patient.extension:birthsex
|
36
35
|
* Patient.extension:ethnicity
|
37
36
|
* Patient.extension:genderIdentity
|
38
37
|
* Patient.extension:race
|
39
|
-
* Patient.name.period.end
|
38
|
+
* Patient.name.period.end or Patient.name.use
|
40
39
|
* Patient.name.suffix
|
41
|
-
* Patient.name.use
|
42
40
|
* Patient.telecom
|
43
41
|
* Patient.telecom.system
|
44
42
|
* Patient.telecom.use
|
@@ -10,6 +10,7 @@ module USCoreTestKit
|
|
10
10
|
|
11
11
|
def handle_special_cases
|
12
12
|
add_must_support_choices
|
13
|
+
remove_patient_address_period
|
13
14
|
remove_document_reference_custodian
|
14
15
|
end
|
15
16
|
|
@@ -21,11 +22,33 @@ module USCoreTestKit
|
|
21
22
|
choices << { paths: ['udiCarrier.carrierAIDC', 'udiCarrier.carrierHRF'] }
|
22
23
|
when 'DocumentReference'
|
23
24
|
choices << { paths: ['content.attachment.data', 'content.attachment.url'] }
|
25
|
+
when 'Patient'
|
26
|
+
# FHIR-40299 adds USCDI MustSupport choices for:
|
27
|
+
# * address.period.end and address.use,
|
28
|
+
# * name.period.end and name.use
|
29
|
+
choices << {
|
30
|
+
paths: ['address.period.end', 'address.use'],
|
31
|
+
uscdi_only: true
|
32
|
+
}
|
33
|
+
|
34
|
+
choices << {
|
35
|
+
paths: ['name.period.end', 'name.use'],
|
36
|
+
uscdi_only: true
|
37
|
+
}
|
24
38
|
end
|
25
39
|
|
26
40
|
must_supports[:choices] = choices if choices.present?
|
27
41
|
end
|
28
42
|
|
43
|
+
# FHIR-40299 removes Patient.address.period from MustSupport,
|
44
|
+
def remove_patient_address_period
|
45
|
+
return unless profile.type == 'Patient'
|
46
|
+
|
47
|
+
must_supports[:elements].delete_if do |element|
|
48
|
+
element[:path] == 'address.period'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
29
52
|
# US Core clarified that server implmentation is not required to support DocumentReference.custodian (FHIR-28393)
|
30
53
|
def remove_document_reference_custodian
|
31
54
|
return unless profile.type == 'DocumentReference'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'must_support_metadata_extractor_us_core_3'
|
2
|
+
|
1
3
|
module USCoreTestKit
|
2
4
|
class Generator
|
3
5
|
class MustSupportMetadataExtractorUsCore4
|
@@ -8,8 +10,13 @@ module USCoreTestKit
|
|
8
10
|
self.must_supports = must_supports
|
9
11
|
end
|
10
12
|
|
13
|
+
def us_core_3_extractor
|
14
|
+
@us_core_3_extractor ||= MustSupportMetadataExtractorUsCore3.new(profile, must_supports)
|
15
|
+
end
|
16
|
+
|
11
17
|
def handle_special_cases
|
12
18
|
add_must_support_choices
|
19
|
+
remove_patient_address_period
|
13
20
|
add_device_distinct_identifier
|
14
21
|
add_patient_uscdi_elements
|
15
22
|
end
|
@@ -25,11 +32,28 @@ module USCoreTestKit
|
|
25
32
|
choices << { paths: ['location.location', 'serviceProvider'] }
|
26
33
|
when 'MedicationRequest'
|
27
34
|
choices << { paths: ['reportedBoolean', 'reportedReference'] }
|
35
|
+
when 'Patient'
|
36
|
+
# FHIR-40299 adds USCDI MustSupport choices for:
|
37
|
+
# * address.period.end and address.use,
|
38
|
+
# * name.period.end and name.use
|
39
|
+
choices << {
|
40
|
+
paths: ['address.period.end', 'address.use'],
|
41
|
+
uscdi_only: true
|
42
|
+
}
|
43
|
+
|
44
|
+
choices << {
|
45
|
+
paths: ['name.period.end', 'name.use'],
|
46
|
+
uscdi_only: true
|
47
|
+
}
|
28
48
|
end
|
29
49
|
|
30
50
|
must_supports[:choices] = choices if choices.present?
|
31
51
|
end
|
32
52
|
|
53
|
+
def remove_patient_address_period
|
54
|
+
us_core_3_extractor.remove_patient_address_period
|
55
|
+
end
|
56
|
+
|
33
57
|
def add_device_distinct_identifier
|
34
58
|
if profile.type == 'Device'
|
35
59
|
# FHIR-36303 US Core 4.0.0 mistakenly removed MS from Device.distinctIdentifier
|
@@ -63,10 +87,6 @@ module USCoreTestKit
|
|
63
87
|
path: 'name.suffix',
|
64
88
|
uscdi_only: true
|
65
89
|
}
|
66
|
-
must_supports[:elements] << {
|
67
|
-
path: 'name.period.end',
|
68
|
-
uscdi_only: true
|
69
|
-
}
|
70
90
|
must_supports[:elements] << {
|
71
91
|
path: 'telecom',
|
72
92
|
uscdi_only: true
|
@@ -17,6 +17,7 @@ module USCoreTestKit
|
|
17
17
|
|
18
18
|
def handle_special_cases
|
19
19
|
add_must_support_choices
|
20
|
+
remove_patient_address_period
|
20
21
|
add_patient_uscdi_elements
|
21
22
|
add_value_set_expansion
|
22
23
|
remove_survey_questionnaire_response
|
@@ -48,6 +49,10 @@ module USCoreTestKit
|
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
52
|
+
def remove_patient_address_period
|
53
|
+
us_core_4_extractor.remove_patient_address_period
|
54
|
+
end
|
55
|
+
|
51
56
|
def add_patient_uscdi_elements
|
52
57
|
return unless profile.type == 'Patient'
|
53
58
|
|
@@ -37,22 +37,58 @@ module USCoreTestKit
|
|
37
37
|
def full_paths
|
38
38
|
@full_paths ||=
|
39
39
|
begin
|
40
|
-
path = param.expression.gsub(/.where\((.*)/, '')
|
40
|
+
path = param.expression.gsub(/.where\(resolve\((.*)/, '').gsub(/url = '/, 'url=\'')
|
41
41
|
path = path[1..-2] if path.start_with?('(') && path.end_with?(')')
|
42
42
|
path.scan(/[. ]as[( ]([^)]*)[)]?/).flatten.map do |as_type|
|
43
43
|
path.gsub!(/[. ]as[( ](#{as_type}[^)]*)[)]?/, as_type.upcase_first) if as_type.present?
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
|
+
full_paths = path.split('|')
|
47
|
+
|
48
|
+
# There is a bug in US Core 5 asserted-date search parameter. See FHIR-40573
|
49
|
+
if param.respond_to?(:version) && param.version == '5.0.1' && name == 'asserted-date'
|
50
|
+
remove_additional_extension_from_asserted_date(full_paths)
|
51
|
+
end
|
52
|
+
|
53
|
+
full_paths
|
46
54
|
end
|
47
55
|
end
|
48
56
|
|
57
|
+
def remove_additional_extension_from_asserted_date(full_paths)
|
58
|
+
full_paths.each do |full_path|
|
59
|
+
next unless full_path.include?('http://hl7.org/fhir/StructureDefinition/condition-assertedDate')
|
60
|
+
full_path.gsub!(/\).extension./, ').')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
49
64
|
def paths
|
50
65
|
@paths ||= full_paths.map { |a_path| a_path.gsub("#{resource}.", '') }
|
51
66
|
end
|
52
67
|
|
68
|
+
def extensions
|
69
|
+
@extensions ||= full_paths.select { |a_path| a_path.include?('extension.where') }
|
70
|
+
.map { |a_path| { url: a_path[/(?<=extension.where\(url=').*(?='\))/] }}
|
71
|
+
.presence
|
72
|
+
end
|
73
|
+
|
53
74
|
def profile_element
|
54
75
|
@profile_element ||=
|
55
|
-
|
76
|
+
(
|
77
|
+
profile_elements.find { |element| full_paths.include?(element.id) } ||
|
78
|
+
extension_definition&.differential&.element&.find { |element| element.id == 'Extension.value[x]'}
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
def extension_definition
|
83
|
+
@extension_definition ||=
|
84
|
+
begin
|
85
|
+
ext_definition = nil
|
86
|
+
extensions&.each do |ext_metadata|
|
87
|
+
ext_definition = ig_resources.profile_by_url(ext_metadata[:url])
|
88
|
+
break if ext_definition.present?
|
89
|
+
end
|
90
|
+
ext_definition
|
91
|
+
end
|
56
92
|
end
|
57
93
|
|
58
94
|
def comparator_expectation_extensions
|
@@ -90,7 +126,19 @@ module USCoreTestKit
|
|
90
126
|
end
|
91
127
|
|
92
128
|
def contains_multiple?
|
93
|
-
profile_element
|
129
|
+
if profile_element.present?
|
130
|
+
if profile_element.id.start_with?('Extension') && extension_definition.present?
|
131
|
+
# Find the extension instance in a US Core profile
|
132
|
+
target_element = profile_elements.find do |element|
|
133
|
+
element.type.any? { |type| type.code == "Extension" && type.profile.include?(extension_definition.url) }
|
134
|
+
end
|
135
|
+
target_element&.max == '*'
|
136
|
+
else
|
137
|
+
profile_element.max == '*'
|
138
|
+
end
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
94
142
|
end
|
95
143
|
|
96
144
|
def chain_extensions
|
@@ -0,0 +1,280 @@
|
|
1
|
+
{
|
2
|
+
"resourceType": "StructureDefinition",
|
3
|
+
"id": "condition-assertedDate",
|
4
|
+
"extension": [
|
5
|
+
{
|
6
|
+
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
|
7
|
+
"valueCode": "pc"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
|
11
|
+
"valueInteger": 1
|
12
|
+
}
|
13
|
+
],
|
14
|
+
"url": "http://hl7.org/fhir/StructureDefinition/condition-assertedDate",
|
15
|
+
"version": "4.0.1",
|
16
|
+
"name": "assertedDate",
|
17
|
+
"title": "assertedDate",
|
18
|
+
"status": "draft",
|
19
|
+
"date": "2015-02-21",
|
20
|
+
"publisher": "Health Level Seven, Inc. - FHIR WG",
|
21
|
+
"contact": [
|
22
|
+
{
|
23
|
+
"telecom": [
|
24
|
+
{
|
25
|
+
"system": "url",
|
26
|
+
"value": "HL7"
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
30
|
+
],
|
31
|
+
"description": "The date on which the existence of the Condition was first asserted or acknowledged.",
|
32
|
+
"fhirVersion": "4.0.1",
|
33
|
+
"mapping": [
|
34
|
+
{
|
35
|
+
"identity": "rim",
|
36
|
+
"uri": "http://hl7.org/v3",
|
37
|
+
"name": "RIM Mapping"
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"kind": "complex-type",
|
41
|
+
"abstract": false,
|
42
|
+
"context": [
|
43
|
+
{
|
44
|
+
"type": "element",
|
45
|
+
"expression": "Condition"
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"type": "Extension",
|
49
|
+
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
|
50
|
+
"derivation": "constraint",
|
51
|
+
"snapshot": {
|
52
|
+
"element": [
|
53
|
+
{
|
54
|
+
"id": "Extension",
|
55
|
+
"path": "Extension",
|
56
|
+
"short": "Date the condition was first asserted",
|
57
|
+
"definition": "The date on which the existence of the Condition was first asserted or acknowledged.",
|
58
|
+
"comment": "The assertedDate is in the context of the recording practitioner and might not be the same as the recordedDate.",
|
59
|
+
"min": 0,
|
60
|
+
"max": "1",
|
61
|
+
"base": {
|
62
|
+
"path": "Extension",
|
63
|
+
"min": 0,
|
64
|
+
"max": "*"
|
65
|
+
},
|
66
|
+
"condition": [
|
67
|
+
"ele-1"
|
68
|
+
],
|
69
|
+
"constraint": [
|
70
|
+
{
|
71
|
+
"key": "ele-1",
|
72
|
+
"severity": "error",
|
73
|
+
"human": "All FHIR elements must have a @value or children",
|
74
|
+
"expression": "hasValue() or (children().count() > id.count())",
|
75
|
+
"xpath": "@value|f:*|h:div",
|
76
|
+
"source": "http://hl7.org/fhir/StructureDefinition/Element"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"key": "ext-1",
|
80
|
+
"severity": "error",
|
81
|
+
"human": "Must have either extensions or value[x], not both",
|
82
|
+
"expression": "extension.exists() != value.exists()",
|
83
|
+
"xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])",
|
84
|
+
"source": "http://hl7.org/fhir/StructureDefinition/Extension"
|
85
|
+
}
|
86
|
+
],
|
87
|
+
"isModifier": false
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"id": "Extension.id",
|
91
|
+
"path": "Extension.id",
|
92
|
+
"representation": [
|
93
|
+
"xmlAttr"
|
94
|
+
],
|
95
|
+
"short": "Unique id for inter-element referencing",
|
96
|
+
"definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.",
|
97
|
+
"min": 0,
|
98
|
+
"max": "1",
|
99
|
+
"base": {
|
100
|
+
"path": "Element.id",
|
101
|
+
"min": 0,
|
102
|
+
"max": "1"
|
103
|
+
},
|
104
|
+
"type": [
|
105
|
+
{
|
106
|
+
"extension": [
|
107
|
+
{
|
108
|
+
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
|
109
|
+
"valueUrl": "string"
|
110
|
+
}
|
111
|
+
],
|
112
|
+
"code": "http://hl7.org/fhirpath/System.String"
|
113
|
+
}
|
114
|
+
],
|
115
|
+
"isModifier": false,
|
116
|
+
"isSummary": false,
|
117
|
+
"mapping": [
|
118
|
+
{
|
119
|
+
"identity": "rim",
|
120
|
+
"map": "n/a"
|
121
|
+
}
|
122
|
+
]
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"id": "Extension.extension",
|
126
|
+
"path": "Extension.extension",
|
127
|
+
"slicing": {
|
128
|
+
"discriminator": [
|
129
|
+
{
|
130
|
+
"type": "value",
|
131
|
+
"path": "url"
|
132
|
+
}
|
133
|
+
],
|
134
|
+
"description": "Extensions are always sliced by (at least) url",
|
135
|
+
"rules": "open"
|
136
|
+
},
|
137
|
+
"short": "Extension",
|
138
|
+
"definition": "An Extension",
|
139
|
+
"min": 0,
|
140
|
+
"max": "0",
|
141
|
+
"base": {
|
142
|
+
"path": "Element.extension",
|
143
|
+
"min": 0,
|
144
|
+
"max": "*"
|
145
|
+
},
|
146
|
+
"type": [
|
147
|
+
{
|
148
|
+
"code": "Extension"
|
149
|
+
}
|
150
|
+
],
|
151
|
+
"constraint": [
|
152
|
+
{
|
153
|
+
"key": "ele-1",
|
154
|
+
"severity": "error",
|
155
|
+
"human": "All FHIR elements must have a @value or children",
|
156
|
+
"expression": "hasValue() or (children().count() > id.count())",
|
157
|
+
"xpath": "@value|f:*|h:div",
|
158
|
+
"source": "http://hl7.org/fhir/StructureDefinition/Element"
|
159
|
+
},
|
160
|
+
{
|
161
|
+
"key": "ext-1",
|
162
|
+
"severity": "error",
|
163
|
+
"human": "Must have either extensions or value[x], not both",
|
164
|
+
"expression": "extension.exists() != value.exists()",
|
165
|
+
"xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])",
|
166
|
+
"source": "http://hl7.org/fhir/StructureDefinition/Extension"
|
167
|
+
}
|
168
|
+
],
|
169
|
+
"isModifier": false,
|
170
|
+
"isSummary": false
|
171
|
+
},
|
172
|
+
{
|
173
|
+
"id": "Extension.url",
|
174
|
+
"path": "Extension.url",
|
175
|
+
"representation": [
|
176
|
+
"xmlAttr"
|
177
|
+
],
|
178
|
+
"short": "identifies the meaning of the extension",
|
179
|
+
"definition": "Source of the definition for the extension code - a logical name or a URL.",
|
180
|
+
"comment": "The definition may point directly to a computable or human-readable definition of the extensibility codes, or it may be a logical URI as declared in some other specification. The definition SHALL be a URI for the Structure Definition defining the extension.",
|
181
|
+
"min": 1,
|
182
|
+
"max": "1",
|
183
|
+
"base": {
|
184
|
+
"path": "Extension.url",
|
185
|
+
"min": 1,
|
186
|
+
"max": "1"
|
187
|
+
},
|
188
|
+
"type": [
|
189
|
+
{
|
190
|
+
"extension": [
|
191
|
+
{
|
192
|
+
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
|
193
|
+
"valueUrl": "uri"
|
194
|
+
}
|
195
|
+
],
|
196
|
+
"code": "http://hl7.org/fhirpath/System.String"
|
197
|
+
}
|
198
|
+
],
|
199
|
+
"fixedUri": "http://hl7.org/fhir/StructureDefinition/condition-assertedDate",
|
200
|
+
"isModifier": false,
|
201
|
+
"isSummary": false,
|
202
|
+
"mapping": [
|
203
|
+
{
|
204
|
+
"identity": "rim",
|
205
|
+
"map": "N/A"
|
206
|
+
}
|
207
|
+
]
|
208
|
+
},
|
209
|
+
{
|
210
|
+
"id": "Extension.value[x]",
|
211
|
+
"path": "Extension.value[x]",
|
212
|
+
"short": "Value of extension",
|
213
|
+
"definition": "Value of extension - must be one of a constrained set of the data types (see [Extensibility](http://hl7.org/fhir/extensibility.html) for a list).",
|
214
|
+
"min": 1,
|
215
|
+
"max": "1",
|
216
|
+
"base": {
|
217
|
+
"path": "Extension.value[x]",
|
218
|
+
"min": 0,
|
219
|
+
"max": "1"
|
220
|
+
},
|
221
|
+
"type": [
|
222
|
+
{
|
223
|
+
"code": "dateTime"
|
224
|
+
}
|
225
|
+
],
|
226
|
+
"constraint": [
|
227
|
+
{
|
228
|
+
"key": "ele-1",
|
229
|
+
"severity": "error",
|
230
|
+
"human": "All FHIR elements must have a @value or children",
|
231
|
+
"expression": "hasValue() or (children().count() > id.count())",
|
232
|
+
"xpath": "@value|f:*|h:div",
|
233
|
+
"source": "http://hl7.org/fhir/StructureDefinition/Element"
|
234
|
+
}
|
235
|
+
],
|
236
|
+
"isModifier": false,
|
237
|
+
"isSummary": false,
|
238
|
+
"mapping": [
|
239
|
+
{
|
240
|
+
"identity": "rim",
|
241
|
+
"map": "N/A"
|
242
|
+
}
|
243
|
+
]
|
244
|
+
}
|
245
|
+
]
|
246
|
+
},
|
247
|
+
"differential": {
|
248
|
+
"element": [
|
249
|
+
{
|
250
|
+
"id": "Extension",
|
251
|
+
"path": "Extension",
|
252
|
+
"short": "Date the condition was first asserted",
|
253
|
+
"definition": "The date on which the existence of the Condition was first asserted or acknowledged.",
|
254
|
+
"comment": "The assertedDate is in the context of the recording practitioner and might not be the same as the recordedDate.",
|
255
|
+
"min": 0,
|
256
|
+
"max": "1"
|
257
|
+
},
|
258
|
+
{
|
259
|
+
"id": "Extension.extension",
|
260
|
+
"path": "Extension.extension",
|
261
|
+
"max": "0"
|
262
|
+
},
|
263
|
+
{
|
264
|
+
"id": "Extension.url",
|
265
|
+
"path": "Extension.url",
|
266
|
+
"fixedUri": "http://hl7.org/fhir/StructureDefinition/condition-assertedDate"
|
267
|
+
},
|
268
|
+
{
|
269
|
+
"id": "Extension.value[x]",
|
270
|
+
"path": "Extension.value[x]",
|
271
|
+
"min": 1,
|
272
|
+
"type": [
|
273
|
+
{
|
274
|
+
"code": "dateTime"
|
275
|
+
}
|
276
|
+
]
|
277
|
+
}
|
278
|
+
]
|
279
|
+
}
|
280
|
+
}
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen MacVicar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|
@@ -1303,6 +1303,7 @@ files:
|
|
1303
1303
|
- lib/us_core_test_kit/igs/us_core_311/StructureDefinition-resprate.json
|
1304
1304
|
- lib/us_core_test_kit/igs/us_core_400.tgz
|
1305
1305
|
- lib/us_core_test_kit/igs/us_core_501.tgz
|
1306
|
+
- lib/us_core_test_kit/igs/us_core_501/StructureDefinition-condition-assertedDate.json
|
1306
1307
|
- lib/us_core_test_kit/must_support_test.rb
|
1307
1308
|
- lib/us_core_test_kit/provenance_validator.rb
|
1308
1309
|
- lib/us_core_test_kit/read_test.rb
|