davinci_crd_test_kit 0.14.1 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/{inferno_crd_server_suite.json.erb → client_against_inferno_crd_server_suite.json.erb} +0 -33
  3. data/config/presets/{ri_crd_request_generator.json.erb → client_against_ri_crd_request_generator.json.erb} +1 -14
  4. data/config/presets/client_v221_against_inferno_crd_server_suite.json.erb +84 -0
  5. data/config/presets/client_v221_against_ri_br_provider.json.erb +31 -0
  6. data/config/presets/{ri_crd_request_generator.json_v221.json.erb → client_v221_against_ri_crd_request_generator.json.erb} +1 -1
  7. data/config/presets/{inferno_crd_client_suite.json.erb → server_against_inferno_crd_client_suite.json.erb} +0 -43
  8. data/config/presets/{ri_crd_server.json.erb → server_against_ri_crd_server.json.erb} +1 -44
  9. data/config/presets/{inferno_crd_client_suite_v221.json.erb → server_v221_against_inferno_crd_client_suite.json.erb} +0 -61
  10. data/config/presets/{inferno_crd_client_suite_prefetch_subset_v221.json.erb → server_v221_against_inferno_crd_client_suite_prefetch_subset.json.erb} +0 -46
  11. data/config/presets/server_v221_against_inferno_g31_suite.json.erb +49 -0
  12. data/lib/davinci_crd_test_kit/client/cross_hook_helper.rb +26 -0
  13. data/lib/davinci_crd_test_kit/client/endpoints/custom_service_response.rb +7 -7
  14. data/lib/davinci_crd_test_kit/client/endpoints/gather_response_generation_data.rb +4 -1
  15. data/lib/davinci_crd_test_kit/client/endpoints/hook_request_endpoint.rb +63 -38
  16. data/lib/davinci_crd_test_kit/client/endpoints/mock_service_response.rb +26 -7
  17. data/lib/davinci_crd_test_kit/client/endpoints/scenario_service_response.rb +54 -0
  18. data/lib/davinci_crd_test_kit/client/tagged_request_load_helper.rb +8 -27
  19. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/retrieve_jwks_test.rb +35 -23
  20. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_payload_test.rb +34 -21
  21. data/lib/davinci_crd_test_kit/client/v2.0.1/cds-services-v201.json +20 -20
  22. data/lib/davinci_crd_test_kit/client/v2.0.1/client_appointment_book_group.rb +12 -10
  23. data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_discharge_group.rb +12 -10
  24. data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_start_group.rb +12 -10
  25. data/lib/davinci_crd_test_kit/client/v2.0.1/client_hooks_group.rb +5 -5
  26. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_dispatch_group.rb +12 -10
  27. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_select_group.rb +12 -10
  28. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_sign_group.rb +12 -10
  29. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_coverage_information.rb +3 -36
  30. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_external_reference.rb +3 -36
  31. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_instructions.rb +3 -36
  32. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_fetched_data_test.rb +4 -13
  33. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_prefetch_equals_queried_test.rb +3 -13
  34. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/client_display_cards_attest.rb +3 -13
  35. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/inferno_response_validation.rb +3 -13
  36. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_coverage_info_update_test.rb +1 -1
  37. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/attestation_instructions.rb +10 -0
  38. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_authorized_scope_attestation_test.rb +45 -0
  39. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_coverage_based_invocation_attestation_test.rb +44 -0
  40. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_data_element_expectations_attestation_test.rb +44 -0
  41. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_hook_invocation_logging_attestation_test.rb +43 -0
  42. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_exposure_attestation_test.rb +43 -0
  43. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_use_attestation_test.rb +41 -0
  44. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_order_sign_support_attestation_test.rb +42 -0
  45. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_prefetch_key_omission_attestation_test.rb +42 -0
  46. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_resource_identifiers_attestation_test.rb +43 -0
  47. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_response_case_distinction_attestation_test.rb +43 -0
  48. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_security_and_privacy_attestation_test.rb +43 -0
  49. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_workflow_integration_attestation_test.rb +44 -0
  50. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/decode_auth_token_test.rb +1 -1
  51. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/retrieve_jwks_test.rb +29 -18
  52. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_payload_test.rb +35 -22
  53. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-prefetch-subset-v221.json +47 -47
  54. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-v221.json +50 -50
  55. data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +16 -14
  56. data/lib/davinci_crd_test_kit/client/v2.2.1/client_attestations_group.rb +49 -0
  57. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_group.rb +22 -6
  58. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_interaction_group.rb +98 -0
  59. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +12 -10
  60. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +12 -10
  61. data/lib/davinci_crd_test_kit/client/v2.2.1/client_fhir_api_group.rb +14 -12
  62. data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +9 -9
  63. data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +2 -1
  64. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_dispatch_group.rb +16 -14
  65. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +12 -10
  66. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +16 -14
  67. data/lib/davinci_crd_test_kit/client/v2.2.1/client_scenarios_group.rb +26 -0
  68. data/lib/davinci_crd_test_kit/client/v2.2.1/client_self_pay_hook_group.rb +36 -0
  69. data/lib/davinci_crd_test_kit/client/v2.2.1/client_unknown_content_hook_group.rb +34 -0
  70. data/lib/davinci_crd_test_kit/client/v2.2.1/crd_client_suite.rb +19 -3
  71. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_card_must_support_coverage_information_test.rb +1 -1
  72. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_fhirpath_collection_as_comma_delimited_string_test.rb +4 -11
  73. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_hook_instances_unique_test.rb +1 -9
  74. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_location_address_propagation_test.rb +6 -2
  75. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_prefetch_complete_and_subset_test.rb +3 -12
  76. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/appointment_book_receive_request_test.rb +8 -89
  77. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/base_hook_invocation_receive_request_test.rb +163 -0
  78. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/cross_hooks_receive_request_test.rb +97 -0
  79. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_discharge_receive_request_test.rb +8 -90
  80. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_start_receive_request_test.rb +8 -90
  81. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_dispatch_receive_request_test.rb +8 -98
  82. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_select_receive_request_test.rb +8 -98
  83. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_sign_receive_request_test.rb +8 -98
  84. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_long_running_receive_request_test.rb +10 -2
  85. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +1 -1
  86. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_no_request_test.rb +30 -0
  87. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_workflow_test.rb +55 -0
  88. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_attestation_test.rb +99 -0
  89. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_receive_request_test.rb +62 -0
  90. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_conformance_test.rb +1 -1
  91. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb +10 -2
  92. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_data_fetch_verification_test.rb +1 -1
  93. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_granted_scopes_test.rb +1 -1
  94. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +1 -1
  95. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_profiles_test.rb +1 -1
  96. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_requested_version_test.rb +1 -1
  97. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_secured_transport_test.rb +1 -1
  98. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +52 -20
  99. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/hook_response_support_coverage_information_test.rb +1 -1
  100. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/inferno_response_validation.rb +6 -3
  101. data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +9 -0
  102. data/lib/davinci_crd_test_kit/cross_suite/logical_models_override_helper.rb +30 -13
  103. data/lib/davinci_crd_test_kit/cross_suite/prefetch_profile_validation.rb +2 -0
  104. data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +26 -27
  105. data/lib/davinci_crd_test_kit/cross_suite/response_logical_model_validation.rb +48 -41
  106. data/lib/davinci_crd_test_kit/cross_suite/tags.rb +3 -0
  107. data/lib/davinci_crd_test_kit/requirements/cds-hooks_3.0.0-ballot_requirements.xlsx +0 -0
  108. data/lib/davinci_crd_test_kit/requirements/davinci_crd_test_kit_requirements.csv +6 -2
  109. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +107 -107
  110. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_v221_requirements_coverage.csv +101 -97
  111. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_requirements_coverage.csv +18 -18
  112. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_v221_requirements_coverage.csv +36 -32
  113. data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.2.1_requirements.xlsx +0 -0
  114. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_server_suite.rb +1 -1
  115. data/lib/davinci_crd_test_kit/server/v2.0.1/server_hooks_group.rb +5 -5
  116. data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_standard_prefetch_expressions_test.rb +1 -2
  117. data/lib/davinci_crd_test_kit/server/v2.2.1/server_demonstrate_hook_response_group.rb +2 -2
  118. data/lib/davinci_crd_test_kit/server/v2.2.1/server_hooks_group.rb +5 -5
  119. data/lib/davinci_crd_test_kit/version.rb +2 -2
  120. metadata +40 -12
  121. data/config/presets/inferno_crd_server_suite_v221.json.erb +0 -94
