onc_certification_g31_test_kit 1.0.0

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.
Files changed (23) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/config/presets/g31_against_inferno_crd_server_suite.json.erb +24 -0
  4. data/config/presets/g31_against_ri_br_provider.json.erb +38 -0
  5. data/execution_scripts/README.md +16 -0
  6. data/lib/onc_certification_g31_test_kit/documentation_attestation_test.rb +55 -0
  7. data/lib/onc_certification_g31_test_kit/endpoints/g31_cds_services_discovery_handler.rb +30 -0
  8. data/lib/onc_certification_g31_test_kit/endpoints/g31_hook_request_endpoint.rb +12 -0
  9. data/lib/onc_certification_g31_test_kit/g31_certification_suite.rb +358 -0
  10. data/lib/onc_certification_g31_test_kit/g31_certification_suite_short_id_map.yml +1971 -0
  11. data/lib/onc_certification_g31_test_kit/g31_crd_import.rb +96 -0
  12. data/lib/onc_certification_g31_test_kit/g31_options.rb +33 -0
  13. data/lib/onc_certification_g31_test_kit/g31_requirements.rb +96 -0
  14. data/lib/onc_certification_g31_test_kit/igs/.keep +0 -0
  15. data/lib/onc_certification_g31_test_kit/igs/README.md +21 -0
  16. data/lib/onc_certification_g31_test_kit/metadata.rb +71 -0
  17. data/lib/onc_certification_g31_test_kit/requirements/(g)(31)_HTI-4_requirements.xlsx +0 -0
  18. data/lib/onc_certification_g31_test_kit/requirements/(j)(20)_HTI-4_requirements.xlsx +0 -0
  19. data/lib/onc_certification_g31_test_kit/requirements/generated/g31_certification_requirements_coverage.csv +1296 -0
  20. data/lib/onc_certification_g31_test_kit/requirements/onc_certification_g31_test_kit_requirements.csv +17 -0
  21. data/lib/onc_certification_g31_test_kit/version.rb +4 -0
  22. data/lib/onc_certification_g31_test_kit.rb +1 -0
  23. metadata +114 -0
