davinci_crd_test_kit 0.9.0 → 0.9.1.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/davinci_crd_test_kit/card_responses/propose_alternate_request.json +2 -52
  3. data/lib/davinci_crd_test_kit/card_responses/request_form_completion.json +46 -31
  4. data/lib/davinci_crd_test_kit/cards_validation.rb +8 -4
  5. data/lib/davinci_crd_test_kit/client_hooks_group.rb +22 -660
  6. data/lib/davinci_crd_test_kit/client_tests/appointment_book_receive_request_test.rb +17 -6
  7. data/lib/davinci_crd_test_kit/client_tests/client_appointment_book_group.rb +70 -0
  8. data/lib/davinci_crd_test_kit/client_tests/client_encounter_discharge_group.rb +71 -0
  9. data/lib/davinci_crd_test_kit/client_tests/client_encounter_start_group.rb +70 -0
  10. data/lib/davinci_crd_test_kit/client_tests/client_order_dispatch_group.rb +70 -0
  11. data/lib/davinci_crd_test_kit/client_tests/client_order_select_group.rb +72 -0
  12. data/lib/davinci_crd_test_kit/client_tests/client_order_sign_group.rb +71 -0
  13. data/lib/davinci_crd_test_kit/client_tests/decode_auth_token_test.rb +43 -23
  14. data/lib/davinci_crd_test_kit/client_tests/encounter_discharge_receive_request_test.rb +19 -6
  15. data/lib/davinci_crd_test_kit/client_tests/encounter_start_receive_request_test.rb +18 -6
  16. data/lib/davinci_crd_test_kit/client_tests/hook_request_optional_fields_test.rb +26 -10
  17. data/lib/davinci_crd_test_kit/client_tests/hook_request_required_fields_test.rb +20 -11
  18. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_context_test.rb +14 -10
  19. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_prefetch_test.rb +27 -110
  20. data/lib/davinci_crd_test_kit/client_tests/order_dispatch_receive_request_test.rb +18 -6
  21. data/lib/davinci_crd_test_kit/client_tests/order_select_receive_request_test.rb +18 -6
  22. data/lib/davinci_crd_test_kit/client_tests/order_sign_receive_request_test.rb +18 -6
  23. data/lib/davinci_crd_test_kit/client_tests/retrieve_jwks_test.rb +66 -29
  24. data/lib/davinci_crd_test_kit/client_tests/submitted_response_validation.rb +44 -0
  25. data/lib/davinci_crd_test_kit/client_tests/token_header_test.rb +45 -14
  26. data/lib/davinci_crd_test_kit/client_tests/token_payload_test.rb +43 -26
  27. data/lib/davinci_crd_test_kit/crd_client_suite.rb +0 -4
  28. data/lib/davinci_crd_test_kit/hook_request_field_validation.rb +240 -50
  29. data/lib/davinci_crd_test_kit/mock_service_response.rb +134 -120
  30. data/lib/davinci_crd_test_kit/routes/hook_request_endpoint.rb +26 -42
  31. data/lib/davinci_crd_test_kit/server_encounter_discharge_group.rb +24 -0
  32. data/lib/davinci_crd_test_kit/server_encounter_start_group.rb +24 -0
  33. data/lib/davinci_crd_test_kit/server_order_select_group.rb +24 -0
  34. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_received_test.rb +4 -1
  35. data/lib/davinci_crd_test_kit/server_tests/service_request_optional_fields_validation_test.rb +8 -10
  36. data/lib/davinci_crd_test_kit/server_tests/service_request_required_fields_validation_test.rb +5 -10
  37. data/lib/davinci_crd_test_kit/tags.rb +6 -6
  38. data/lib/davinci_crd_test_kit/version.rb +1 -1
  39. metadata +9 -2