@@ -49,34 +49,47 @@ module DaVinciCRDTestKit
49
49
 
50
50
  begin
51
51
  jwk = JSON.parse(auth_token_jwk).deep_symbolize_keys
52
-
53
- payload, =
54
- JWT.decode(
55
- auth_tokens_list[index],
56
- JWT::JWK.import(jwk).public_key,
57
- true,
58
- algorithms: [jwk[:alg]],
59
- exp_leeway: 60,
60
- iss: cds_jwt_iss,
61
- aud: hook_url,
62
- verify_not_before: false,
63
- verify_iat: false,
64
- verify_jti: true,
65
- verify_iss: true,
66
- verify_aud: true
67
- )
52
+ unverified_payload, jwt_header = JWT.decode(auth_tokens_list[index], nil, false)
68
53
  rescue StandardError => e
69
54
  add_message('error', "#{request_number}Token validation error: #{e.message}")
70
55
  next
71
56
  end
72
57
 
73
- missing_claims = required_claims - payload.keys
74
- missing_claims_string = missing_claims.map { |claim| "`#{claim}`" }.join(', ')
58
+ alg = jwk[:alg] || jwt_header['alg']
75
59
 
76
- unless missing_claims.empty?
77
- add_message('error', "#{request_number}JWT payload missing required claims: #{missing_claims_string}")
78
- next
60
+ # Continue checking the rest of the token even when one check fails, so the tester sees every
61
+ # issue at once rather than fixing them one error at a time.
62
+ # CDS Hooks prohibits the `none` algorithm and symmetric (HMAC) algorithms for the authentication JWT.
63
+ if alg.to_s.match?(/\A(none|hs\d+)\z/i)
64
+ add_message('error',
65
+ "#{request_number}Token signature algorithm #{alg.inspect} is not permitted; CDS Hooks " \
66
+ 'prohibits the `none` algorithm and symmetric (HMAC) algorithms.')
79
67
  end
