us_core_test_kit 0.10.0 → 0.10.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd2a2b92b210f0b0bda54fb16a511ae955033d2b836f4237db9fd318a7e6415b
4
- data.tar.gz: 602b0b724d94dded2cc181393de9aea97a941532f841e978ed415a910fc59693
3
+ metadata.gz: c9cfc69a96024c39450f31a67620f263c113ef1dad361200e5458da181741985
4
+ data.tar.gz: 6adae46602da4bcaba0b302dae8e8176ccfb9ccb1dbbaef295644a57b98b6d31
5
5
  SHA512:
6
- metadata.gz: '0384ee74913d206fda3fb672690d095cab56be0b92889b94823faa6ccc72f5da95f21b471334c4575d50f6c6f2fa408fd6e7e8244e685cafcb8e29af33e8f5d5'
7
- data.tar.gz: cc68f24f9a3b3554f9d4b949a273f55ba85691998bc7f92b52fa5dc62a71f2567d0ed5b960ee4daee988b9f0674b83ffade001c6a227647649d0bf3b6563b732
6
+ metadata.gz: 438cf65702f3df6f213ab994b3c73d964a575d70c7c0b26b82266b315852fa1217c614e97a7b10efa718941fb480f0fc2a28c12e2c23ed2deb1ce84878053a20
7
+ data.tar.gz: 26b6615e1dbf4c2be906c6d9072f4c03bad43438a1c26de987914a2785142d539876c03ea5f0ac7d6602ea08003971d2d2734158fce9090ba26605786c42b90c
@@ -65,7 +65,8 @@ module USCoreTestKit
65
65
  %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
66
66
  %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
67
67
  /\A\S+: \S+: URL value '.*' does not resolve/,