@@ -0,0 +1,358 @@
1
+ require 'davinci_crd_test_kit'
2
+ require_relative 'metadata'
3
+ require_relative 'g31_options'
4
+ require_relative 'g31_crd_import'
5
+ require_relative 'documentation_attestation_test'
6
+ require_relative 'endpoints/g31_cds_services_discovery_handler'
7
+ require_relative 'endpoints/g31_hook_request_endpoint'
8
+ require_relative 'g31_requirements'
9
+
10
+ module ONCCertificationG31TestKit
11
+ class G31CertificationSuite < Inferno::TestSuite
12
+ id :g31_certification
13
+ title 'ONC Certification (g)(31) Coverage Requirements Discovery API'
14
+ short_title '(g)(31) CRD API'
15
+ description %(
16
+ The ONC Certification (g)(31) Coverage Requirements Discovery API Test Suite
17
+ is a testing tool for Health Level 7 (HL7®) Fast Healthcare Interoperability
18
+ Resources (FHIR®) clients seeking to meet the requirements of the
19
+ [Coverage Requirements Discovery criterion § 170.315(g)(31)](https://healthit.gov/test-method/provider-prior-authorization-api-coverage-requirements-discovery)
20
+ in the ONC Health IT Certification Program.
21
+
22
+ This test suite is organized into groups that in sum cover the
23
+ requirements within the [§ 170.315(g)(31) certification
24
+ criterion](https://healthit.gov/test-method/provider-prior-authorization-api-coverage-requirements-discovery/).
25
+ The groups are intended to be run in order during certification testing, but can
26
+ be run out of order to support testing during development or certification
27
+ preparation. Some scenarios depend on data collected during previous
28
+ groups to function. In these cases, the group description describes
29
+ these dependencies.
30
+
31
+ Additional details about executing the tests in this suite can be found in
32
+ the [walkthrough](https://github.com/onc-healthit/onc-certification-g31-test-kit/wiki/Walkthrough)
33
+ which describes how to execute these tests against a publicly available
34
+ reference implementation.
35
+
36
+ To get started, configure the Health IT Module to use Inferno's simulated
37
+ CRD server by pointing it at the following CDS Hooks discovery endpoints
38
+ and begin with the "Registration" group:
39
+
40
+ * `#{G31CRDImport.base_url}#{DaVinciCRDTestKit::DISCOVERY_PATH}`
41
+ * `#{G31CRDImport.base_url}#{DaVinciCRDTestKit::PREFETCH_DISCOVERY_PATH}`
42
+
43
+ Systems must pass all tests to qualify for ONC certification.
44
+ )
45
+
46
+ suite_summary %(
47
+ The ONC Certification (g)(31) Coverage Requirements Discovery API Test Kit is a testing tool
48
+ for Health Level 7 (HL7®) Fast Healthcare Interoperability Resources
49
+ (FHIR®) clients seeking to meet the requirements of the Coverage
50
+ Requirements Discovery criterion § 170.315(g)(31) in the ONC Health IT
51
+ Certification Program.
52
+
53
+ The Da Vinci Coverage Requirements Discovery FHIR IG referenced by (g)(31) requires Health IT
54
+ Modules to support a version of the US Core IG, but provides several options. Please
55
+ select which version of US Core to use, and click 'Create Test
56
+ Session' to begin testing.
57
+ )
58
+
59
+ links [
60
+ {
61
+ label: 'Report Issue',
62
+ url: 'https://github.com/onc-healthit/onc-certification-g31-test-kit/issues/'
63
+ },
64
+ {
65
+ label: 'Open Source',
66
+ url: 'https://github.com/onc-healthit/onc-certification-g31-test-kit/'
67
+ },
68
+ {
69
+ label: 'Download',
70
+ url: 'https://github.com/onc-healthit/onc-certification-g31-test-kit/releases'
71
+ }
72
+ ]
73
+
74
+ # Allow the tester to select which US Core version to test against when
75
+ # launching the suite
76
+ suite_option :us_core_version,
77
+ title: 'US Core Version',
78
+ list_options: [
79
+ {
80
+ label: 'US Core 3.1.1',
81
+ value: G31Options::US_CORE_3
82
+ },
83
+ {
84
+ label: 'US Core 6.1.0',
85
+ value: G31Options::US_CORE_6
86
+ },
87
+ {
88
+ label: 'US Core 7.0.0',
89
+ value: G31Options::US_CORE_7
90
+ }
91
+ ]
92
+
93
+ requirement_sets(
94
+ {
95
+ identifier: '170.315(g)(31)_HTI-4',
96
+ title: '170.315(g)(31) Coverage requirements discovery',
97
+ actor: 'Provider'
98
+ },
99
+ {
100
+ identifier: '170.315(j)(20)_HTI-4',
101
+ title: '170.315(j)(20) Workflow triggers for decision support interventions—clients',
102
+ actor: 'Client'
103
+ },
104
+ {
105
+ identifier: 'hl7.fhir.us.davinci-crd_2.2.1',
106
+ title: 'Da Vinci Coverage Requirements Discovery (CRD) v2.2.1',
107
+ actor: 'CRD Client',
108
+ requirements: 'billopt-1,conf-1,conf-3,conf-6,conf-10,conf-12,conf-13,dev-3-A,dev-12,dev-26-A,' \
109
+ 'dev-26-B,dev-28,dev-29-A,dev-30,dev-32,found-6,found-20,found-21,found-23,found-24,' \
110
+ 'found-25-A,found-25-B,found-31,found-33,found-36-A,found-36-B,found-37,hook-1,' \
111
+ 'hook-2-A,hook-2-B,hook-3,hook-7,hook-8,hook-20,hook-21,hook-37,hook-39,' \
112
+ 'impl-1,prof-3,prof-4,prof-5,prof-6,prof-7,prof-8,prof-9,prof-10,prof-11,prof-12,' \
113
+ 'prof-13,resp-14,resp-46,resp-48,resp-49,sec-1,sec-2,sec-7'
114
+ },
115
+ {
116
+ identifier: 'cds-hooks_3.0.0-ballot',
117
+ title: 'CDS Hooks 3.0.0-ballot',
118
+ actor: 'Client',
119
+ requirements: '1-3,15,25,30,42,45-47,51,53,63,64,168,172-174,178,180-185,187,189-192,196,197,' \
120
+ '199,202,203,208,214,222-224,231,232,239,240,242'
121
+ },
122
+ {
123
+ identifier: 'cds-hooks-library_1.0.1',
124
+ title: 'CDS Hooks Library',
125
+ actor: 'Client',
126
+ requirements: 'referenced'
127
+ },
128
+ {
129
+ identifier: 'hl7.fhir.us.core_3.1.1',
130
+ title: 'US Core Implementation Guide v3.1.1',
131
+ actor: 'Server',
132
+ suite_options: {
133
+ us_core_version: G31Options::US_CORE_3
134
+ }
135
+ },
136
+ {
137
+ identifier: 'hl7.fhir.us.core_6.1.0',
138
+ title: 'US Core Implementation Guide v6.1.0',
139
+ actor: 'Server',
140
+ suite_options: {
141
+ us_core_version: G31Options::US_CORE_6
142
+ }
143
+ },
144
+ {
145
+ identifier: 'hl7.fhir.us.core_7.0.0',
146
+ title: 'US Core Implementation Guide v7.0.0',
147
+ actor: 'Server',
148
+ suite_options: {
149
+ us_core_version: G31Options::US_CORE_7
150
+ }
151
+ }
152
+ )
153
+
154
+ verifies_requirements '170.315(g)(31)_HTI-4@1', '170.315(g)(31)_HTI-4@2', '170.315(g)(31)_HTI-4@6',
155
+ 'cds-hooks_3.0.0-ballot@1', 'cds-hooks_3.0.0-ballot@15', 'cds-hooks_3.0.0-ballot@208'
156
+
157
+ fhir_resource_validator required_suite_options: G31Options::US_CORE_3_REQUIREMENT do
158
+ igs(G31Options::CRD_V221_IG_PACKAGE)
159
+
160
+ validation_context do
161
+ snomedCT '731000124108'
162
+ txServer ENV.fetch('G31_TERMINOLOGY_SERVER', 'https://tx.fhir.org/r4')
163
+ displayWarnings true
164
+ end
165
+
166
+ exclude_message do |message|
167
+ ['info', 'warning'].include?(message.type) ||
168
+ DaVinciCRDTestKit::V221::CRDClientSuite::US_CORE_3_MESSAGE_FILTERS.any? { |match_template| message.message.match?(match_template) }
169
+ end
170
+ end
171
+
172
+ fhir_resource_validator required_suite_options: G31Options::US_CORE_6_REQUIREMENT do
173
+ igs(G31Options::CRD_V221_IG_PACKAGE)
174
+
175
+ validation_context do
176
+ snomedCT '731000124108'
177
+ txServer ENV.fetch('G31_TERMINOLOGY_SERVER', 'https://tx.fhir.org/r4')
178
+ displayWarnings true
179
+ end
180
+
181
+ exclude_message do |message|
182
+ ['info', 'warning'].include?(message.type) ||
183
+ DaVinciCRDTestKit::V221::CRDClientSuite::US_CORE_6_MESSAGE_FILTERS.any? { |match_template| message.message.match?(match_template) }
184
+ end
185
+ end
186
+
187
+ fhir_resource_validator required_suite_options: G31Options::US_CORE_7_REQUIREMENT do
188
+ igs(G31Options::CRD_V221_IG_PACKAGE)
189
+
190
+ validation_context do
191
+ snomedCT '731000124108'
192
+ txServer ENV.fetch('G31_TERMINOLOGY_SERVER', 'https://tx.fhir.org/r4')
193
+ displayWarnings true
194
+ end
195
+
196
+ exclude_message do |message|
197
+ ['info', 'warning'].include?(message.type) ||
198
+ DaVinciCRDTestKit::V221::CRDClientSuite::US_CORE_7_MESSAGE_FILTERS.any? { |match_template| message.message.match?(match_template) }
199
+ end
200
+ end
201
+
202
+ fhir_resource_validator :no_custom_extensions do
203
+ igs(G31Options::CRD_V221_IG_PACKAGE)
204
+
205
+ validation_context do
206
+ snomedCT '731000124108'
207
+ txServer ENV.fetch('G31_TERMINOLOGY_SERVER', 'https://tx.fhir.org/r4')
208
+ displayWarnings true
209
+ extensions []
210
+ end
211
+
212
+ exclude_message do |message|
213
+ ['info', 'warning'].include?(message.type) ||
214
+ DaVinciCRDTestKit::V221::CRDClientSuite::CRD_MESSAGE_FILTERS.any? { |match_template| message.message.match?(match_template) }
215
+ end
216
+ end
217
+
218
+ CRD_HOOK_PATHS = [
219
+ DaVinciCRDTestKit::APPOINTMENT_BOOK_PATH,
220
+ DaVinciCRDTestKit::ENCOUNTER_START_PATH,
221
+ DaVinciCRDTestKit::ENCOUNTER_DISCHARGE_PATH,
222
+ DaVinciCRDTestKit::ORDER_DISPATCH_PATH,
223
+ DaVinciCRDTestKit::ORDER_SELECT_PATH,
224
+ DaVinciCRDTestKit::ORDER_SIGN_PATH,
225
+ DaVinciCRDTestKit::APPOINTMENT_BOOK_PREFETCH_SUBSET_PATH,
226
+ DaVinciCRDTestKit::ENCOUNTER_START_PREFETCH_SUBSET_PATH,
227
+ DaVinciCRDTestKit::ENCOUNTER_DISCHARGE_PREFETCH_SUBSET_PATH,
228
+ DaVinciCRDTestKit::ORDER_DISPATCH_PREFETCH_SUBSET_PATH,
229
+ DaVinciCRDTestKit::ORDER_SELECT_PREFETCH_SUBSET_PATH,
230
+ DaVinciCRDTestKit::ORDER_SIGN_PREFETCH_SUBSET_PATH
231
+ ].freeze
232
+
233
+ CRD_DISCOVERY_PATHS = [
234
+ DaVinciCRDTestKit::DISCOVERY_PATH,
235
+ DaVinciCRDTestKit::PREFETCH_DISCOVERY_PATH
236
+ ].freeze
237
+
238
+ # The CRD IG version lives in a path prefix rather than in the suite id, so this stays a single
239
+ # suite as more versions are added
240
+ CRD_V221_PREFIX = G31Options::CRD_V221_PREFIX
241
+
242
+ CRD_DISCOVERY_PATHS.each do |path|
243
+ route :get, CRD_V221_PREFIX + path, G31CDSServicesDiscoveryHandler
244
+ end
245
+
246
+ allow_cors(*(CRD_HOOK_PATHS + CRD_DISCOVERY_PATHS).map { |path| CRD_V221_PREFIX + path })
247
+
248
+ CRD_HOOK_PATHS.each do |path|
249
+ suite_endpoint :post, CRD_V221_PREFIX + path, G31HookRequestEndpoint
250
+ end
251
+
252
+ def self.extract_token_from_query_params(request)
253
+ request.query_parameters['token']
254
+ end
255
+
256
+ resume_test_route :get, CRD_V221_PREFIX + DaVinciCRDTestKit::RESUME_PASS_PATH do |request|
257
+ G31CertificationSuite.extract_token_from_query_params(request)
258
+ end
259
+ resume_test_route :get, CRD_V221_PREFIX + DaVinciCRDTestKit::RESUME_FAIL_PATH, result: 'fail' do |request|
260
+ G31CertificationSuite.extract_token_from_query_params(request)
261
+ end
262
+
263
+ G31CRDImport.import!(
264
+ group do
265
+ id :g31_hook_invocation
266
+ title 'Hook Invocation'
267
+ description %(
268
+ During these tests, Inferno will simulate a CRD server for the Health IT Module
269
+ to interact with. The Health IT Module must:
270
+ 1. Register with both of Inferno's simulated CRD servers.
271
+ 2. Discover the capabilities of Inferno's CDS services.
272
+ 3. Make `order-sign` hook requests demonstrating conformance to CRD
273
+ client requirements across a variety of scenarios.
274
+
275
+ Sub-group execution order notes:
276
+ - The "Registration" group must be run first. It records the connection details
277
+ that the remaining groups use to associate incoming hook requests with
278
+ this test session.
279
+ - The "Cross-Invocation Requirements" group must be run after the "order-sign" group as requests
280
+ made during that group will be analyzed.
281
+ - Sub-groups under the "Scenarios" group can be run at any time because
282
+ requests made during these tests are not included in the cross-invocation analysis.
283
+ )
284
+
285
+ group from: :crd_v221_client_registration, exclude_optional: true
286
+
287
+ group from: :crd_v221_client_hooks do
288
+ description %(
289
+ This group contains a sub-group which verifies the ability of the Health IT Module to make and
290
+ react to responses from the `order-sign` hook required by the
291
+ [Coverage Requirements Discovery criterion § 170.315(g)(31)](https://healthit.gov/test-method/provider-prior-authorization-api-coverage-requirements-discovery)
292
+ * [order-sign](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/hooks.html#order-sign)
293
+
294
+ The hook-specific group follows a standard hook verification pattern:
295
+ 1. Allow the Health IT Module to make hook invocations for the tested hook,
296
+ waiting until the tester indicates that all desired requests have been made, then
297
+ 2. Check the requests and their associated responses for conformance to (g)(31), CRD, and CDS Hooks
298
+ requirements. Additionally, ask the tester to confirm that the responses were displayed
299
+ appropriately by the Health IT Module.
300
+
301
+ Inferno simulates two CRD discovery endpoints, each with an order-sign service endpoint
302
+ but with different service ids:
303
+ - Discovery endpoint for services requesting the complete [standard prefetch data set](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/foundation.html#standard-prefetch):
304
+ `#{DaVinciCRDTestKit::V221::ClientURLs.discovery_url}`
305
+ * `order-sign` service id: `order-sign-service`
306
+ - Discovery endpoint for services requesting a subset of the [standard prefetch data set](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/foundation.html#standard-prefetch):
307
+ `#{DaVinciCRDTestKit::V221::ClientURLs.prefetch_subset_discovery_url}`
308
+ * `order-sign` service id: `order-sign-subset`
309
+ )
310
+
311
+ order_sign = groups.find { |group| group.id.to_s.include?('crd_v221_client_order_sign') }
312
+ order_sign.required
313
+
314
+ order_sign.config(
315
+ inputs: {
316
+ order_sign_selected_response_types: {
317
+ default: ['coverage_information'],
318
+ locked: true,
319
+ options: {
320
+ list_options: [
321
+ {
322
+ label: 'Coverage Information',
323
+ value: 'coverage_information'
324
+ }
325
+ ]
326
+ }
327
+ }
328
+ }
329
+ )
330
+ end
331
+
332
+ group from: :crd_v221_client_scenarios, exclude_optional: true
333
+ group from: :crd_v221_client_cross_hook, exclude_optional: true
334
+ end
335
+ )
336
+
337
+ G31CRDImport.import!(group(from: :crd_v221_client_fhir_api, exclude_optional: true))
338
+
339
+ G31CRDImport.import!(
340
+ group(from: :crd_v221_client_attestations, exclude_optional: true) do
341
+ crd_description = description
342
+ description <<~DESCRIPTION
343
+ #{crd_description.strip}
344
+
345
+ These tests also verify the visual inspection and attestation requirements of the
346
+ [§ 170.315(g)(31) certification
347
+ criterion](https://healthit.gov/test-method/provider-prior-authorization-api-coverage-requirements-discovery).
348
+ DESCRIPTION
349
+
350
+ test from: :g31_documentation_attestation_test
351
+ end
352
+ )
353
+
354
+ # Adds the (g)(31) and (j)(20) certification requirements to the imported runnables that verify
355
+ # them, after every group has been imported.
356
+ G31Requirements.apply!(self)
357
+ end
358
+ end