68
+
69
+ begin
70
+ JWT.decode(
71
+ auth_tokens_list[index],
72
+ JWT::JWK.import(jwk).public_key,
73
+ true,
74
+ algorithms: [alg],
75
+ exp_leeway: 60,
76
+ iss: cds_jwt_iss,
77
+ aud: hook_url,
78
+ verify_not_before: false,
79
+ verify_iat: false,
80
+ verify_jti: true,
81
+ verify_iss: true,
82
+ verify_aud: true
83
+ )
84
+ rescue StandardError => e
85
+ add_message('error', "#{request_number}Token validation error: #{e.message}")
86
+ end
87
+
88
+ missing_claims = required_claims - unverified_payload.keys
89
+ next if missing_claims.empty?
90
+
91
+ missing_claims_string = missing_claims.map { |claim| "`#{claim}`" }.join(', ')
92
+ add_message('error', "#{request_number}JWT payload missing required claims: #{missing_claims_string}")
80
93
  end
81
94
  no_error_validation('Token payload is missing required claims or does not have a valid signature.')
82
95
  end
@@ -25,48 +25,48 @@
25
25
  }
26
26
  },
27
27
  {
28
- "hook": "encounter-discharge",
29
- "title": "Encounter Disharge CDS Service Example",
30
- "description": "An example of a CDS Service that is invoked when the user is performing the discharge process for an encounter - typically an inpatient encounter.",
31
- "id": "encounter-discharge-service",
28
+ "hook": "order-select",
29
+ "title": "Order Select CDS Service",
30
+ "description": "An example of a CDS Service that fires when a clinician selects one or more orders to place for a patient",
31
+ "id": "order-select-service",
32
32
  "prefetch": {
33
33
  "user": "{{context.userId}}",
34
34
  "patient": "Patient/{{context.patientId}}",
35
- "encounter": "Encounter/{{context.encounterId}}",
36
35
  "coverage": "Coverage?patient={{context.patientId}}&status=active"
37
36
  }
38
37
  },
39
38
  {
40
- "hook": "order-dispatch",
41
- "title": "Order Dispatch CDS Service Example",
42
- "description": "An example of a CDS Service that fires when a practitioner is selecting a candidate performer for a pre-existing order that was not tied to a specific performer",
43
- "id": "order-dispatch-service",
39
+ "hook": "order-sign",
40
+ "title": "Order Sign CDS Service",
41
+ "description": "An example of a CDS Service that fires when a clinician is ready to sign one or more orders for a patient",
42
+ "id": "order-sign-service",
44
43
  "prefetch": {
44
+ "user": "{{context.userId}}",
45
45
  "patient": "Patient/{{context.patientId}}",
46
- "performer": "{{context.performer}}",
47
- "order": "{{context.order}}",
48
46
  "coverage": "Coverage?patient={{context.patientId}}&status=active"
49
47
  }
50
48
  },
