davinci_crd_test_kit 0.9.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 (83) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/lib/davinci_crd_test_kit/card_responses/companions_prerequisites.json +58 -0
  4. data/lib/davinci_crd_test_kit/card_responses/create_update_coverage_information.json +20 -0
  5. data/lib/davinci_crd_test_kit/card_responses/external_reference.json +21 -0
  6. data/lib/davinci_crd_test_kit/card_responses/instructions.json +14 -0
  7. data/lib/davinci_crd_test_kit/card_responses/launch_smart_app.json +21 -0
  8. data/lib/davinci_crd_test_kit/card_responses/propose_alternate_request.json +71 -0
  9. data/lib/davinci_crd_test_kit/card_responses/request_form_completion.json +227 -0
  10. data/lib/davinci_crd_test_kit/cards_validation.rb +234 -0
  11. data/lib/davinci_crd_test_kit/client_fhir_api_group.rb +762 -0
  12. data/lib/davinci_crd_test_kit/client_hook_request_validation.rb +15 -0
  13. data/lib/davinci_crd_test_kit/client_hooks_group.rb +706 -0
  14. data/lib/davinci_crd_test_kit/client_tests/appointment_book_receive_request_test.rb +71 -0
  15. data/lib/davinci_crd_test_kit/client_tests/client_display_cards_attest.rb +48 -0
  16. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_create_test.rb +40 -0
  17. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_read_test.rb +39 -0
  18. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_search_test.rb +232 -0
  19. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb +40 -0
  20. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_validation_test.rb +60 -0
  21. data/lib/davinci_crd_test_kit/client_tests/decode_auth_token_test.rb +40 -0
  22. data/lib/davinci_crd_test_kit/client_tests/encounter_discharge_receive_request_test.rb +68 -0
  23. data/lib/davinci_crd_test_kit/client_tests/encounter_start_receive_request_test.rb +68 -0
  24. data/lib/davinci_crd_test_kit/client_tests/hook_request_optional_fields_test.rb +41 -0
  25. data/lib/davinci_crd_test_kit/client_tests/hook_request_required_fields_test.rb +40 -0
  26. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_context_test.rb +63 -0
  27. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_prefetch_test.rb +151 -0
  28. data/lib/davinci_crd_test_kit/client_tests/order_dispatch_receive_request_test.rb +79 -0
  29. data/lib/davinci_crd_test_kit/client_tests/order_select_receive_request_test.rb +76 -0
  30. data/lib/davinci_crd_test_kit/client_tests/order_sign_receive_request_test.rb +79 -0
  31. data/lib/davinci_crd_test_kit/client_tests/retrieve_jwks_test.rb +65 -0
  32. data/lib/davinci_crd_test_kit/client_tests/token_header_test.rb +34 -0
  33. data/lib/davinci_crd_test_kit/client_tests/token_payload_test.rb +61 -0
  34. data/lib/davinci_crd_test_kit/crd_client_suite.rb +156 -0
  35. data/lib/davinci_crd_test_kit/crd_jwks.json +59 -0
  36. data/lib/davinci_crd_test_kit/crd_options.rb +9 -0
  37. data/lib/davinci_crd_test_kit/crd_server_suite.rb +115 -0
  38. data/lib/davinci_crd_test_kit/ext/inferno_core/runnable.rb +22 -0
  39. data/lib/davinci_crd_test_kit/hook_request_field_validation.rb +410 -0
  40. data/lib/davinci_crd_test_kit/jwks.rb +25 -0
  41. data/lib/davinci_crd_test_kit/jwt_helper.rb +74 -0
  42. data/lib/davinci_crd_test_kit/mock_service_response.rb +421 -0
  43. data/lib/davinci_crd_test_kit/routes/cds-services.json +74 -0
  44. data/lib/davinci_crd_test_kit/routes/cds_services_discovery_handler.rb +18 -0
  45. data/lib/davinci_crd_test_kit/routes/hook_request_endpoint.rb +93 -0
  46. data/lib/davinci_crd_test_kit/routes/jwk_set_endpoint_handler.rb +15 -0
  47. data/lib/davinci_crd_test_kit/server_appointment_book_group.rb +173 -0
  48. data/lib/davinci_crd_test_kit/server_discovery_group.rb +59 -0
  49. data/lib/davinci_crd_test_kit/server_encounter_discharge_group.rb +144 -0
  50. data/lib/davinci_crd_test_kit/server_encounter_start_group.rb +144 -0
  51. data/lib/davinci_crd_test_kit/server_hook_request_validation.rb +15 -0
  52. data/lib/davinci_crd_test_kit/server_hooks_group.rb +69 -0
  53. data/lib/davinci_crd_test_kit/server_order_dispatch_group.rb +173 -0
  54. data/lib/davinci_crd_test_kit/server_order_select_group.rb +169 -0
  55. data/lib/davinci_crd_test_kit/server_order_sign_group.rb +198 -0
  56. data/lib/davinci_crd_test_kit/server_required_card_response_validation_group.rb +23 -0
  57. data/lib/davinci_crd_test_kit/server_tests/additional_orders_validation_test.rb +70 -0
  58. data/lib/davinci_crd_test_kit/server_tests/card_optional_fields_validation_test.rb +47 -0
  59. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_across_hooks_validation_test.rb +32 -0
  60. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_received_test.rb +58 -0
  61. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_validation_test.rb +121 -0
  62. data/lib/davinci_crd_test_kit/server_tests/create_or_update_coverage_info_response_validation_test.rb +72 -0
  63. data/lib/davinci_crd_test_kit/server_tests/discovery_endpoint_test.rb +88 -0
  64. data/lib/davinci_crd_test_kit/server_tests/discovery_services_validation_test.rb +65 -0
  65. data/lib/davinci_crd_test_kit/server_tests/external_reference_card_across_hooks_validation_test.rb +28 -0
  66. data/lib/davinci_crd_test_kit/server_tests/external_reference_card_validation_test.rb +36 -0
  67. data/lib/davinci_crd_test_kit/server_tests/form_completion_response_validation_test.rb +79 -0
  68. data/lib/davinci_crd_test_kit/server_tests/instructions_card_received_across_hooks_test.rb +25 -0
  69. data/lib/davinci_crd_test_kit/server_tests/instructions_card_received_test.rb +28 -0
  70. data/lib/davinci_crd_test_kit/server_tests/launch_smart_app_card_validation_test.rb +38 -0
  71. data/lib/davinci_crd_test_kit/server_tests/propose_alternate_request_card_validation_test.rb +65 -0
  72. data/lib/davinci_crd_test_kit/server_tests/service_call_test.rb +86 -0
  73. data/lib/davinci_crd_test_kit/server_tests/service_request_context_validation_test.rb +30 -0
  74. data/lib/davinci_crd_test_kit/server_tests/service_request_optional_fields_validation_test.rb +41 -0
  75. data/lib/davinci_crd_test_kit/server_tests/service_request_required_fields_validation_test.rb +43 -0
  76. data/lib/davinci_crd_test_kit/server_tests/service_response_validation_test.rb +82 -0
  77. data/lib/davinci_crd_test_kit/suggestion_actions_validation.rb +123 -0
  78. data/lib/davinci_crd_test_kit/tags.rb +8 -0
  79. data/lib/davinci_crd_test_kit/test_helper.rb +23 -0
  80. data/lib/davinci_crd_test_kit/urls.rb +52 -0
  81. data/lib/davinci_crd_test_kit/version.rb +3 -0
  82. data/lib/davinci_crd_test_kit.rb +2 -0
  83. metadata +170 -0
