us_core_test_kit 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/us_core_test_kit/date_search_validation.rb +14 -7
- data/lib/us_core_test_kit/generated/v4.0.0/metadata.yml +0 -8
- data/lib/us_core_test_kit/generated/v4.0.0/patient/metadata.yml +0 -8
- data/lib/us_core_test_kit/generated/v4.0.0/patient/patient_must_support_test.rb +1 -1
- data/lib/us_core_test_kit/generated/v5.0.1/metadata.yml +2 -7
- data/lib/us_core_test_kit/generated/v5.0.1/patient/metadata.yml +2 -7
- data/lib/us_core_test_kit/generated/v5.0.1/patient/patient_must_support_test.rb +2 -1
- data/lib/us_core_test_kit/generator/must_support_metadata_extractor.rb +5 -16
- data/lib/us_core_test_kit/search_test.rb +2 -3
- data/lib/us_core_test_kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf7aef28c22652157e161c0577936f83368ed966e95d313d43a96c3aae618a3f
|
4
|
+
data.tar.gz: d44b31b58c97c38e9d80462a47dbc2baa50e2e6cdc2e98ed4cb244a375c381bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b87c6b6d5be087b6d28837ea02581ec2fc53bef7301e858db3b7e9e7538e8db93a54416a916ec8e8077c9cdcc5313880a63353d633d5e0039306e7c93c28758
|
7
|
+
data.tar.gz: 348461765954b1564b1e44bbac4c149de5740c18c13edb920a79cc1ddf00a5a6279fab8f0ee01732b9caf1bd1a4a54bb7a17f471a2abc3325ac96410e6691cf5
|
@@ -36,7 +36,7 @@ module USCoreTestKit
|
|
36
36
|
range
|
37
37
|
end
|
38
38
|
|
39
|
-
def fhir_date_comparer(search_range, target_range, comparator)
|
39
|
+
def fhir_date_comparer(search_range, target_range, comparator, extend_start = false, extend_end = false)
|
40
40
|
# Implicitly, a missing lower boundary is "less than" any actual date. A missing upper boundary is "greater than" any actual date.
|
41
41
|
case comparator
|
42
42
|
when 'eq' # the range of the search value fully contains the range of the target value
|
@@ -44,13 +44,13 @@ module USCoreTestKit
|
|
44
44
|
when 'ne' # the range of the search value does not fully contain the range of the target value
|
45
45
|
target_range[:start].nil? || target_range[:end].nil? || search_range[:start] > target_range[:start] || search_range[:end] < target_range[:end]
|
46
46
|
when 'gt' # the range above the search value intersects (i.e. overlaps) with the range of the target value
|
47
|
-
target_range[:end].nil? || search_range[:end] < target_range[:end]
|
47
|
+
target_range[:end].nil? || search_range[:end] < target_range[:end] || (search_range[:end] < (target_range[:end] + 1) && extend_end)
|
48
48
|
when 'lt' # the range below the search value intersects (i.e. overlaps) with the range of the target value
|
49
|
-
target_range[:start].nil? || search_range[:start] > target_range[:start]
|
49
|
+
target_range[:start].nil? || search_range[:start] > target_range[:start] || (search_range[:start] > (target_range[:start] - 1) && extend_start)
|
50
50
|
when 'ge'
|
51
|
-
fhir_date_comparer(search_range, target_range, 'gt') || fhir_date_comparer(search_range, target_range, 'eq')
|
51
|
+
fhir_date_comparer(search_range, target_range, 'gt', extend_start, extend_end) || fhir_date_comparer(search_range, target_range, 'eq')
|
52
52
|
when 'le'
|
53
|
-
fhir_date_comparer(search_range, target_range, 'lt') || fhir_date_comparer(search_range, target_range, 'eq')
|
53
|
+
fhir_date_comparer(search_range, target_range, 'lt', extend_start, extend_end) || fhir_date_comparer(search_range, target_range, 'eq')
|
54
54
|
when 'sa' # the range above the search value contains the range of the target value
|
55
55
|
!target_range[:start].nil? && search_range[:end] < target_range[:start]
|
56
56
|
when 'eb' # the range below the search value contains the range of the target value
|
@@ -81,9 +81,11 @@ module USCoreTestKit
|
|
81
81
|
else
|
82
82
|
comparator = 'eq'
|
83
83
|
end
|
84
|
+
search_is_date = is_date?(search_value)
|
85
|
+
target_is_date = is_date?(target_value)
|
84
86
|
search_range = get_fhir_datetime_range(search_value)
|
85
87
|
target_range = get_fhir_datetime_range(target_value)
|
86
|
-
fhir_date_comparer(search_range, target_range, comparator)
|
88
|
+
fhir_date_comparer(search_range, target_range, comparator, !search_is_date && target_is_date, !search_is_date && target_is_date)
|
87
89
|
end
|
88
90
|
|
89
91
|
def validate_period_search(search_value, target_value)
|
@@ -93,9 +95,14 @@ module USCoreTestKit
|
|
93
95
|
else
|
94
96
|
comparator = 'eq'
|
95
97
|
end
|
98
|
+
search_is_date = is_date?(search_value)
|
96
99
|
search_range = get_fhir_datetime_range(search_value)
|
97
100
|
target_range = get_fhir_period_range(target_value)
|
98
|
-
fhir_date_comparer(search_range, target_range, comparator)
|
101
|
+
fhir_date_comparer(search_range, target_range, comparator, !search_is_date && is_date?(target_value.start), !search_is_date && is_date?(target_value.end))
|
102
|
+
end
|
103
|
+
|
104
|
+
def is_date?(value)
|
105
|
+
/^\d{4}(-\d{2})?(-\d{2})?$/.match?(value) # YYYY or YYYY-MM or YYYY-MM-DD
|
99
106
|
end
|
100
107
|
end
|
101
108
|
end
|
@@ -11880,20 +11880,12 @@
|
|
11880
11880
|
:uscdi_only: true
|
11881
11881
|
- :path: name.suffix
|
11882
11882
|
:uscdi_only: true
|
11883
|
-
- :path: name.use
|
11884
|
-
:fixed_value: old
|
11885
|
-
:uscdi_only: true
|
11886
11883
|
- :path: name.period.end
|
11887
11884
|
:uscdi_only: true
|
11888
11885
|
- :path: telecom
|
11889
11886
|
:uscdi_only: true
|
11890
11887
|
- :path: communication
|
11891
11888
|
:uscdi_only: true
|
11892
|
-
:choices:
|
11893
|
-
- :paths:
|
11894
|
-
- name.period.end
|
11895
|
-
- name.use
|
11896
|
-
:uscdi_only: true
|
11897
11889
|
:mandatory_elements:
|
11898
11890
|
- Patient.identifier
|
11899
11891
|
- Patient.identifier.system
|
@@ -185,20 +185,12 @@
|
|
185
185
|
:uscdi_only: true
|
186
186
|
- :path: name.suffix
|
187
187
|
:uscdi_only: true
|
188
|
-
- :path: name.use
|
189
|
-
:fixed_value: old
|
190
|
-
:uscdi_only: true
|
191
188
|
- :path: name.period.end
|
192
189
|
:uscdi_only: true
|
193
190
|
- :path: telecom
|
194
191
|
:uscdi_only: true
|
195
192
|
- :path: communication
|
196
193
|
:uscdi_only: true
|
197
|
-
:choices:
|
198
|
-
- :paths:
|
199
|
-
- name.period.end
|
200
|
-
- name.use
|
201
|
-
:uscdi_only: true
|
202
194
|
:mandatory_elements:
|
203
195
|
- Patient.identifier
|
204
196
|
- Patient.identifier.system
|
@@ -34,7 +34,7 @@ module USCoreTestKit
|
|
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
|
38
38
|
* Patient.name.suffix
|
39
39
|
* Patient.telecom
|
40
40
|
* Patient.telecom.system
|
@@ -17444,9 +17444,6 @@
|
|
17444
17444
|
:uscdi_only: true
|
17445
17445
|
- :path: name.suffix
|
17446
17446
|
:uscdi_only: true
|
17447
|
-
- :path: name.use
|
17448
|
-
:fixed_value: old
|
17449
|
-
:uscdi_only: true
|
17450
17447
|
- :path: name.period.end
|
17451
17448
|
:uscdi_only: true
|
17452
17449
|
- :path: telecom
|
@@ -17456,10 +17453,8 @@
|
|
17456
17453
|
- :path: address.use
|
17457
17454
|
:fixed_value: old
|
17458
17455
|
:uscdi_only: true
|
17459
|
-
:
|
17460
|
-
|
17461
|
-
- name.period.end
|
17462
|
-
- name.use
|
17456
|
+
- :path: name.use
|
17457
|
+
:fixed_value: old
|
17463
17458
|
:uscdi_only: true
|
17464
17459
|
:mandatory_elements:
|
17465
17460
|
- Patient.identifier
|
@@ -188,9 +188,6 @@
|
|
188
188
|
:uscdi_only: true
|
189
189
|
- :path: name.suffix
|
190
190
|
:uscdi_only: true
|
191
|
-
- :path: name.use
|
192
|
-
:fixed_value: old
|
193
|
-
:uscdi_only: true
|
194
191
|
- :path: name.period.end
|
195
192
|
:uscdi_only: true
|
196
193
|
- :path: telecom
|
@@ -200,10 +197,8 @@
|
|
200
197
|
- :path: address.use
|
201
198
|
:fixed_value: old
|
202
199
|
:uscdi_only: true
|
203
|
-
:
|
204
|
-
|
205
|
-
- name.period.end
|
206
|
-
- name.use
|
200
|
+
- :path: name.use
|
201
|
+
:fixed_value: old
|
207
202
|
:uscdi_only: true
|
208
203
|
:mandatory_elements:
|
209
204
|
- Patient.identifier
|
@@ -36,8 +36,9 @@ module USCoreTestKit
|
|
36
36
|
* Patient.extension:ethnicity
|
37
37
|
* Patient.extension:genderIdentity
|
38
38
|
* Patient.extension:race
|
39
|
-
* Patient.name.period.end
|
39
|
+
* Patient.name.period.end
|
40
40
|
* Patient.name.suffix
|
41
|
+
* Patient.name.use
|
41
42
|
* Patient.telecom
|
42
43
|
* Patient.telecom.system
|
43
44
|
* Patient.telecom.use
|
@@ -375,11 +375,6 @@ module USCoreTestKit
|
|
375
375
|
choices << { paths: ['location.location', 'serviceProvider'] }
|
376
376
|
when 'MedicationRequest'
|
377
377
|
choices << { paths: ['reportedBoolean', 'reportedReference'] }
|
378
|
-
when 'Patient'
|
379
|
-
choices << {
|
380
|
-
paths: ['name.period.end', 'name.use'],
|
381
|
-
uscdi_only: true
|
382
|
-
}
|
383
378
|
end
|
384
379
|
when '5.0.1'
|
385
380
|
case profile.type
|
@@ -400,13 +395,7 @@ module USCoreTestKit
|
|
400
395
|
choices << { paths: ['location.location', 'serviceProvider'] }
|
401
396
|
when 'MedicationRequest'
|
402
397
|
choices << { paths: ['reportedBoolean', 'reportedReference'] }
|
403
|
-
when 'Patient'
|
404
|
-
choices << {
|
405
|
-
paths: ['name.period.end', 'name.use'],
|
406
|
-
uscdi_only: true
|
407
|
-
}
|
408
398
|
end
|
409
|
-
|
410
399
|
end
|
411
400
|
|
412
401
|
@must_supports[:choices] = choices if choices.present?
|
@@ -445,11 +434,6 @@ module USCoreTestKit
|
|
445
434
|
path: 'name.suffix',
|
446
435
|
uscdi_only: true
|
447
436
|
}
|
448
|
-
@must_supports[:elements] << {
|
449
|
-
path: 'name.use',
|
450
|
-
fixed_value: 'old',
|
451
|
-
uscdi_only: true
|
452
|
-
}
|
453
437
|
@must_supports[:elements] << {
|
454
438
|
path: 'name.period.end',
|
455
439
|
uscdi_only: true
|
@@ -483,6 +467,11 @@ module USCoreTestKit
|
|
483
467
|
fixed_value: 'old',
|
484
468
|
uscdi_only: true
|
485
469
|
}
|
470
|
+
@must_supports[:elements] << {
|
471
|
+
path: 'name.use',
|
472
|
+
fixed_value: 'old',
|
473
|
+
uscdi_only: true
|
474
|
+
}
|
486
475
|
end
|
487
476
|
end
|
488
477
|
|
@@ -609,9 +609,8 @@ module USCoreTestKit
|
|
609
609
|
# Patient.birthDate does not mandate comparators so cannot be converted
|
610
610
|
# Goal.target-date has day precision
|
611
611
|
# All others have second + time offset precision
|
612
|
-
if /^\d{4}
|
613
|
-
|
614
|
-
(/^\d{4}-\d{2}-\d{2}$/.match?(element) && resource_type != "Goal") # YYYY-MM-DD AND Resource is NOT Goal
|
612
|
+
if /^\d{4}(-\d{2})?$/.match?(element) || # YYYY or YYYY-MM
|
613
|
+
(/^\d{4}-\d{2}-\d{2}$/.match?(element) && resource_type != "Goal") # YYY-MM-DD AND Resource is NOT Goal
|
615
614
|
"gt#{(DateTime.xmlschema(element)-1).xmlschema}"
|
616
615
|
else
|
617
616
|
element
|
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.3.
|
4
|
+
version: 0.3.2
|
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-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|