51
49
  {
52
- "hook": "order-select",
53
- "title": "Order Select CDS Service",
54
- "description": "An example of a CDS Service that fires when a clinician selects one or more orders to place for a patient",
55
- "id": "order-select-service",
50
+ "hook": "order-dispatch",
51
+ "title": "Order Dispatch CDS Service Example",
52
+ "description": "An example of a CDS Service that fires when a practitioner is selecting a candidate performer for a pre-existing order that was not tied to a specific performer",
53
+ "id": "order-dispatch-service",
56
54
  "prefetch": {
57
- "user": "{{context.userId}}",
58
55
  "patient": "Patient/{{context.patientId}}",
56
+ "performer": "{{context.performer}}",
57
+ "order": "{{context.order}}",
59
58
  "coverage": "Coverage?patient={{context.patientId}}&status=active"
60
59
  }
61
60
  },
62
61
  {
63
- "hook": "order-sign",
64
- "title": "Order Sign CDS Service",
65
- "description": "An example of a CDS Service that fires when a clinician is ready to sign one or more orders for a patient",
66
- "id": "order-sign-service",
62
+ "hook": "encounter-discharge",
63
+ "title": "Encounter Disharge CDS Service Example",
64
+ "description": "An example of a CDS Service that is invoked when the user is performing the discharge process for an encounter - typically an inpatient encounter.",
65
+ "id": "encounter-discharge-service",
67
66
  "prefetch": {
68
67
  "user": "{{context.userId}}",
69
68
  "patient": "Patient/{{context.patientId}}",
69
+ "encounter": "Encounter/{{context.encounterId}}",
70
70
  "coverage": "Coverage?patient={{context.patientId}}&status=active"
71
71
  }
72
72
  }
@@ -59,7 +59,9 @@ module DaVinciCRDTestKit
59
59
  },
60
60
  options: {
61
61
  hook_name: 'appointment-book',
62
- hook_path: APPOINTMENT_BOOK_PATH
62
+ hook_path: APPOINTMENT_BOOK_PATH,
63
+ crd_interaction_group: 'hooks-appointment-book',
64
+ include_in_cross_hook_analysis: true
63
65
  }
64
66
  )
65
67
 
@@ -69,11 +71,10 @@ module DaVinciCRDTestKit
69
71
  end
70
72
 
71
73
  group do
72
- title 'Verify Authorization'
73
- test from: :crd_v201_decode_auth_token
74
- test from: :crd_v201_retrieve_jwks
75
- test from: :crd_v201_token_header
76
- test from: :crd_v201_token_payload
74
+ title 'Verify Response Handling'
75
+
76
+ test from: :crd_v201_inferno_response_validation
77
+ test from: :crd_v201_card_display_attest_test
77
78
  end
78
79
 
79
80
  group do
@@ -98,10 +99,11 @@ module DaVinciCRDTestKit
98
99
  end
99
100
 
100
101
  group do
101
- title 'Verify Response Handling'
102
-
103
- test from: :crd_v201_inferno_response_validation
104
- test from: :crd_v201_card_display_attest_test
102
+ title 'Verify Authorization'
103
+ test from: :crd_v201_decode_auth_token
104
+ test from: :crd_v201_retrieve_jwks
105
+ test from: :crd_v201_token_header
106
+ test from: :crd_v201_token_payload
105
107
  end
106
108
  end
107
109
  end
@@ -59,7 +59,9 @@ module DaVinciCRDTestKit
59
59
  },
60
60
  options: {
61
61
  hook_name: 'encounter-discharge',
62
- hook_path: ENCOUNTER_DISCHARGE_PATH
62
+ hook_path: ENCOUNTER_DISCHARGE_PATH,
63
+ crd_interaction_group: 'hooks-encounter-discharge',
64
+ include_in_cross_hook_analysis: true
63
65
  }
64
66
  )
65
67
 
@@ -69,11 +71,10 @@ module DaVinciCRDTestKit
69
71
  end
70
72
 
71
73
  group do