@@ -0,0 +1,762 @@
1
+ require 'tls_test_kit'
2
+ require_relative 'crd_options'
3
+ require_relative 'client_tests/client_fhir_api_read_test'
4
+ require_relative 'client_tests/client_fhir_api_search_test'
5
+ require_relative 'client_tests/client_fhir_api_create_test'
6
+ require_relative 'client_tests/client_fhir_api_update_test'
7
+ require_relative 'client_tests/client_fhir_api_validation_test'
8
+ require 'smart_app_launch/smart_stu1_suite'
9
+ require 'smart_app_launch/smart_stu2_suite'
10
+
11
+ module DaVinciCRDTestKit
12
+ class ClientFHIRAPIGroup < Inferno::TestGroup
13
+ title 'FHIR API'
14
+ description <<~DESCRIPTION
15
+ Systems wishing to conform to the [CRD Client](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html)
16
+ role are responsible for returning data requested by the CRD Server needed to provide decision support. The Da
17
+ Vinci CRD Client FHIR API Test Group contains tests that test the ['server' capabilities](https://hl7.org/fhir/us/davinci-crd/CapabilityStatement-crd-client.html#resourcesSummary1)
18
+ of the CRD Client and ensures that the CRD Client can respond to CRD Server queriers. These 'server' capabilities
19
+ are based on [US Core](https://hl7.org/fhir/us/core/STU3.1.1/). This test kit does not test the base US Core
20
+ capabilities. In addition to the U.S. Core expectations, the CRD Client SHALL support all 'SHOULD' `read` and
21
+ `search` capabilities listed for resources referenced in supported hooks and order types if it does not support
22
+ returning the associated resources as part of CDS Hooks pre-fetch. The CRD Client SHALL also support `update`
23
+ functionality for all resources listed where the client allows invoking hooks based on the resource.
24
+
25
+ This test group contains two main groups of tests:
26
+ * SMART App Launch Authorization: A group of tests that perform FHIR API authorization using [SMART on FHIR](https://hl7.org/fhir/smart-app-launch/index.html)
27
+ EHR Launch Sequence
28
+ * CRD FHIR RESTful Capabilities: A group of tests that test each CRD resource profile and ensure the CRD client
29
+ supports the appropriate FHIR operations required on each resource
30
+ DESCRIPTION
31
+ id :crd_client_fhir_api
32
+
33
+ input :url,
34
+ title: 'FHIR Endpoint',
35
+ description: 'URL of the CRD FHIR server'
36
+
37
+ group do
38
+ title 'Authorization'
39
+ description %(
40
+ Perform an EHR [SMART App Launch](https://www.hl7.org/fhir/smart-app-launch/) to Authorize the client FHIR
41
+ server with Inferno so that Inferno may access resources on the FHIR server in order to perform the FHIR RESTful
42
+ Capabilities tests.
43
+ )
44
+
45
+ group from: :smart_discovery do
46
+ required_suite_options CRDOptions::SMART_1_REQUIREMENT
47
+ run_as_group
48
+
49
+ test from: :tls_version_test do
50
+ title 'CRD FHIR Server is secured by transport layer security'
51
+ description <<~DESCRIPTION
52
+ Under [Privacy, Security, and Safety](https://hl7.org/fhir/us/davinci-crd/STU2/security.html),
53
+ the CRD Implementation Guide imposes the following rule about TLS:
54
+
55
+ As per the [CDS Hook specification](https://cds-hooks.hl7.org/2.0/#security-and-safety),
56
+ communications between CRD Clients and CRD Servers SHALL
57
+ use TLS. Mutual TLS is not required by this specification but is permitted. CRD Servers and
58
+ CRD Clients SHOULD enforce a minimum version and other TLS configuration requirements based
59
+ on HRex rules for PHI exchange.
60
+
61
+ This test verifies that the FHIR server is using TLS 1.2 or higher.
62
+ DESCRIPTION
63
+ id :crd_server_tls_version_stu1
64
+
65
+ config(
66
+ options: { minimum_allowed_version: OpenSSL::SSL::TLS1_2_VERSION }
67
+ )
68
+ end
69
+ end
70
+
71
+ group from: :smart_ehr_launch,
72
+ required_suite_options: CRDOptions::SMART_1_REQUIREMENT,
73
+ run_as_group: true
74
+
75
+ group from: :smart_discovery_stu2 do
76
+ required_suite_options CRDOptions::SMART_2_REQUIREMENT
77
+ run_as_group
78
+
79
+ test from: :tls_version_test do
80
+ title 'CRD FHIR Server is secured by transport layer security'
81
+ description <<~DESCRIPTION
82
+ Under [Privacy, Security, and Safety](https://hl7.org/fhir/us/davinci-crd/STU2/security.html),
83
+ the CRD Implementation Guide imposes the following rule about TLS:
84
+
85
+ As per the [CDS Hook specification](https://cds-hooks.hl7.org/2.0/#security-and-safety),
86
+ communications between CRD Clients and CRD Servers SHALL
87
+ use TLS. Mutual TLS is not required by this specification but is permitted. CRD Servers and
88
+ CRD Clients SHOULD enforce a minimum version and other TLS configuration requirements based
89
+ on HRex rules for PHI exchange.
90
+
91
+ This test verifies that the FHIR server is using TLS 1.2 or higher.
92
+ DESCRIPTION
93
+ id :crd_server_tls_version_stu2
94
+
95
+ config(
96
+ options: { minimum_allowed_version: OpenSSL::SSL::TLS1_2_VERSION }
97
+ )
98
+ end
99
+ end
100
+
101
+ group from: :smart_ehr_launch_stu2,
102
+ required_suite_options: CRDOptions::SMART_2_REQUIREMENT,
103
+ run_as_group: true
104
+
105
+ group from: :smart_openid_connect do
106
+ run_as_group
107
+ optional
108
+ config(
109
+ inputs: {
110
+ id_token: { name: :ehr_id_token },
111
+ client_id: { name: :ehr_client_id },
112
+ requested_scopes: { name: :ehr_requested_scopes },
113
+ access_token: { name: :ehr_access_token },
114
+ smart_credentials: { name: :ehr_smart_credentials }
115
+ }
116
+ )
117
+ end
118
+
119
+ group from: :smart_token_refresh do
120
+ run_as_group
121
+ optional
122
+ config(
123
+ inputs: {
124
+ refresh_token: { name: :ehr_refresh_token },
125
+ client_id: { name: :ehr_client_id },
126
+ client_secret: { name: :ehr_client_secret },
127
+ received_scopes: { name: :ehr_received_scopes }
128
+ }
129
+ )
130
+ end
131
+ end
132
+
133
+ group do
134
+ title 'FHIR RESTful Capabilities'
135
+ description %(
136
+ This test group contains groups of tests for each CRD resource profile and ensures the [CRD Client](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html)
137
+ supports the appropriate FHIR operations required on each resource. For each resource, Inferno will perform the
138
+ required FHIR operations, and then it will validate any resources that are returned as a result of
139
+ these FHIR operations.
140
+
141
+ The resources that are a part of the CRD IG configuration include:
142
+ * [Appointment](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Appointment1-1)
143
+ * [CommunicationRequest](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#CommunicationRequest1-2)
144
+ * [Coverage](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Coverage1-3)
145
+ * [Device](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Device1-4)
146
+ * [DeviceRequest](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#DeviceRequest1-5)
147
+ * [Encounter](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Encounter1-6)
148
+ * [Patient](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Patient1-7)
149
+ * [Practitioner](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Practitioner1-8)
150
+ * [PractitionerRole](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#PractitionerRole1-9)
151
+ * [Location](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Location1-10)
152
+ * [MedicationRequest](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#MedicationRequest1-11)
153
+ * [NutritionOrder](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#NutritionOrder1-12)
154
+ * [Organization](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Organization1-13)
155
+ * [ServiceRequest](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#ServiceRequest1-14)
156
+ * [ClaimResponse](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#ClaimResponse1-15)
157
+ * [Task](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Task1-16)
158
+ * [VisionPrescription](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#VisionPrescription1-17)
159
+ )
160
+ input :url
161
+ input :ehr_smart_credentials,
162
+ type: :oauth_credentials,
163
+ title: 'OAuth Credentials',
164
+ optional: true
165
+
166
+ fhir_client do
167
+ url :url
168
+ oauth_credentials :ehr_smart_credentials
169
+ end
170
+
171
+ group do
172
+ title 'Appointment'
173
+ description %(
174
+ Verify the CRD client can perform the required FHIR interactions on the Appointment resource, and
175
+ validate any returned resources against the [CRD Appointment profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-appointment.html)
176
+
177
+ Required Appointment resource FHIR interactions:
178
+ * SHOULD support `update`
179
+
180
+ Resource Conformance: SHOULD
181
+ )
182
+ optional
183
+
184
+ test from: :crd_client_fhir_api_update_test,
185
+ optional: true,
186
+ config: {
187
+ options: { resource_type: 'Appointment' },
188
+ inputs: {
189
+ update_resources: {
190
+ name: :appointment_update_resources,
191
+ title: 'Appointment Resources'
192
+ }
193
+ }
194
+ }
195
+ end
196
+
197
+ group do
198
+ title 'CommunicationRequest'
199
+ description %(
200
+ Verify the CRD client can perform the required FHIR interactions on the CommunicationRequest resource, and
201
+ validate any returned resources against the [CRD CommunicationRequest profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-communicationrequest.html)
202
+
203
+ Required CommunicationRequest resource FHIR interactions:
204
+ * SHOULD support `update`
205
+
206
+ Resource Conformance: SHOULD
207
+ )
208
+ optional
209
+
210
+ test from: :crd_client_fhir_api_update_test,
211
+ optional: true,
212
+ config: {
213
+ options: { resource_type: 'CommunicationRequest' },
214
+ inputs: {
215
+ update_resources: {
216
+ name: :communication_request_update_resources,
217
+ title: 'CommunicationRequest Resources'
218
+ }
219
+ }
220
+ }
221
+ end
222
+
223
+ group do
224
+ title 'Coverage'
225
+ description %(
226
+ Verify the CRD client can perform the required FHIR interactions on the Coverage resource, and
227
+ validate any returned resources against the [CRD Coverage profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-coverage.html)
228
+
229
+ Required Coverage resource FHIR interactions:
230
+ * SHALL suport search by [`patient`](http://hl7.org/fhir/R4/coverage.html#search)
231
+ * SHALL suport search by [`status`](http://hl7.org/fhir/R4/coverage.html#search)
232
+
233
+ Resource Conformance: SHALL
234
+ )
235
+
236
+ test from: :crd_client_fhir_api_search_test,
237
+ id: :crd_client_coverage_patient_search_test,
238
+ title: 'Search by patient',
239
+ config: {
240
+ options: { resource_type: 'Coverage', search_type: 'patient' },
241
+ inputs: { search_param_values: {
242
+ name: :patient_ids,
243
+ title: 'Patient IDs',
244
+ description: 'Comma separated list of Patient IDs that in sum contain all MUST SUPPORT elements'
245
+ } }
246
+ }
247
+
248
+ test from: :crd_client_fhir_api_search_test,
249
+ id: :crd_client_coverage_status_search_test,
250
+ title: 'Search by status',
251
+ config: {
252
+ options: { resource_type: 'Coverage', search_type: 'status' },
253
+ inputs: { search_param_values: {
254
+ name: :patient_ids
255
+ } }
256
+ }
257
+
258
+ test from: :crd_client_fhir_api_validation_test,
259
+ config: {
260
+ options: { resource_type: 'Coverage' }
261
+ }
262
+ end
263
+
264
+ group do
265
+ title 'Device'
266
+ description %(
267
+ Verify the CRD client can perform the required FHIR interactions on the Device resource, and
268
+ validate any returned resources against the [CRD Device profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-device.html)
269
+
270
+ Required Device resource FHIR interactions:
271
+ * SHOULD support `read`
272
+
273
+ Resource Conformance: SHOULD
274
+ )
275
+ optional
276
+
277
+ test from: :crd_client_fhir_api_read_test,
278
+ optional: true,
279
+ config: {
280
+ options: { resource_type: 'Device' },
281
+ inputs: {
282
+ resource_ids: {
283
+ name: :device_ids,
284
+ title: 'Device IDs',
285
+ description: 'Comma separated list of Device IDs that in sum contain all MUST SUPPORT elements'
286
+ }
287
+ }
288
+ }
289
+
290
+ test from: :crd_client_fhir_api_validation_test,
291
+ config: {
292
+ options: { resource_type: 'Device' }
293
+ }
294
+ end
295
+
296
+ group do
297
+ title 'DeviceRequest'
298
+ description %(
299
+ Verify the CRD client can perform the required FHIR interactions on the DeviceRequest resource, and
300
+ validate any returned resources against the [CRD DeviceRequest profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-devicerequest.html)
301
+
302
+ Required DeviceRequest resource FHIR interactions:
303
+ * SHOULD support `update`
304
+
305
+ Resource Conformance: SHOULD
306
+ )
307
+ optional
308
+
309
+ test from: :crd_client_fhir_api_update_test,
310
+ optional: true,
311
+ config: {
312
+ options: { resource_type: 'DeviceRequest' },
313
+ inputs: {
314
+ update_resources: {
315
+ name: :device_request_update_resources,
316
+ title: 'DeviceRequest Resources'
317
+ }
318
+ }
319
+ }
320
+ end
321
+
322
+ group do
323
+ title 'Encounter'
324
+ description %(
325
+ Verify the CRD client can perform the required FHIR interactions on the Encounter resource, and
326
+ validate any returned resources against the [CRD Encounter profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-encounter.html)
327
+
328
+ Required Encounter resource FHIR interactions:
329
+ * SHOULD support `update`
330
+ * SHALL support search by [`_id`](http://hl7.org/fhir/R4/encounter.html#search)
331
+ * SHALL support search by [`organization`](http://hl7.org/fhir/R4/encounter.html#search) and
332
+ performing an `_include` on Location
333
+
334
+ Resource Conformance: SHALL
335
+ )
336
+
337
+ test from: :crd_client_fhir_api_update_test,
338
+ optional: true,
339
+ config: {
340
+ options: { resource_type: 'Encounter' },
341
+ inputs: {
342
+ update_resources: {
343
+ name: :encounter_update_resources,
344
+ title: 'Encounter Resources'
345
+ }
346
+ }
347
+ }
348
+
349
+ test from: :crd_client_fhir_api_search_test,
350
+ id: :crd_client_encounter_id_search_test,
351
+ title: 'Search by _id',
352
+ config: {
353
+ options: { resource_type: 'Encounter', search_type: '_id' },
354
+ inputs: { search_param_values: {
355
+ name: :encounter_ids,
356
+ title: 'Encounter IDs',
357
+ description: 'Comma separated list of Encounter IDs that in sum contain all MUST SUPPORT elements'
358
+ } }
359
+ }
360
+
361
+ test from: :crd_client_fhir_api_search_test,
362
+ id: :crd_client_encounter_organization_search_test,
363
+ title: 'Search by organization',
364
+ config: {
365
+ options: { resource_type: 'Encounter', search_type: 'organization' },
366
+ inputs: { search_param_values: {
367
+ name: :organization_ids,
368
+ title: 'Organization IDs',
369
+ description: 'Comma separated list of Organization IDs that in sum contain all MUST SUPPORT elements'
370
+ } }
371
+ }
372
+
373
+ test from: :crd_client_fhir_api_search_test,
374
+ id: :crd_client_encounter_location_include_test,
375
+ title: 'Search by _id and _include location',
376
+ config: {
377
+ options: { resource_type: 'Encounter', search_type: 'location_include' },
378
+ inputs: { search_param_values: {
379
+ name: :encounter_ids,
380
+ title: 'Encounter IDs',
381
+ description: 'Comma separated list of Encounter IDs that in sum contain all MUST SUPPORT elements'
382
+ } }
383
+ }
384
+
385
+ test from: :crd_client_fhir_api_validation_test,
386
+ config: {
387
+ options: { resource_type: 'Encounter' }
388
+ }
389
+ end
390
+
391
+ group do
392
+ title 'Patient'
393
+ description %(
394
+ Verify the CRD client can perform the required FHIR interactions on the Patient resource, and
395
+ validate any returned resources against the [CRD Patient profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-patient.html)
396
+
397
+ Required Patient resource FHIR interactions:
398
+ * SHOULD support `read`
399
+
400
+ Resource Conformance: SHOULD
401
+ )
402
+ optional
403
+
404
+ test from: :crd_client_fhir_api_read_test,
405
+ optional: true,
406
+ config: {
407
+ options: { resource_type: 'Patient' },
408
+ inputs: {
409
+ resource_ids: {
410
+ name: :patient_ids,
411
+ title: 'Patient IDs',
412
+ description: 'Comma separated list of Patient IDs that in sum contain all MUST SUPPORT elements'
413
+ }
414
+ }
415
+ }
416
+
417
+ test from: :crd_client_fhir_api_validation_test,
418
+ config: {
419
+ options: { resource_type: 'Patient' }
420
+ }
421
+ end
422
+
423
+ group do
424
+ title 'Practitioner'
425
+ description %(
426
+ Verify the CRD client can perform the required FHIR interactions on the Practitioner resource, and
427
+ validate any returned resources against the [CRD Practitioner profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-practitioner.html)
428
+
429
+ Required Practitioner resource FHIR interactions:
430
+ * SHOULD support `read`
431
+
432
+ Resource Conformance: SHOULD
433
+ )
434
+ optional
435
+
436
+ test from: :crd_client_fhir_api_read_test,
437
+ optional: true,
438
+ config: {
439
+ options: { resource_type: 'Practitioner' },
440
+ inputs: {
441
+ resource_ids: {
442
+ name: :practitioner_ids,
443
+ title: 'Practitioner IDs',
444
+ description: 'Comma separated list of Practitioner IDs that in sum contain all MUST SUPPORT elements'
445
+ }
446
+ }
447
+ }
448
+
449
+ test from: :crd_client_fhir_api_validation_test,
450
+ config: {
451
+ options: { resource_type: 'Practitioner' }
452
+ }
453
+ end
454
+
455
+ group do
456
+ title 'PractitionerRole'
457
+ description %(
458
+ Verify the CRD client can perform the required FHIR interactions on the PractitionerRole resource, and
459
+ validate any returned resources against the [US Core PractitionerRole profile](https://hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-us-core-practitionerrole.html)
460
+
461
+ Required PractitionerRole resource FHIR interactions:
462
+ * SHALL support search by [`_id`](http://hl7.org/fhir/R4/practitionerrole.html#search)
463
+ * SHALL support search by [`organization`](http://hl7.org/fhir/R4/practitionerrole.html#search) and
464
+ performing an `_include` on Organization
465
+ * SHALL support search by [`practitioner`](http://hl7.org/fhir/R4/practitionerrole.html#search) and
466
+ performing an `_include` on Practitioner
467
+
468
+ Resource Conformance: SHALL
469
+ )
470
+
471
+ test from: :crd_client_fhir_api_search_test,
472
+ id: :crd_client_practitioner_role_id_search_test,
473
+ title: 'Search by _id',
474
+ config: {
475
+ options: { resource_type: 'PractitionerRole', search_type: '_id' },
476
+ inputs: { search_param_values: {
477
+ name: :practitioner_role_ids,
478
+ title: 'PractitionerRole IDs',
479
+ description: 'Comma separated list of Practitioner IDs that in sum contain all MUST SUPPORT elements'
480
+ } }
481
+ }
482
+
483
+ test from: :crd_client_fhir_api_search_test,
484
+ id: :crd_client_practitioner_role_organization_search_test,
485
+ title: 'Search by organization',
486
+ config: {
487
+ options: { resource_type: 'PractitionerRole', search_type: 'organization' },
488
+ inputs: { search_param_values: {
489
+ name: :organization_ids,
490
+ title: 'Organization IDs',
491
+ description: 'Comma separated list of Organization IDs that in sum contain all MUST SUPPORT elements'
492
+ } }
493
+ }
494
+
495
+ test from: :crd_client_fhir_api_search_test,
496
+ id: :crd_client_practitioner_role_practitioner_search_test,
497
+ title: 'Search by practitioner',
498
+ config: {
499
+ options: { resource_type: 'PractitionerRole', search_type: 'practitioner' },
500
+ inputs: { search_param_values: {
501
+ name: :practitioner_ids,
502
+ title: 'Practitioner IDs',
503
+ description: 'Comma separated list of Practitioner IDs that in sum contain all MUST SUPPORT elements'
504
+ } }
505
+ }
506
+
507
+ test from: :crd_client_fhir_api_search_test,
508
+ id: :crd_client_practitioner_role_organization_include_test,
509
+ title: 'Search by _id and _include organization',
510
+ config: {
511
+ options: { resource_type: 'PractitionerRole', search_type: 'organization_include' },
512
+ inputs: { search_param_values: {
513
+ name: :practitioner_role_ids,
514
+ title: 'PractitionerRole IDs',
515
+ description: %(
516
+ Comma separated list of PractitionerRole IDs that in sum contain all MUST SUPPORT elements
517
+ )
518
+ } }
519
+ }
520
+
521
+ test from: :crd_client_fhir_api_search_test,
522
+ id: :crd_client_practitioner_role_practitioner_include_test,
523
+ title: 'Search by _id and _include practitioner',
524
+ config: {
525
+ options: { resource_type: 'PractitionerRole', search_type: 'practitioner_include' },
526
+ inputs: { search_param_values: {
527
+ name: :practitioner_role_ids,
528
+ title: 'PractitionerRole IDs',
529
+ description: %(
530
+ Comma separated list of PractitionerRole IDs that in sum contain all MUST SUPPORT elements
531
+ )
532
+ } }
533
+ }
534
+
535
+ test from: :crd_client_fhir_api_validation_test,
536
+ config: {
537
+ options: { resource_type: 'PractitionerRole' }
538
+ }
539
+ end
540
+
541
+ group do
542
+ title 'Location'
543
+ description %(
544
+ Verify the CRD client can perform the required FHIR interactions on the Location resource, and
545
+ validate any returned resources against the [CRD Location profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-location.html)
546
+
547
+ Required Location resource FHIR interactions:
548
+ * SHOULD support `read`
549
+
550
+ Resource Conformance: SHOULD
551
+ )
552
+ optional
553
+
554
+ test from: :crd_client_fhir_api_read_test,
555
+ optional: true,
556
+ config: {
557
+ options: { resource_type: 'Location' },
558
+ inputs: {
559
+ resource_ids: {
560
+ name: :location_ids,
561
+ title: 'Location IDs',
562
+ description: 'Comma separated list of Location IDs that in sum contain all MUST SUPPORT elements'
563
+ }
564
+ }
565
+ }
566
+
567
+ test from: :crd_client_fhir_api_validation_test,
568
+ config: {
569
+ options: { resource_type: 'Location' }
570
+ }
571
+ end
572
+
573
+ group do
574
+ title 'MedicationRequest'
575
+ description %(
576
+ Verify the CRD client can perform the required FHIR interactions on the MedicationRequest resource, and
577
+ validate any returned resources against the [CRD MedicationRequest profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-medicationrequest.html)
578
+
579
+ Required MedicationRequest resource FHIR interactions:
580
+ * SHOULD support `update`
581
+
582
+ Resource Conformance: SHOULD
583
+ )
584
+ optional
585
+
586
+ test from: :crd_client_fhir_api_update_test,
587
+ optional: true,
588
+ config: {
589
+ options: { resource_type: 'MedicationRequest' },
590
+ inputs: {
591
+ update_resources: {
592
+ name: :medication_request_update_resources,
593
+ title: 'MedicationRequest Resources'
594
+ }
595
+ }
596
+ }
597
+ end
598
+
599
+ group do
600
+ title 'NutritionOrder'
601
+ description %(
602
+ Verify the CRD client can perform the required FHIR interactions on the NutritionOrder resource, and
603
+ validate any returned resources against the [CRD NutritionOrder profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-nutritionorder.html)
604
+
605
+ Required NutritionOrder resource FHIR interactions:
606
+ * SHOULD support `update`
607
+
608
+ Resource Conformance: SHOULD
609
+ )
610
+ optional
611
+
612
+ test from: :crd_client_fhir_api_update_test,
613
+ optional: true,
614
+ config: {
615
+ options: { resource_type: 'NutritionOrder' },
616
+ inputs: {
617
+ update_resources: {
618
+ name: :nutrition_order_update_resources,
619
+ title: 'NutritionOrder Resources'
620
+ }
621
+ }
622
+ }
623
+ end
624
+
625
+ group do
626
+ title 'Organization'
627
+ description %(
628
+ Verify the CRD client can perform the required FHIR interactions on the Organization resource, and
629
+ validate any returned resources against the [CRD Organization profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-organization.html)
630
+
631
+ Required Organization resource FHIR interactions:
632
+ * SHOULD support `read`
633
+
634
+ Resource Conformance: SHOULD
635
+ )
636
+ optional
637
+
638
+ test from: :crd_client_fhir_api_read_test,
639
+ optional: true,
640
+ config: {
641
+ options: { resource_type: 'Organization' },
642
+ inputs: {
643
+ resource_ids: {
644
+ name: :organization_ids,
645
+ title: 'Organization IDs',
646
+ description: 'Comma separated list of Organization IDs that in sum contain all MUST SUPPORT elements'
647
+ }
648
+ }
649
+ }
650
+
651
+ test from: :crd_client_fhir_api_validation_test,
652
+ config: {
653
+ options: { resource_type: 'Organization' }
654
+ }
655
+ end
656
+
657
+ group do
658
+ title 'ServiceRequest'
659
+ description %(
660
+ Verify the CRD client can perform the required FHIR interactions on the ServiceRequest resource, and
661
+ validate any returned resources against the [CRD ServiceRequest profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-servicerequest.html)
662
+
663
+ Required ServiceRequest resource FHIR interactions:
664
+ * SHOULD support `update`
665
+
666
+ Resource Conformance: SHOULD
667
+ )
668
+ optional
669
+
670
+ test from: :crd_client_fhir_api_update_test,
671
+ optional: true,
672
+ config: {
673
+ options: { resource_type: 'ServiceRequest' },
674
+ inputs: {
675
+ update_resources: {
676
+ name: :service_request_update_resources,
677
+ title: 'ServiceRequest Resources'
678
+ }
679
+ }
680
+ }
681
+ end
682
+
683
+ group do
684
+ title 'ClaimResponse'
685
+ description %(
686
+ Verify the CRD client can perform the required FHIR interactions on the ClaimResponse resource, and
687
+ validate any returned resources against the [CRD ClaimResponse profile](https://hl7.org/fhir/us/davinci-hrex/STU1/StructureDefinition-hrex-claimresponse.html)
688
+
689
+ Required ClaimResponse resource FHIR interactions:
690
+ * SHOULD support `create`
691
+
692
+ Resource Conformance: SHOULD
693
+ )
694
+ optional
695
+
696
+ test from: :crd_client_fhir_api_create_test,
697
+ optional: true,
698
+ config: {
699
+ options: { resource_type: 'ClaimResponse' },
700
+ inputs: {
701
+ create_resources: {
702
+ name: :claim_response_create_resources,
703
+ title: 'ClaimResponse Resources'
704
+ }
705
+ }
706
+ }
707
+ end
708
+
709
+ group do
710
+ title 'Task'
711
+ description %(
712
+ Verify the CRD client can perform the required FHIR interactions on the Task resource, and
713
+ validate any returned resources against the [CRD Task profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-taskquestionnaire.html)
714
+
715
+ Required Task resource FHIR interactions:
716
+ * SHOULD support `create`
717
+
718
+ Resource Conformance: SHOULD
719
+ )
720
+ optional
721
+
722
+ test from: :crd_client_fhir_api_create_test,
723
+ optional: true,
724
+ config: {
725
+ options: { resource_type: 'Task' },
726
+ inputs: {
727
+ create_resources: {
728
+ name: :task_create_resources,
729
+ title: 'Task Resources'
730
+ }
731
+ }
732
+ }
733
+ end
734
+
735
+ group do
736
+ title 'VisionPrescription'
737
+ description %(
738
+ Verify the CRD client can perform the required FHIR interactions on the VisionPrescription resource, and
739
+ validate any returned resources against the [CRD VisionPrescription profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-visionprescription.html)
740
+
741
+ Required VisionPrescription resource FHIR interactions:
742
+ * SHOULD support `update`
743
+
744
+ Resource Conformance: SHOULD
745
+ )
746
+ optional
747
+
748
+ test from: :crd_client_fhir_api_update_test,
749
+ optional: true,
750
+ config: {
751
+ options: { resource_type: 'VisionPrescription' },
752
+ inputs: {
753
+ update_resources: {
754
+ name: :vision_prescription_update_resources,
755
+ title: 'VisionPrescription Resources'
756
+ }
757
+ }
758
+ }
759
+ end
760
+ end
761
+ end
762
+ end