@@ -1,22 +1,9 @@
1
- require_relative 'client_tests/appointment_book_receive_request_test'
2
- require_relative 'client_tests/encounter_start_receive_request_test'
3
- require_relative 'client_tests/encounter_discharge_receive_request_test'
4
- require_relative 'client_tests/order_dispatch_receive_request_test'
5
- require_relative 'client_tests/order_select_receive_request_test'
6
- require_relative 'client_tests/order_sign_receive_request_test'
7
- require_relative 'client_tests/client_display_cards_attest'
8
-
9
- require_relative 'client_tests/decode_auth_token_test'
10
- require_relative 'client_tests/retrieve_jwks_test'
11
- require_relative 'client_tests/token_header_test'
12
- require_relative 'client_tests/token_payload_test'
13
-
14
- require_relative 'client_tests/hook_request_required_fields_test'
15
- require_relative 'client_tests/hook_request_optional_fields_test'
16
-
17
- require_relative 'client_tests/hook_request_valid_context_test'
18
-
19
- require_relative 'client_tests/hook_request_valid_prefetch_test'
1
+ require_relative 'client_tests/client_appointment_book_group'
2
+ require_relative 'client_tests/client_encounter_discharge_group'
3
+ require_relative 'client_tests/client_encounter_start_group'
4
+ require_relative 'client_tests/client_order_dispatch_group'
5
+ require_relative 'client_tests/client_order_select_group'
6
+ require_relative 'client_tests/client_order_sign_group'
20
7
 
21
8
  require_relative 'jwt_helper'
22
9
  require_relative 'urls'
@@ -48,6 +35,10 @@ module DaVinciCRDTestKit
48
35
  each hook type
49
36
  * OPTIONAL: If the incoming hook contains the optional `prefetch` field with valid resources
50
37
  * If the client can properly display the cards returned as a result of the hook request
38
+
39
+ Note: In order to successfully return a `Coverage Information` system action, a Coverage resource must either be
40
+ provided in the service request's `prefetch` field, or must be fetchable from the client's FHIR server for
41
+ the patient provided in the service request.
51
42
  DESCRIPTION
52
43
  id :crd_client_hooks
53
44
 
@@ -56,651 +47,22 @@ module DaVinciCRDTestKit
56
47
  description: 'The `iss` claim of the JWT in the Authorization header ' \
57
48
  'will be used to associate incoming requests with this test session'
58
49
 