72
- title 'Verify Authorization'
73
- test from: :crd_v201_decode_auth_token
74
- test from: :crd_v201_retrieve_jwks
75
- test from: :crd_v201_token_header
76
- test from: :crd_v201_token_payload
74
+ title 'Verify Response Handling'
75
+
76
+ test from: :crd_v201_inferno_response_validation
77
+ test from: :crd_v201_card_display_attest_test
77
78
  end
78
79
 
79
80
  group do
@@ -95,10 +96,11 @@ module DaVinciCRDTestKit
95
96
  end
96
97
 
97
98
  group do
98
- title 'Verify Response Handling'
99
-
100
- test from: :crd_v201_inferno_response_validation
101
- test from: :crd_v201_card_display_attest_test
99
+ title 'Verify Authorization'
100
+ test from: :crd_v201_decode_auth_token
101
+ test from: :crd_v201_retrieve_jwks
102
+ test from: :crd_v201_token_header
103
+ test from: :crd_v201_token_payload
102
104
  end
103
105
  end
104
106
  end
@@ -59,7 +59,9 @@ module DaVinciCRDTestKit
59
59
  },
60
60
  options: {
61
61
  hook_name: 'encounter-start',
62
- hook_path: ENCOUNTER_START_PATH
62
+ hook_path: ENCOUNTER_START_PATH,
63
+ crd_interaction_group: 'hooks-encounter-start',
64
+ include_in_cross_hook_analysis: true
63
65
  }
64
66
  )
65
67
 
@@ -69,11 +71,10 @@ module DaVinciCRDTestKit
69
71
  end
70
72
 
71
73
  group do
72
- title 'Verify Authorization'
73
- test from: :crd_v201_decode_auth_token
74
- test from: :crd_v201_retrieve_jwks
75
- test from: :crd_v201_token_header
76
- test from: :crd_v201_token_payload
74
+ title 'Verify Response Handling'
75
+
76
+ test from: :crd_v201_inferno_response_validation
77
+ test from: :crd_v201_card_display_attest_test
77
78
  end
78
79
 
79
80
  group do
@@ -95,10 +96,11 @@ module DaVinciCRDTestKit
95
96
  end
96
97
 
97
98
  group do
98
- title 'Verify Response Handling'
99
-
100
- test from: :crd_v201_inferno_response_validation
101
- test from: :crd_v201_card_display_attest_test
99
+ title 'Verify Authorization'
100
+ test from: :crd_v201_decode_auth_token
101
+ test from: :crd_v201_retrieve_jwks
102
+ test from: :crd_v201_token_header
103
+ test from: :crd_v201_token_payload
102
104
  end
103
105
  end
104
106
  end
@@ -14,10 +14,10 @@ module DaVinciCRDTestKit
14
14
  [six hooks contained in the implementation guide](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html):
15
15
  * [appointment-book](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#appointment-book)
16
16
  * [encounter-start](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-start)
17
- * [encounter-discharge](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-discharge)
18
17
  * [order-select](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-select)
19
- * [order-dispatch](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-dispatch)
20
18
  * [order-sign](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-sign)
19
+ * [order-dispatch](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-dispatch)
20
+ * [encounter-discharge](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-discharge)
21
21
 
22
22
  Each hook group contains a test which waits for incoming hook requests from the CRD client, and tests which
23
23
  verify the incoming hook requests conform to the specific hook requirements specified the
@@ -58,16 +58,16 @@ module DaVinciCRDTestKit
58
58
  group from: :crd_v201_client_encounter_start,
59
59
  optional: true
60
60
 
61
- group from: :crd_v201_client_encounter_discharge,
61
+ group from: :crd_v201_client_order_select,
62
62
  optional: true
63
63
 
64
- group from: :crd_v201_client_order_select,
64
+ group from: :crd_v201_client_order_sign,
65
65
  optional: true
66
66
 
67
67
  group from: :crd_v201_client_order_dispatch,
68
68
  optional: true
69
69
 
70
- group from: :crd_v201_client_order_sign,
70
+ group from: :crd_v201_client_encounter_discharge,
71
71
  optional: true
72
72
  end
73
73
  end
@@ -58,7 +58,9 @@ module DaVinciCRDTestKit
58
58
  },
59
59
  options: {
60
60
  hook_name: 'order-dispatch',
61
- hook_path: ORDER_DISPATCH_PATH
61
+ hook_path: ORDER_DISPATCH_PATH,
62
+ crd_interaction_group: 'hooks-order-dispatch',
63
+ include_in_cross_hook_analysis: true
62
64
  }
63
65
  )
64
66
 