68
- %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
68
+ %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
69
+ %r{Slice 'Observation\.value\[x\]:valueQuantity': a matching slice is required, but not found \(from (http://hl7\.org/fhir/StructureDefinition/bmi\|4\.0\.1|http://hl7\.org/fhir/StructureDefinition/bmi\%7C4\.0\.1)\)}
69
70
  ].freeze
70
71
 
71
72
  VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze
@@ -100,6 +101,7 @@ module USCoreTestKit
100
101
 
101
102
  suite_option :smart_app_launch_version,
102
103
  title: 'SMART App Launch Version',
104
+ default: USCoreOptions::SMART_2,
103
105
  list_options: [
104
106
  {
105
107
  label: 'SMART App Launch 1.0.0',
@@ -107,7 +109,7 @@ module USCoreTestKit
107
109
  },
108
110
  {
109
111
  label: 'SMART App Launch 2.0.0',
110
- value: USCoreOptions::SMART_2
112
+ value: USCoreOptions::SMART_2,
111
113
  },
112
114
  {
113
115
  label: 'SMART App Launch 2.2.0',
@@ -67,7 +67,8 @@ module USCoreTestKit
67
67
  %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
68
68
  %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
69
69
  /\A\S+: \S+: URL value '.*' does not resolve/,
70
- %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
70
+ %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
71
+ %r{Slice 'Observation\.value\[x\]:valueQuantity': a matching slice is required, but not found \(from (http://hl7\.org/fhir/StructureDefinition/bmi\|4\.0\.1|http://hl7\.org/fhir/StructureDefinition/bmi\%7C4\.0\.1)\)}
71
72
  ].freeze
72
73
 
73
74
  VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze
@@ -102,6 +103,7 @@ module USCoreTestKit
102
103
 
103
104
  suite_option :smart_app_launch_version,
104
105
  title: 'SMART App Launch Version',
106
+ default: USCoreOptions::SMART_2,
105
107
  list_options: [
106
108
  {
107
109
  label: 'SMART App Launch 1.0.0',
@@ -109,7 +111,7 @@ module USCoreTestKit
109
111
  },
110
112
  {
111
113
  label: 'SMART App Launch 2.0.0',
112
- value: USCoreOptions::SMART_2
114
+ value: USCoreOptions::SMART_2,
113
115
  },
114
116
  {
115
117
  label: 'SMART App Launch 2.2.0',
@@ -77,7 +77,8 @@ module USCoreTestKit
77
77
  %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
78
78
  %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
79
79
  /\A\S+: \S+: URL value '.*' does not resolve/,
80
- %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
80
+ %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
+ %r{Slice 'Observation\.value\[x\]:valueQuantity': a matching slice is required, but not found \(from (http://hl7\.org/fhir/StructureDefinition/bmi\|4\.0\.1|http://hl7\.org/fhir/StructureDefinition/bmi\%7C4\.0\.1)\)}
81
82
  ].freeze
82
83
 
83
84
  VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze
@@ -112,6 +113,7 @@ module USCoreTestKit
112
113
 
113
114
  suite_option :smart_app_launch_version,
114
115
  title: 'SMART App Launch Version',
116
+ default: USCoreOptions::SMART_2,
115
117
  list_options: [
116
118
  {
117
119
  label: 'SMART App Launch 1.0.0',
@@ -119,7 +121,7 @@ module USCoreTestKit
119
121
  },
120
122
  {
121
123
  label: 'SMART App Launch 2.0.0',
122
- value: USCoreOptions::SMART_2
124
+ value: USCoreOptions::SMART_2,
123
125
  },
124
126
  {
125
127
  label: 'SMART App Launch 2.2.0',
@@ -84,7 +84,8 @@ module USCoreTestKit
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
86
  /\A\S+: \S+: URL value '.*' does not resolve/,
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
+ %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
88
+ %r{Slice 'Observation\.value\[x\]:valueQuantity': a matching slice is required, but not found \(from (http://hl7\.org/fhir/StructureDefinition/bmi\|4\.0\.1|http://hl7\.org/fhir/StructureDefinition/bmi\%7C4\.0\.1)\)}
88
89
  ].freeze
89
90
 
90
91
  VERSION_SPECIFIC_MESSAGE_FILTERS = [
@@ -123,6 +124,7 @@ module USCoreTestKit
123
124
 
124
125
  suite_option :smart_app_launch_version,
125
126
  title: 'SMART App Launch Version',
127
+ default: USCoreOptions::SMART_2,
126
128
  list_options: [
127
129
  {
128
130
  label: 'SMART App Launch 1.0.0',
@@ -130,7 +132,7 @@ module USCoreTestKit
130
132
  },
131
133
  {
132
134
  label: 'SMART App Launch 2.0.0',
133
- value: USCoreOptions::SMART_2
135
+ value: USCoreOptions::SMART_2,
134
136
  },
135
137
  {
136
138
  label: 'SMART App Launch 2.2.0',
@@ -90,7 +90,8 @@ module USCoreTestKit
90
90
  %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
91
91
  %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
92
92
  /\A\S+: \S+: URL value '.*' does not resolve/,
93
- %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
93
+ %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
94
+ %r{Slice 'Observation\.value\[x\]:valueQuantity': a matching slice is required, but not found \(from (http://hl7\.org/fhir/StructureDefinition/bmi\|4\.0\.1|http://hl7\.org/fhir/StructureDefinition/bmi\%7C4\.0\.1)\)}
94
95
  ].freeze
95
96
 
96
97
  VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze
@@ -125,6 +126,7 @@ module USCoreTestKit
125
126
 
126
127
  suite_option :smart_app_launch_version,
127
128
  title: 'SMART App Launch Version',
129
+ default: USCoreOptions::SMART_2,
128
130
  list_options: [
129
131
  {
130
132
  label: 'SMART App Launch 1.0.0',
@@ -132,7 +134,7 @@ module USCoreTestKit
132
134
  },
133
135
  {
134
136
  label: 'SMART App Launch 2.0.0',
135
- value: USCoreOptions::SMART_2
137
+ value: USCoreOptions::SMART_2,
136
138
  },
137
139
  {
138
140
  label: 'SMART App Launch 2.2.0',
@@ -41,7 +41,8 @@ module USCoreTestKit
41
41
  %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
42
42
  %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
43
43
  /\A\S+: \S+: URL value '.*' does not resolve/,
44
- %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
44
+ %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
45
+ %r{Slice 'Observation\.value\[x\]:valueQuantity': a matching slice is required, but not found \(from (http://hl7\.org/fhir/StructureDefinition/bmi\|4\.0\.1|http://hl7\.org/fhir/StructureDefinition/bmi\%7C4\.0\.1)\)}
45
46
  ].freeze
46
47
  <% if version_specific_message_filters.empty? %>
47
48
  VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze
@@ -80,6 +81,7 @@ module USCoreTestKit
80
81
 
81
82
  suite_option :smart_app_launch_version,
82
83
  title: 'SMART App Launch Version',
84
+ default: USCoreOptions::SMART_2,
83
85
  list_options: [
84
86
  {
85
87
  label: 'SMART App Launch 1.0.0',
@@ -87,7 +89,7 @@ module USCoreTestKit
87
89
  },
88
90
  {
89
91
  label: 'SMART App Launch 2.0.0',
90
- value: USCoreOptions::SMART_2
92
+ value: USCoreOptions::SMART_2,
91
93
  },
92
94
  {
93
95
  label: 'SMART App Launch 2.2.0',
@@ -28,7 +28,8 @@ module USCoreTestKit
28
28
  if request.status != 200
29
29
  []
30
30
  else
31
- fetch_all_bundled_resources.select { |resource| resource.resourceType == resource_type }
31
+ fetch_all_bundled_resources(resource_type: resource_type, bundle: resource)
32
+ .select { |resource| resource.resourceType == resource_type }
32
33
  end
33
34
 
34
35
  mismatched_ids = mismatched_resource_ids(found_resources)
@@ -69,7 +69,7 @@ module USCoreTestKit
69
69
 
70
70
  # TODO: check that only provenance resources for resources matching
71
71
  # granular scopes returned
72
- fetch_all_bundled_resources(additional_resource_types: ['Provenance'], params:)
72
+ fetch_and_assert_all_bundled_resources(additional_resource_types: ['Provenance'], params:)
73
73
  .select { |resource| resource.resourceType == 'Provenance' }
74
74
  end
75
75
  end
@@ -104,7 +104,7 @@ module USCoreTestKit
104
104
  check_search_response
105
105
 
106
106
  resources_returned =
107
- fetch_all_bundled_resources(params:).select { |resource| resource.resourceType == resource_type }
107
+ fetch_and_assert_all_bundled_resources(params:).select { |resource| resource.resourceType == resource_type }
108
108
 
109
109
  return [] if resources_returned.blank?
110
110
 
@@ -139,7 +139,7 @@ module USCoreTestKit
139
139
 
140
140
  check_search_response
141
141
 
142
- post_search_resources = fetch_all_bundled_resources.select { |resource| resource.resourceType == resource_type }
142
+ post_search_resources = fetch_and_assert_all_bundled_resources.select { |resource| resource.resourceType == resource_type }
143
143
 
144
144
  filter_conditions(post_search_resources) if resource_type == 'Condition' && metadata.version == 'v5.0.1'
145
145
  filter_devices(post_search_resources) if resource_type == 'Device'
@@ -247,7 +247,7 @@ module USCoreTestKit
247
247
 
248
248
  search_and_check_response(params_with_comparator)
249
249
 
250
- comparator_resources = fetch_all_bundled_resources(params: params_with_comparator).each do |resource|
250
+ comparator_resources = fetch_and_assert_all_bundled_resources(params: params_with_comparator).each do |resource|
251
251
  check_resource_against_params(resource, params_with_comparator) if resource.resourceType == resource_type
252
252
  end
253
253
  end
@@ -264,7 +264,7 @@ module USCoreTestKit
264
264
  search_and_check_response(new_search_params)
265
265
 
266
266
  reference_with_type_resources =
267
- fetch_all_bundled_resources(params: new_search_params)
267
+ fetch_and_assert_all_bundled_resources(params: new_search_params)
268
268
  .select { |resource| resource.resourceType == resource_type }
269
269
 
270
270
  filter_conditions(reference_with_type_resources) if resource_type == 'Condition' && metadata.version == 'v5.0.1'
@@ -290,7 +290,7 @@ module USCoreTestKit
290
290
  search_and_check_response(search_params)
291
291
 
292
292
  resources_returned =
293
- fetch_all_bundled_resources(params: search_params)
293
+ fetch_and_assert_all_bundled_resources(params: search_params)
294
294
  .select { |resource| resource.resourceType == resource_type }
295
295
 
296
296
  assert resources_returned.present?, "No resources were returned when searching by `system|code`"
@@ -361,7 +361,7 @@ module USCoreTestKit
361
361
  search_and_check_response(search_params)
362
362
 
363
363
  resources_returned =
364
- fetch_all_bundled_resources(params: search_params)
364
+ fetch_and_assert_all_bundled_resources(params: search_params)
365
365
  .select { |resource| resource.resourceType == resource_type }
366
366
 
367
367
  multiple_or_search_params.each do |param_name|
@@ -409,7 +409,7 @@ module USCoreTestKit
409
409
  search_and_check_response(search_params)
410
410
 
411
411
  medications =
412
- fetch_all_bundled_resources(params: search_params)
412
+ fetch_and_assert_all_bundled_resources(params: search_params)
413
413
  .select { |resource| resource.resourceType == 'Medication' }
414
414
  assert medications.present?, 'No Medications were included in the search results'
415
415
 
@@ -546,56 +546,32 @@ module USCoreTestKit
546
546
  msg + ". Please use patients with more information"
547
547
  end
548
548
 
549
- def fetch_all_bundled_resources(
549
+ def fetch_and_assert_all_bundled_resources(
550
+ resource_type: self.resource_type,
550
551
  reply_handler: nil,
551
552
  max_pages: 20,
552
553
  additional_resource_types: [],
553
- resource_type: self.resource_type,
554
554
  params: nil
555
555
  )
556
- page_count = 1
557
- resources = []
558
- bundle = resource
559
-
560
- until bundle.nil? || page_count == max_pages
561
- resources += bundle&.entry&.map { |entry| entry&.resource }
562
- next_bundle_link = bundle&.link&.find { |link| link.relation == 'next' }&.url
563
- reply_handler&.call(response)
564
-
565
- break if next_bundle_link.blank?
566
-
567
- reply = fhir_client.raw_read_url(next_bundle_link)
568
-
569
- store_request('outgoing', tags: tags(params)) { reply }
570
- error_message = cant_resolve_next_bundle_message(next_bundle_link)
571
-
572
- assert_response_status(200)
573
- assert_valid_json(reply.body, error_message)
574
-
575
- bundle = fhir_client.parse_reply(FHIR::Bundle, fhir_client.default_format, reply)
576
-
577
- page_count += 1
578
- end
579
-
580
- valid_resource_types = [resource_type, 'OperationOutcome'].concat(additional_resource_types)
581
- valid_resource_types << 'Medication' if ['MedicationRequest', 'MedicationDispense'].include?(resource_type)
582
-
583
- invalid_resource_types =
584
- resources.reject { |entry| valid_resource_types.include? entry.resourceType }
585
- .map(&:resourceType)
586
- .uniq
556
+ tags = tags(params)
557
+ bundle = resource
558
+ additional_resource_types << 'Medication' if ['MedicationRequest', 'MedicationDispense'].include?(resource_type)
587
559
 
588
- if invalid_resource_types.any?
589
- info "Received resource type(s) #{invalid_resource_types.join(', ')} in search bundle, " \
590
- "but only expected resource types #{valid_resource_types.join(', ')}. " + \
591
- "This is unusual but allowed if the server believes additional resource types are relevant."
592
- end
560
+ assert_handler = Proc.new do |response|
561
+ assert_response_status(200, response: response)
562
+ assert_valid_json(response[:body], "Could not resolve bundle as JSON: #{response[:body]}")
563
+ end
593
564
 
594
- resources
595
- end
565
+ if reply_handler
566
+ reply_and_assert_handler = Proc.new do |response|
567
+ assert_handler.call(response)
568
+ reply_handler.call(response)
569
+ end
570
+ else
571
+ reply_and_assert_handler = assert_handler
572
+ end
596
573
 
597
- def cant_resolve_next_bundle_message(link)
598
- "Could not resolve next bundle: #{link}"
574
+ fetch_all_bundled_resources(resource_type:, bundle:, reply_handler: reply_and_assert_handler, max_pages:, additional_resource_types:, tags:)
599
575
  end
600
576
 
601
577
  def search_param_value(name, resource, include_system: false)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module USCoreTestKit
4
- VERSION = '0.10.0'
5
- LAST_UPDATED = '2024-02-10'
4
+ VERSION = '0.10.1'
5
+ LAST_UPDATED = '2025-02-25'
6
6
  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.10.0
4
+ version: 0.10.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: 2025-02-10 00:00:00.000000000 Z
11
+ date: 2025-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inferno_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.1
19
+ version: 0.6.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.1
26
+ version: 0.6.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: smart_app_launch_test_kit
29
29
  requirement: !ruby/object:Gem::Requirement