59
- group do
60
- title 'appointment-book'
61
- description <<~DESCRIPTION
62
- The appointment-book hook is invoked when the user is scheduling one or more future encounters/visits for the
63
- patient. These tests are based on the following criteria:
64
- * [CRD IG requirements for this hook](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#appointment-book),
65
- which include the profiles that are expected to be used for the resources resolved to by `context` FHIR ID
66
- fields
67
- * Specific [appointment-book `context` requirements](https://cds-hooks.hl7.org/hooks/appointment-book/2023SepSTU1Ballot/appointment-book/)
68
- defined in the CDS Hooks specification
69
-
70
- This version of the CRD implementation guide refers to version 1.0 of the hook.
71
- DESCRIPTION
72
-
73
- run_as_group
74
-
75
- test from: :crd_appointment_book_request
76
-
77
- test from: :crd_decode_auth_token,
78
- config: {
79
- requests: {
80
- hook_request: { name: :appointment_book }
81
- },
82
- outputs: {
83
- auth_token: { name: :appointment_book_auth_token },
84
- auth_token_payload_json: { name: :appointment_book_auth_token_payload_json },
85
- auth_token_header_json: { name: :appointment_book_auth_token_header_json }
86
- }
87
- }
88
- test from: :crd_retrieve_jwks,
89
- config: {
90
- inputs: {
91
- auth_token_header_json: { name: :appointment_book_auth_token_header_json }
92
- },
93
- outputs: {
94
- crd_jwks_json: { name: :appointment_book_crd_jwks_json },
95
- crd_jwks_keys_json: { name: :appointment_book_crd_jwks_keys_json }
96
- }
97
- }
98
- test from: :crd_token_header,
99
- config: {
100
- inputs: {
101
- auth_token_header_json: { name: :appointment_book_auth_token_header_json },
102
- crd_jwks_keys_json: { name: :appointment_book_crd_jwks_keys_json }
103
- },
104
- outputs: {
105
- auth_token_jwk_json: { name: :appointment_book_auth_token_jwk_json }
106
- }
107
- }
108
- test from: :crd_token_payload,
109
- config: {
110
- options: { hook_path: APPOINTMENT_BOOK_PATH },
111
- inputs: {
112
- auth_token: { name: :appointment_book_auth_token },
113
- auth_token_jwk_json: { name: :appointment_book_auth_token_jwk_json }
114
- }
115
- }
116
-
117
- test from: :crd_hook_request_required_fields,
118
- config: {
119
- options: {
120
- hook_path: APPOINTMENT_BOOK_PATH,
121
- hook_name: 'appointment-book'
122
- },
123
- requests: {
124
- hook_request: { name: :appointment_book }
125
- }
126
- }
127
- test from: :crd_hook_request_optional_fields,
128
- config: {
129
- outputs: {
130
- client_fhir_server: { name: :appointment_book_client_fhir_server },
131
- client_access_token: { name: :appointment_book_client_access_token }
132
- },
133
- requests: {
134
- hook_request: { name: :appointment_book }
135
- }
136
- }
137
-
138
- test from: :crd_hook_request_valid_context,
139
- config: {
140
- inputs: {
141
- client_fhir_server: { name: :appointment_book_client_fhir_server },
142
- client_access_token: { name: :appointment_book_client_access_token }
143
- },
144
- options: { hook_name: 'appointment-book' },
145
- requests: {
146
- hook_request: { name: :appointment_book }
147
- }
148
- }
149
-
150
- test from: :crd_hook_request_valid_prefetch,
151
- config: {
152
- options: { hook_name: 'appointment-book' },
153
- requests: {
154
- hook_request: { name: :appointment_book }
155
- }
156
- }
157
-
158
- test from: :crd_card_display_attest_test,
159
- config: {
160
- inputs: {
161
- selected_response_types: { name: :appointment_book_selected_response_types }
162
- }
163
- }
164
- end
165
-
166
- group do
167
- title 'encounter-start'
168
- description <<~DESCRIPTION
169
- The encounter-start hook is invoked when the user is initiating a new encounter. These tests are based on the
170
- following criteria:
171
- * [CRD IG requirements for this hook](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-start),
172
- which include the profiles that are expected to be used for the resources resolved to by `context` FHIR ID
173
- fields
174
- * Specific [encounter-start `context` requirements](https://cds-hooks.hl7.org/hooks/encounter-start/2023SepSTU1Ballot/encounter-start/)
175
- defined in the CDS Hooks specification
176
-
177
- This version of the CRD implementation guide refers to version 1.0 of the hook.
178
- DESCRIPTION
179
-
180
- run_as_group
181
-
182
- test from: :crd_encounter_start_request
183
-
184
- test from: :crd_decode_auth_token,
185
- config: {
186
- requests: {
187
- hook_request: { name: :encounter_start }
188
- },
189
- outputs: {
190
- auth_token: { name: :encounter_start_auth_token },
191
- auth_token_payload_json: { name: :encounter_start_auth_token_payload_json },
192
- auth_token_header_json: { name: :encounter_start_auth_token_header_json }
193
- }
194
- }
195
- test from: :crd_retrieve_jwks,
196
- config: {
197
- inputs: {
198
- auth_token_header_json: { name: :encounter_start_auth_token_header_json }
199
- },
200
- outputs: {
201
- crd_jwks_json: { name: :encounter_start_crd_jwks_json },
202
- crd_jwks_keys_json: { name: :encounter_start_crd_jwks_keys_json }
203
- }
204
- }
205
- test from: :crd_token_header,
206
- config: {
207
- inputs: {
208
- auth_token_header_json: { name: :encounter_start_auth_token_header_json },
209
- crd_jwks_keys_json: { name: :encounter_start_crd_jwks_keys_json }
210
- },
211
- outputs: {
212
- auth_token_jwk_json: { name: :encounter_start_auth_token_jwk_json }
213
- }
214
- }
215
- test from: :crd_token_payload,
216
- config: {
217
- options: { hook_path: ENCOUNTER_START_PATH },
218
- inputs: {
219
- auth_token: { name: :encounter_start_auth_token },
220
- auth_token_jwk_json: { name: :encounter_start_auth_token_jwk_json }
221
- }
222
- }
223
-
224
- test from: :crd_hook_request_required_fields,
225
- config: {
226
- options: {
227
- hook_path: ENCOUNTER_START_PATH,
228
- hook_name: 'encounter-start'
229
- },
230
- requests: {
231
- hook_request: { name: :encounter_start }
232
- }
233
- }
234
- test from: :crd_hook_request_optional_fields,
235
- config: {
236
- outputs: {
237
- client_fhir_server: { name: :encounter_start_client_fhir_server },
238
- client_access_token: { name: :encounter_start_client_access_token }
239
- },
240
- requests: {
241
- hook_request: { name: :encounter_start }
242
- }
243
- }
244
-
245
- test from: :crd_hook_request_valid_context,
246
- config: {
247
- inputs: {
248
- client_fhir_server: { name: :encounter_start_client_fhir_server },
249
- client_access_token: { name: :encounter_start_client_access_token }
250
- },
251
- options: { hook_name: 'encounter-start' },
252
- requests: {
253
- hook_request: { name: :encounter_start }
254
- }
255
- }
256
-
257
- test from: :crd_hook_request_valid_prefetch,
258
- config: {
259
- options: { hook_name: 'encounter-start' },
260
- requests: {
261
- hook_request: { name: :encounter_start }
262
- }
263
- }
264
-
265
- test from: :crd_card_display_attest_test,
266
- config: {
267
- inputs: {
268
- selected_response_types: { name: :encounter_start_selected_response_types }
269
- }
270
- }
271
- end
272
-
273
- group do
274
- title 'encounter-discharge'
275
- description <<~DESCRIPTION
276
- The encounter-discharge hook is invoked when the user is performing the discharge process for an encounter where
277
- the notion of 'discharge' is relevant - typically an inpatient encounter. These tests are based on the
278
- following criteria:
279
- * [CRD IG requirements for this hook](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-discharge),
280
- which includes the profiles that are expected to be used for the resources resolved to by `context`
281
- FHIR ID fields
282
- * Specific [encounter-discharge `context` requirements](https://cds-hooks.hl7.org/hooks/encounter-discharge/2023SepSTU1Ballot/encounter-discharge/)
283
- defined in the CDS Hooks specification
284
-
285
- This version of the CRD implementation guide refers to version 1.0 of the hook.
286
- DESCRIPTION
287
-
288
- run_as_group
289
-
290
- test from: :crd_encounter_discharge_request
291
-
292
- test from: :crd_decode_auth_token,
293
- config: {
294
- requests: {
295
- hook_request: { name: :encounter_discharge }
296
- },
297
- outputs: {
298
- auth_token: { name: :encounter_discharge_auth_token },
299
- auth_token_payload_json: { name: :encounter_discharge_auth_token_payload_json },
300
- auth_token_header_json: { name: :encounter_discharge_auth_token_header_json }
301
- }
302
- }
303
- test from: :crd_retrieve_jwks,
304
- config: {
305
- inputs: {
306
- auth_token_header_json: { name: :encounter_discharge_auth_token_header_json }
307
- },
308
- outputs: {
309
- crd_jwks_json: { name: :encounter_discharge_crd_jwks_json },
310
- crd_jwks_keys_json: { name: :encounter_discharge_crd_jwks_keys_json }
311
- }
312
- }
313
- test from: :crd_token_header,
314
- config: {
315
- inputs: {
316
- auth_token_header_json: { name: :encounter_discharge_auth_token_header_json },
317
- crd_jwks_keys_json: { name: :encounter_discharge_crd_jwks_keys_json }
318
- },
319
- outputs: {
320
- auth_token_jwk_json: { name: :encounter_discharge_auth_token_jwk_json }
321
- }
322
- }
323
- test from: :crd_token_payload,
324
- config: {
325
- options: { hook_path: ENCOUNTER_DISCHARGE_PATH },
326
- inputs: {
327
- auth_token: { name: :encounter_discharge_auth_token },
328
- auth_token_jwk_json: { name: :encounter_discharge_auth_token_jwk_json }
329
- }
330
- }
331
-
332
- test from: :crd_hook_request_required_fields,
333
- config: {
334
- options: {
335
- hook_path: ENCOUNTER_DISCHARGE_PATH,
336
- hook_name: 'encounter-discharge'
337
- },
338
- requests: {
339
- hook_request: { name: :encounter_discharge }
340
- }
341
- }
342
- test from: :crd_hook_request_optional_fields,
343
- config: {
344
- outputs: {
345
- client_fhir_server: { name: :encounter_discharge_client_fhir_server },
346
- client_access_token: { name: :encounter_discharge_client_access_token }
347
- },
348
- requests: {
349
- hook_request: { name: :encounter_discharge }
350
- }
351
- }
352
-
353
- test from: :crd_hook_request_valid_context,
354
- config: {
355
- inputs: {
356
- client_fhir_server: { name: :encounter_discharge_client_fhir_server },
357
- client_access_token: { name: :encounter_discharge_client_access_token }
358
- },
359
- options: { hook_name: 'encounter-discharge' },
360
- requests: {
361
- hook_request: { name: :encounter_discharge }
362
- }
363
- }
364
-
365
- test from: :crd_hook_request_valid_prefetch,
366
- config: {
367
- options: { hook_name: 'encounter-discharge' },
368
- requests: {
369
- hook_request: { name: :encounter_discharge }
370
- }
371
- }
372
-
373
- test from: :crd_card_display_attest_test,
374
- config: {
375
- inputs: {
376
- selected_response_types: { name: :encounter_discharge_selected_response_types }
377
- }
378
- }
379
- end
380
-
381
- group do
382
- title 'order-select'
383
- description <<~DESCRIPTION
384
- The order-select hook fires when a clinician selects one or more orders to place for a patient,
385
- (including orders for medications, procedures, labs and other orders). If supported by the CDS Client, this
386
- hook may also be invoked each time the clinician selects a detail regarding the order. These tests are based on
387
- the following criteria:
388
- * [CRD IG requirements for this hook](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-selecte),
389
- which includes the profiles that are expected to be used for the resources resolved to by `context`
390
- FHIR ID fields
391
- * Specific [order-select `context` requirements](https://cds-hooks.hl7.org/hooks/order-select/2023SepSTU1Ballot/order-select/)
392
- defined in the CDS Hooks specification
393
-
394
- This version of the CRD implementation guide refers to version 1.0 of the hook.
395
- DESCRIPTION
396
- run_as_group
397
-
398
- test from: :crd_order_select_request
399
-
400
- test from: :crd_decode_auth_token,
401
- config: {
402
- requests: {
403
- hook_request: { name: :order_select }
404
- },
405
- outputs: {
406
- auth_token: { name: :order_select_auth_token },
407
- auth_token_payload_json: { name: :order_select_auth_token_payload_json },
408
- auth_token_header_json: { name: :order_select_auth_token_header_json }
409
- }
410
- }
411
-
412
- test from: :crd_retrieve_jwks,
413
- config: {
414
- inputs: {
415
- auth_token_header_json: { name: :order_select_auth_token_header_json }
416
- },
417
- outputs: {
418
- crd_jwks_json: { name: :order_select_crd_jwks_json },
419
- crd_jwks_keys_json: { name: :order_select_crd_jwks_keys_json }
420
- }
421
- }
422
- test from: :crd_token_header,
423
- config: {
424
- inputs: {
425
- auth_token_header_json: { name: :order_select_auth_token_header_json },
426
- crd_jwks_keys_json: { name: :order_select_crd_jwks_keys_json }
427
- },
428
- outputs: {
429
- auth_token_jwk_json: { name: :order_select_auth_token_jwk_json }
430
- }
431
- }
432
- test from: :crd_token_payload,
433
- config: {
434
- options: { hook_path: ORDER_SELECT_PATH },
435
- inputs: {
436
- auth_token: { name: :order_select_auth_token },
437
- auth_token_jwk_json: { name: :order_select_auth_token_jwk_json }
438
- }
439
- }
440
-
441
- test from: :crd_hook_request_required_fields,
442
- config: {
443
- options: {
444
- hook_path: ORDER_SELECT_PATH,
445
- hook_name: 'order-select'
446
- },
447
- requests: {
448
- hook_request: { name: :order_select }
449
- }
450
- }
451
- test from: :crd_hook_request_optional_fields,
452
- config: {
453
- outputs: {
454
- client_fhir_server: { name: :order_select_client_fhir_server },
455
- client_access_token: { name: :order_select_client_access_token }
456
- },
457
- requests: {
458
- hook_request: { name: :order_select }
459
- }
460
- }
461
-
462
- test from: :crd_hook_request_valid_context,
463
- config: {
464
- inputs: {
465
- client_fhir_server: { name: :order_select_client_fhir_server },
466
- client_access_token: { name: :order_select_client_access_token }
467
- },
468
- options: { hook_name: 'order-select' },
469
- requests: {
470
- hook_request: { name: :order_select }
471
- }
472
- }
473
-
474
- test from: :crd_hook_request_valid_prefetch,
475
- config: {
476
- options: { hook_name: 'order-select' },
477
- requests: {
478
- hook_request: { name: :order_select }
479
- }
480
- }
481
-
482
- test from: :crd_card_display_attest_test,
483
- config: {
484
- inputs: {
485
- selected_response_types: { name: :order_select_selected_response_types }
486
- }
487
- }
488
- end
489
-
490
- group do
491
- title 'order-dispatch'
492
- description <<~DESCRIPTION
493
- The order-dispatch hook fires when a practitioner is selecting a candidate performer for a pre-existing order
494
- that was not tied to a specific performer. These tests are based on the following criteria:
495
- * [CRD IG requirements for this hook](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-dispatch),
496
- which includes the profiles that are expected to be used for the resources resolved to by `context`
497
- FHIR ID fields
498
- * Specific [order-dispatch `context` requirements](https://cds-hooks.hl7.org/hooks/order-dispatch/2023SepSTU1Ballot/order-dispatch/)
499
- defined in the CDS Hooks specification
500
-
501
- This version of the CRD implementation guide refers to version 1.0 of the hook.
502
- DESCRIPTION
503
-
504
- run_as_group
505
-
506
- test from: :crd_order_dispatch_request
507
-
508
- test from: :crd_decode_auth_token,
509
- config: {
510
- requests: {
511
- hook_request: { name: :order_dispatch }
512
- },
513
- outputs: {
514
- auth_token: { name: :order_dispatch_auth_token },
515
- auth_token_payload_json: { name: :order_dispatch_auth_token_payload_json },
516
- auth_token_header_json: { name: :order_dispatch_auth_token_header_json }
517
- }
518
- }
519
-
520
- test from: :crd_retrieve_jwks,
521
- config: {
522
- inputs: {
523
- auth_token_header_json: { name: :order_dispatch_auth_token_header_json }
524
- },
525
- outputs: {
526
- crd_jwks_json: { name: :order_dispatch_crd_jwks_json },
527
- crd_jwks_keys_json: { name: :order_dispatch_crd_jwks_keys_json }
528
- }
529
- }
530
- test from: :crd_token_header,
531
- config: {
532
- inputs: {
533
- auth_token_header_json: { name: :order_dispatch_auth_token_header_json },
534
- crd_jwks_keys_json: { name: :order_dispatch_crd_jwks_keys_json }
535
- },
536
- outputs: {
537
- auth_token_jwk_json: { name: :order_dispatch_auth_token_jwk_json }
538
- }
539
- }
540
- test from: :crd_token_payload,
541
- config: {
542
- options: { hook_path: ORDER_DISPATCH_PATH },
543
- inputs: {
544
- auth_token: { name: :order_dispatch_auth_token },
545
- auth_token_jwk_json: { name: :order_dispatch_auth_token_jwk_json }
546
- }
547
- }
548
-
549
- test from: :crd_hook_request_required_fields,
550
- config: {
551
- options: {
552
- hook_path: ORDER_DISPATCH_PATH,
553
- hook_name: 'order-dispatch'
554
- },
555
- requests: {
556
- hook_request: { name: :order_dispatch }
557
- }
558
- }
559
- test from: :crd_hook_request_optional_fields,
560
- config: {
561
- outputs: {
562
- client_fhir_server: { name: :order_dispatch_client_fhir_server },
563
- client_access_token: { name: :order_dispatch_client_access_token }
564
- },
565
- requests: {
566
- hook_request: { name: :order_dispatch }
567
- }
568
- }
569
-
570
- test from: :crd_hook_request_valid_context,
571
- config: {
572
- inputs: {
573
- client_fhir_server: { name: :order_dispatch_client_fhir_server },
574
- client_access_token: { name: :order_dispatch_client_access_token }
575
- },
576
- options: { hook_name: 'order-dispatch' },
577
- requests: {
578
- hook_request: { name: :order_dispatch }
579
- }
580
- }
581
-
582
- test from: :crd_hook_request_valid_prefetch,
583
- config: {
584
- options: { hook_name: 'order-dispatch' },
585
- requests: {
586
- hook_request: { name: :order_dispatch }
587
- }
588
- }
589
-
590
- test from: :crd_card_display_attest_test,
591
- config: {
592
- inputs: {
593
- selected_response_types: { name: :order_dispatch_selected_response_types }
594
- }
595
- }
596
- end
597
-
598
- group do
599
- title 'order-sign'
600
- description <<~DESCRIPTION
601
- The order-sign hook fires when a clinician is ready to sign one or more orders for a patient, (including orders
602
- for medications, procedures, labs and other orders). These tests are based on the following criteria:
603
- * [CRD IG requirements for this hook](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-sign),
604
- which includes the profiles that are expected to be used for the resources resolved to by `context`
605
- FHIR ID fields
606
- * Specific [order-sign `context` requirements](https://cds-hooks.org/hooks/order-sign/)
607
- defined in the CDS Hooks specification
608
-
609
- This version of the CRD implementation guide refers to version 1.1 of the hook which, at the time of publication,
610
- was not available as a snapshot. Therefore the preceding link refers to the CDS hooks current build.
611
- DESCRIPTION
612
-
613
- run_as_group
614
-
615
- test from: :crd_order_sign_request
50
+ group from: :crd_client_appointment_book,
51
+ optional: true
616
52
 
617
- test from: :crd_decode_auth_token,
618
- config: {
619
- requests: {
620
- hook_request: { name: :order_sign }
621
- },
622
- outputs: {
623
- auth_token: { name: :order_sign_auth_token },
624
- auth_token_payload_json: { name: :order_sign_auth_token_payload_json },
625
- auth_token_header_json: { name: :order_sign_auth_token_header_json }
626
- }
627
- }
628
- test from: :crd_retrieve_jwks,
629
- config: {
630
- inputs: {
631
- auth_token_header_json: { name: :order_sign_auth_token_header_json }
632
- },
633
- outputs: {
634
- crd_jwks_json: { name: :order_sign_crd_jwks_json },
635
- crd_jwks_keys_json: { name: :order_sign_crd_jwks_keys_json }
636
- }
637
- }
638
- test from: :crd_token_header,
639
- config: {
640
- inputs: {
641
- auth_token_header_json: { name: :order_sign_auth_token_header_json },
642
- crd_jwks_keys_json: { name: :order_sign_crd_jwks_keys_json }
643
- },
644
- outputs: {
645
- auth_token_jwk_json: { name: :order_sign_auth_token_jwk_json }
646
- }
647
- }
648
- test from: :crd_token_payload,
649
- config: {
650
- options: { hook_path: ORDER_SIGN_PATH },
651
- inputs: {
652
- auth_token: { name: :order_sign_auth_token },
653
- auth_token_jwk_json: { name: :order_sign_auth_token_jwk_json }
654
- }
655
- }
53
+ group from: :crd_client_encounter_start,
54
+ optional: true
656
55
 
657
- test from: :crd_hook_request_required_fields,
658
- config: {
659
- options: {
660
- hook_path: ORDER_SIGN_PATH,
661
- hook_name: 'order-sign'
662
- },
663
- requests: {
664
- hook_request: { name: :order_sign }
665
- }
666
- }
667
- test from: :crd_hook_request_optional_fields,
668
- config: {
669
- outputs: {
670
- client_fhir_server: { name: :order_sign_client_fhir_server },
671
- client_access_token: { name: :order_sign_client_access_token }
672
- },
673
- requests: {
674
- hook_request: { name: :order_sign }
675
- }
676
- }
56
+ group from: :crd_client_encounter_discharge,
57
+ optional: true
677
58
 
678
- test from: :crd_hook_request_valid_context,
679
- config: {
680
- inputs: {
681
- client_fhir_server: { name: :order_sign_client_fhir_server },
682
- client_access_token: { name: :order_sign_client_access_token }
683
- },
684
- options: { hook_name: 'order-sign' },
685
- requests: {
686
- hook_request: { name: :order_sign }
687
- }
688
- }
59
+ group from: :crd_client_order_select,
60
+ optional: true
689
61
 
690
- test from: :crd_hook_request_valid_prefetch,
691
- config: {
692
- options: { hook_name: 'order-sign' },
693
- requests: {
694
- hook_request: { name: :order_sign }
695
- }
696
- }
62
+ group from: :crd_client_order_dispatch,
63
+ optional: true
697
64
 
698
- test from: :crd_card_display_attest_test,
699
- config: {
700
- inputs: {
701
- selected_response_types: { name: :order_sign_selected_response_types }
702
- }
703
- }
704
- end
65
+ group from: :crd_client_order_sign,
66
+ optional: true
705
67
  end
706
68
  end