@@ -68,11 +70,10 @@ module DaVinciCRDTestKit
68
70
  end
69
71
 
70
72
  group do
71
- title 'Verify Authorization'
72
- test from: :crd_v201_decode_auth_token
73
- test from: :crd_v201_retrieve_jwks
74
- test from: :crd_v201_token_header
75
- test from: :crd_v201_token_payload
73
+ title 'Verify Response Handling'
74
+
75
+ test from: :crd_v201_inferno_response_validation
76
+ test from: :crd_v201_card_display_attest_test
76
77
  end
77
78
 
78
79
  group do
@@ -101,10 +102,11 @@ module DaVinciCRDTestKit
101
102
  end
102
103
 
103
104
  group do
104
- title 'Verify Response Handling'
105
-
106
- test from: :crd_v201_inferno_response_validation
107
- test from: :crd_v201_card_display_attest_test
105
+ title 'Verify Authorization'
106
+ test from: :crd_v201_decode_auth_token
107
+ test from: :crd_v201_retrieve_jwks
108
+ test from: :crd_v201_token_header
109
+ test from: :crd_v201_token_payload
108
110
  end
109
111
  end
110
112
  end
@@ -60,7 +60,9 @@ module DaVinciCRDTestKit
60
60
  },
61
61
  options: {
62
62
  hook_name: 'order-select',
63
- hook_path: ORDER_SELECT_PATH
63
+ hook_path: ORDER_SELECT_PATH,
64
+ crd_interaction_group: 'hooks-order-select',
65
+ include_in_cross_hook_analysis: true
64
66
  }
65
67
  )
66
68
 
@@ -70,11 +72,10 @@ module DaVinciCRDTestKit
70
72
  end
71
73
 
72
74
  group do
73
- title 'Verify Authorization'
74
- test from: :crd_v201_decode_auth_token
75
- test from: :crd_v201_retrieve_jwks
76
- test from: :crd_v201_token_header
77
- test from: :crd_v201_token_payload
75
+ title 'Verify Response Handling'
76
+
77
+ test from: :crd_v201_inferno_response_validation
78
+ test from: :crd_v201_card_display_attest_test
78
79
  end
79
80
 
80
81
  group do
@@ -106,10 +107,11 @@ module DaVinciCRDTestKit
106
107
  end
107
108
 
108
109
  group do
109
- title 'Verify Response Handling'
110
-
111
- test from: :crd_v201_inferno_response_validation
112
- test from: :crd_v201_card_display_attest_test
110
+ title 'Verify Authorization'
111
+ test from: :crd_v201_decode_auth_token
112
+ test from: :crd_v201_retrieve_jwks
113
+ test from: :crd_v201_token_header
114
+ test from: :crd_v201_token_payload
113
115
  end
114
116
  end
115
117
  end
@@ -59,7 +59,9 @@ module DaVinciCRDTestKit
59
59
  },
60
60
  options: {
61
61
  hook_name: 'order-sign',
62
- hook_path: ORDER_SIGN_PATH
62
+ hook_path: ORDER_SIGN_PATH,
63
+ crd_interaction_group: 'hooks-order-sign',
64
+ include_in_cross_hook_analysis: true
63
65
  }
64
66
  )
65
67
 
@@ -69,11 +71,10 @@ module DaVinciCRDTestKit
69
71
  end
70
72
 
71
73
  group do
72
- title 'Verify Authorization'
73
- test from: :crd_v201_decode_auth_token
74
- test from: :crd_v201_retrieve_jwks
75
- test from: :crd_v201_token_header
76
- test from: :crd_v201_token_payload
74
+ title 'Verify Response Handling'
75
+
76
+ test from: :crd_v201_inferno_response_validation
77
+ test from: :crd_v201_card_display_attest_test
77
78
  end
78
79
 
79
80
  group do
@@ -103,10 +104,11 @@ module DaVinciCRDTestKit
103
104
  end
104
105
 
105
106
  group do
106
- title 'Verify Response Handling'
107
-
108
- test from: :crd_v201_inferno_response_validation
109
- test from: :crd_v201_card_display_attest_test
107
+ title 'Verify Authorization'
108
+ test from: :crd_v201_decode_auth_token
109
+ test from: :crd_v201_retrieve_jwks
110
+ test from: :crd_v201_token_header
111
+ test from: :crd_v201_token_payload
110
112
  end
111
113
  end
112
114
  end
@@ -1,9 +1,11 @@
1
1
  require_relative '../../../cross_suite/cards_identification'
2
+ require_relative '../../tagged_request_load_helper'
2
3
 
3
4
  module DaVinciCRDTestKit
4
5
  module V201
5
6
  class ClientCardMustSupportCoverageInformationTest < Inferno::Test
6
7
  include CardsIdentification
8
+ include TaggedRequestLoadHelper
7
9
 
8
10
  title 'Coverage Information Action Support'
9
11
  id :crd_v201_client_card_must_support_coverage_information
@@ -19,47 +21,12 @@ module DaVinciCRDTestKit
19
21
  and support for them is demonstrated.
20
22
  DESCRIPTION
21
23
 
22
- ALL_HOOKS = [
23
- APPOINTMENT_BOOK_TAG,
24
- ENCOUNTER_START_TAG,
25
- ENCOUNTER_DISCHARGE_TAG,
26
- ORDER_DISPATCH_TAG,
27
- ORDER_SELECT_TAG,
28
- ORDER_SIGN_TAG
29
- ].freeze
30
-
31
24
  def metadata
32
25
  @metadata ||= YAML.load_file(
33
26
  File.join(__dir__, '..', '..', '..', 'cross_suite', 'coverage-information_stu201_metadata.yml')
34
27
  )
35
28
  end
36
29
 
37
- def configured_hook_name
38
- config.options[:hook_name]
39
- end
40
-
41
- def crd_test_group
42
- config.options[:crd_test_group]
43
- end
44
-
45
- def tags_to_load(hook_name)
46
- crd_test_group.present? ? [hook_name, crd_test_group] : [hook_name]
47
- end
48
-
49
- def requests_to_analyze
50
- if configured_hook_name.present?
51
- load_requests_for_tags(tags_to_load(configured_hook_name))
52
- else
53
- ALL_HOOKS.each_with_object([]) do |hook_name, request_list|
54
- request_list.concat(load_requests_for_tags(tags_to_load(hook_name)))
55
- end
56
- end
57
- end
58
-
59
- def load_requests_for_tags(tags_to_load)
60
- load_tagged_requests(*tags_to_load)
61
- end
62
-
63
30
  class MustSupportMetadataHolder
64
31
  attr_accessor :metadata
65
32
 
@@ -77,7 +44,7 @@ module DaVinciCRDTestKit
77
44
  end
78
45
 
79
46
  run do
80
- loaded_requests = requests_to_analyze
47
+ loaded_requests = load_requests_for_cross_hook_analysis
81
48
 
82
49
  sorted_cards = sorted_cards_from_requests(loaded_requests)
83
50
 
@@ -1,9 +1,11 @@
1
1
  require_relative '../../../cross_suite/cards_identification'
2
+ require_relative '../../tagged_request_load_helper'
2
3
 
3
4
  module DaVinciCRDTestKit
4
5
  module V201
5
6
  class ClientCardMustSupportExternalReferenceTest < Inferno::Test
6
7
  include CardsIdentification
8
+ include TaggedRequestLoadHelper
7
9
 
8
10
  title 'External Reference Card Support'
9
11
  id :crd_v201_client_card_must_support_external_reference
@@ -15,43 +17,8 @@ module DaVinciCRDTestKit
15
17
  and/or the hook requests made by the client during the Hooks tests such that an External Reference card is returned and support for it is demonstrated.
16
18
  DESCRIPTION
17
19
 
18
- ALL_HOOKS = [
19
- APPOINTMENT_BOOK_TAG,
20
- ENCOUNTER_START_TAG,
21
- ENCOUNTER_DISCHARGE_TAG,
22
- ORDER_DISPATCH_TAG,
23
- ORDER_SELECT_TAG,
24
- ORDER_SIGN_TAG
25
- ].freeze
26
-
27
- def configured_hook_name
28
- config.options[:hook_name]
29
- end
30
-
31
- def crd_test_group
32
- config.options[:crd_test_group]
33
- end
34
-
35
- def tags_to_load(hook_name)
36
- crd_test_group.present? ? [hook_name, crd_test_group] : [hook_name]
37
- end
38
-
39
- def requests_to_analyze
40
- if configured_hook_name.present?
41
- load_requests_for_tags(tags_to_load(configured_hook_name))
42
- else
43
- ALL_HOOKS.each_with_object([]) do |hook_name, request_list|
44
- request_list.concat(load_requests_for_tags(tags_to_load(hook_name)))
45
- end
46
- end
47
- end
48
-
49
- def load_requests_for_tags(tags_to_load)
50
- load_tagged_requests(*tags_to_load)
51
- end
52
-
53
20
  run do
54
- loaded_requests = requests_to_analyze
21
+ loaded_requests = load_requests_for_cross_hook_analysis
55
22
  sorted_cards = sorted_cards_from_requests(loaded_requests)
56
23
 
57
24
  assert sorted_cards['cards'][EXTERNAL_REFERENCE_RESPONSE_TYPE].present?,
@@ -1,9 +1,11 @@
1
1
  require_relative '../../../cross_suite/cards_identification'
2
+ require_relative '../../tagged_request_load_helper'
2
3
 
3
4
  module DaVinciCRDTestKit
4
5
  module V201
5
6
  class ClientCardMustSupportInstructionsTest < Inferno::Test
6
7
  include CardsIdentification
8
+ include TaggedRequestLoadHelper
7
9
 
8
10
  title 'Instructions Card Support'
9
11
  id :crd_v201_client_card_must_support_instructions
@@ -15,43 +17,8 @@ module DaVinciCRDTestKit
15
17
  and/or the hook requests made by the client during the Hooks tests such that an Instructions card is returned and support for it is demonstrated.
16
18
  DESCRIPTION
17
19
 
18
- ALL_HOOKS = [
19
- APPOINTMENT_BOOK_TAG,
20
- ENCOUNTER_START_TAG,
21
- ENCOUNTER_DISCHARGE_TAG,
22
- ORDER_DISPATCH_TAG,
23
- ORDER_SELECT_TAG,
24
- ORDER_SIGN_TAG
25
- ].freeze
26
-
27
- def configured_hook_name
28
- config.options[:hook_name]
29
- end
30
-
31
- def crd_test_group
32
- config.options[:crd_test_group]
33
- end
34
-
35
- def tags_to_load(hook_name)
36
- crd_test_group.present? ? [hook_name, crd_test_group] : [hook_name]
37
- end
38
-
39
- def requests_to_analyze
40
- if configured_hook_name.present?
41
- load_requests_for_tags(tags_to_load(configured_hook_name))
42
- else
43
- ALL_HOOKS.each_with_object([]) do |hook_name, request_list|
44
- request_list.concat(load_requests_for_tags(tags_to_load(hook_name)))
45
- end
46
- end
47
- end
48
-
49
- def load_requests_for_tags(tags_to_load)
50
- load_tagged_requests(*tags_to_load)
51
- end
52
-
53
20
  run do
54
- loaded_requests = requests_to_analyze
21
+ loaded_requests = load_requests_for_cross_hook_analysis
55
22
  sorted_cards = sorted_cards_from_requests(loaded_requests)
56
23
 
57
24
  assert sorted_cards['cards'][INSTRUCTIONS_RESPONSE_TYPE].present?,
@@ -1,8 +1,11 @@
1
1
  require_relative '../../../cross_suite/tags'
2
+ require_relative '../../tagged_request_load_helper'
2
3
 
3
4
  module DaVinciCRDTestKit
4
5
  module V201
5
6
  class HookRequestFetchedDataTest < Inferno::Test
7
+ include TaggedRequestLoadHelper
8
+
6
9
  id :crd_v201_hook_request_fetched_data
7
10
  title 'Minimum resource dataset was accessible during the hook invocation'
8
11
  description %(
@@ -33,24 +36,12 @@ module DaVinciCRDTestKit
33
36
  )
34
37
  verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@43', 'hl7.fhir.us.davinci-crd_2.0.1@323'
35
38
 
36
- def hook_name
37
- config.options[:hook_name]
38
- end
39
-
40
- def crd_test_group
41
- config.options[:crd_test_group]
42
- end
43
-
44
- def tags_to_load
45
- crd_test_group.present? ? [hook_name, crd_test_group] : [hook_name]
46
- end
47
-
48
39
  def no_error_validation(message)
49
40
  assert messages.none? { |msg| msg[:type] == 'error' }, message
50
41
  end
51
42
 
52
43
  run do
53
- hook_requests = load_tagged_requests(*tags_to_load)
44
+ hook_requests = load_interaction_group_requests
54
45
 
55
46
  hook_requests.each do |hook_request|
56
47
  request_body = JSON.parse(hook_request.request_body)