davinci_crd_test_kit 0.14.2 → 0.15.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 (234) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/client_v221_against_inferno_crd_server_suite.json.erb +13 -1
  3. data/config/presets/server_v221_against_inferno_crd_client_suite.json.erb +1 -1
  4. data/config/presets/server_v221_against_inferno_crd_client_suite_prefetch_subset.json.erb +1 -1
  5. data/lib/davinci_crd_test_kit/client/client_base_urls.rb +5 -0
  6. data/lib/davinci_crd_test_kit/client/client_input_helper.rb +102 -0
  7. data/lib/davinci_crd_test_kit/client/client_wait_messages.rb +68 -0
  8. data/lib/davinci_crd_test_kit/client/endpoints/custom_service_response.rb +25 -10
  9. data/lib/davinci_crd_test_kit/client/endpoints/hook_request_data_access.rb +228 -0
  10. data/lib/davinci_crd_test_kit/client/endpoints/hook_request_endpoint.rb +116 -25
  11. data/lib/davinci_crd_test_kit/client/endpoints/mock_service_response.rb +5 -24
  12. data/lib/davinci_crd_test_kit/client/endpoints/scenario_service_response.rb +1 -1
  13. data/lib/davinci_crd_test_kit/client/endpoints/v201_hook_request_data_gathering.rb +219 -0
  14. data/lib/davinci_crd_test_kit/client/endpoints/v221_hook_request_data_gathering.rb +172 -0
  15. data/lib/davinci_crd_test_kit/client/jwt_claim_types.rb +28 -0
  16. data/lib/davinci_crd_test_kit/client/multi_request_message_helper.rb +1 -1
  17. data/lib/davinci_crd_test_kit/client/prefetched_coverage_payer_helper.rb +81 -0
  18. data/lib/davinci_crd_test_kit/client/prefetched_coverage_value.rb +14 -0
  19. data/lib/davinci_crd_test_kit/client/tagged_request_load_helper.rb +8 -0
  20. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/retrieve_jwks_test.rb +1 -1
  21. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_header_test.rb +14 -4
  22. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_payload_test.rb +8 -1
  23. data/lib/davinci_crd_test_kit/client/v2.0.1/cds-services-v201.json +1 -1
  24. data/lib/davinci_crd_test_kit/client/v2.0.1/client_fhir_api_group.rb +2 -2
  25. data/lib/davinci_crd_test_kit/client/v2.0.1/client_hooks_group.rb +2 -5
  26. data/lib/davinci_crd_test_kit/client/v2.0.1/crd_client_suite.rb +2 -2
  27. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/appointment_book_receive_request_test.rb +10 -31
  28. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/encounter_discharge_receive_request_test.rb +10 -31
  29. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/encounter_start_receive_request_test.rb +8 -29
  30. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_dispatch_receive_request_test.rb +10 -31
  31. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_select_receive_request_test.rb +8 -29
  32. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_sign_receive_request_test.rb +10 -31
  33. data/lib/davinci_crd_test_kit/client/v2.0.1/registration/client_registration_verification_test.rb +3 -7
  34. data/lib/davinci_crd_test_kit/client/v2.0.1/registration/client_service_registration_attestation_test.rb +11 -3
  35. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_optional_fields_test.rb +1 -1
  36. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/client_display_cards_attest.rb +4 -4
  37. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/inferno_response_validation.rb +1 -1
  38. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_coverage_info_update_test.rb +9 -9
  39. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_crd_update_verification_group.rb +1 -1
  40. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_coverage_based_invocation_attestation_test.rb +10 -10
  41. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_data_element_expectations_attestation_test.rb +7 -7
  42. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_hook_invocation_logging_attestation_test.rb +4 -4
  43. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_use_attestation_test.rb +4 -4
  44. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_prefetch_key_omission_attestation_test.rb +6 -5
  45. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_resource_identifiers_attestation_test.rb +4 -4
  46. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_response_case_distinction_attestation_test.rb +4 -4
  47. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_security_and_privacy_attestation_test.rb +4 -4
  48. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_workflow_integration_attestation_test.rb +4 -4
  49. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/decode_auth_token_test.rb +3 -1
  50. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/retrieve_jwks_test.rb +23 -13
  51. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_header_test.rb +32 -6
  52. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_payload_test.rb +25 -11
  53. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-prefetch-subset-v221.json +1 -1
  54. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-v221.json +1 -1
  55. data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +10 -3
  56. data/lib/davinci_crd_test_kit/client/v2.2.1/client_attestations_group.rb +1 -7
  57. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_group.rb +13 -10
  58. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_interaction_group.rb +12 -4
  59. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +9 -2
  60. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +9 -2
  61. data/lib/davinci_crd_test_kit/client/v2.2.1/client_fhir_api_group.rb +25 -3
  62. data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +7 -10
  63. data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +3 -3
  64. data/lib/davinci_crd_test_kit/client/v2.2.1/client_multiple_payers_hook_group.rb +40 -0
  65. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_dispatch_group.rb +9 -2
  66. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +8 -1
  67. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +9 -2
  68. data/lib/davinci_crd_test_kit/client/v2.2.1/client_registration_group.rb +7 -7
  69. data/lib/davinci_crd_test_kit/client/v2.2.1/client_scenarios_group.rb +10 -4
  70. data/lib/davinci_crd_test_kit/client/v2.2.1/client_self_pay_hook_group.rb +2 -4
  71. data/lib/davinci_crd_test_kit/client/v2.2.1/client_unknown_content_hook_group.rb +3 -3
  72. data/lib/davinci_crd_test_kit/client/v2.2.1/client_user_access_level_group.rb +82 -0
  73. data/lib/davinci_crd_test_kit/client/v2.2.1/crd_client_suite.rb +7 -3
  74. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_card_must_support_coverage_information_test.rb +4 -4
  75. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_fhirpath_collection_as_comma_delimited_string_test.rb +3 -3
  76. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_hook_instances_unique_test.rb +2 -2
  77. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_jwt_ids_unique_test.rb +89 -0
  78. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_location_address_propagation_test.rb +59 -29
  79. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_order_types_signed_test.rb +101 -0
  80. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_prefetch_complete_and_subset_test.rb +11 -24
  81. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/appointment_book_receive_request_test.rb +9 -27
  82. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/base_hook_invocation_receive_request_test.rb +59 -40
  83. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/cross_hooks_receive_request_test.rb +64 -35
  84. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_discharge_receive_request_test.rb +9 -27
  85. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_start_receive_request_test.rb +9 -27
  86. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_dispatch_receive_request_test.rb +9 -27
  87. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_select_receive_request_test.rb +9 -27
  88. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_sign_receive_request_test.rb +9 -27
  89. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_long_running_receive_request_test.rb +50 -38
  90. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +11 -11
  91. data/lib/davinci_crd_test_kit/client/v2.2.1/multiple_payers/client_multiple_payers_request_verification_test.rb +215 -0
  92. data/lib/davinci_crd_test_kit/client/v2.2.1/multiple_payers/client_multiple_payers_workflow_test.rb +71 -0
  93. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/appointment_must_support_test.rb +84 -0
  94. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/appointment_reference_resolution_test.rb +82 -0
  95. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/client_cross_hook_must_support_group.rb +181 -0
  96. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/communication_request_must_support_test.rb +69 -0
  97. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/communication_request_reference_resolution_test.rb +79 -0
  98. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/coverage_must_support_test.rb +73 -0
  99. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/coverage_reference_resolution_test.rb +67 -0
  100. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_must_support_test.rb +59 -0
  101. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_request_must_support_test.rb +72 -0
  102. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_request_reference_resolution_test.rb +76 -0
  103. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/encounter_must_support_test.rb +83 -0
  104. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/encounter_reference_resolution_test.rb +76 -0
  105. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/location_must_support_test.rb +63 -0
  106. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/location_reference_resolution_test.rb +60 -0
  107. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_must_support_test.rb +54 -0
  108. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_request_must_support_test.rb +95 -0
  109. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_request_reference_resolution_test.rb +79 -0
  110. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/nutrition_order_must_support_test.rb +136 -0
  111. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/nutrition_order_reference_resolution_test.rb +67 -0
  112. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/organization_must_support_test.rb +66 -0
  113. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/organization_reference_resolution_test.rb +60 -0
  114. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/patient_must_support_test.rb +69 -0
  115. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_must_support_test.rb +65 -0
  116. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_role_must_support_test.rb +60 -0
  117. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_role_reference_resolution_test.rb +66 -0
  118. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/service_request_must_support_test.rb +93 -0
  119. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/service_request_reference_resolution_test.rb +81 -0
  120. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/vision_prescription_must_support_test.rb +79 -0
  121. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/vision_prescription_reference_resolution_test.rb +65 -0
  122. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_reference_resolution.rb +379 -0
  123. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_scope.rb +66 -0
  124. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_with_attestation_option.rb +331 -0
  125. data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_registration_verification_test.rb +16 -30
  126. data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_service_registration_attestation_test.rb +84 -39
  127. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_workflow_test.rb +27 -20
  128. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_attestation_test.rb +7 -7
  129. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_receive_request_test.rb +38 -33
  130. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_api_access_test.rb +124 -0
  131. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_prefetch_scope_test.rb +85 -0
  132. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_receive_request_test.rb +92 -0
  133. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_same_scenario_test.rb +340 -0
  134. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_target_reference.rb +16 -0
  135. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_conformance_test.rb +63 -6
  136. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb +23 -73
  137. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_data_fetch_verification_test.rb +12 -2
  138. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_granted_scopes_test.rb +7 -7
  139. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +11 -13
  140. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_profiles_test.rb +2 -2
  141. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_requested_version_test.rb +16 -4
  142. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_secured_transport_test.rb +1 -1
  143. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +8 -8
  144. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/hook_response_support_coverage_information_test.rb +3 -3
  145. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/inferno_response_validation.rb +8 -9
  146. data/lib/davinci_crd_test_kit/cross_suite/base_urls.rb +12 -0
  147. data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +9 -2
  148. data/lib/davinci_crd_test_kit/cross_suite/fhirpath_on_cds_request.rb +10 -9
  149. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/appointment_with_order/metadata.yml +67 -0
  150. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/appointment_without_order/metadata.yml +150 -0
  151. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/communication_request/metadata.yml +71 -0
  152. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/coverage/metadata.yml +71 -0
  153. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/device/metadata.yml +22 -0
  154. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/device_request/metadata.yml +85 -0
  155. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/encounter/metadata.yml +82 -0
  156. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/hrex_organization/metadata.yml +6 -0
  157. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/location/metadata.yml +27 -0
  158. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/medication/metadata.yml +17 -0
  159. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/medication_request/metadata.yml +166 -0
  160. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/nutrition_order/metadata.yml +166 -0
  161. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/organization/metadata.yml +42 -0
  162. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/patient/metadata.yml +29 -0
  163. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/practitioner/metadata.yml +37 -0
  164. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/practitioner_role/metadata.yml +36 -0
  165. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/service_request/metadata.yml +202 -0
  166. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_allergyintolerance/metadata.yml +6 -0
  167. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_condition_encounter_diagnosis/metadata.yml +6 -0
  168. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_condition_problems_health_concerns/metadata.yml +6 -0
  169. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_diagnosticreport_lab/metadata.yml +6 -0
  170. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_diagnosticreport_note/metadata.yml +6 -0
  171. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_documentreference/metadata.yml +6 -0
  172. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_location/metadata.yml +6 -0
  173. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_organization/metadata.yml +6 -0
  174. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_patient/metadata.yml +6 -0
  175. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_practitioner/metadata.yml +6 -0
  176. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_procedure/metadata.yml +6 -0
  177. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/vision_prescription/metadata.yml +66 -0
  178. data/lib/davinci_crd_test_kit/cross_suite/hook_request_field_validation.rb +3 -2
  179. data/lib/davinci_crd_test_kit/cross_suite/hook_request_resource_extraction.rb +121 -0
  180. data/lib/davinci_crd_test_kit/cross_suite/logical_models_override_helper.rb +17 -9
  181. data/lib/davinci_crd_test_kit/cross_suite/must_support_references.rb +49 -0
  182. data/lib/davinci_crd_test_kit/cross_suite/must_support_slice_matching.rb +50 -0
  183. data/lib/davinci_crd_test_kit/cross_suite/prefetch_completeness_checker.rb +75 -39
  184. data/lib/davinci_crd_test_kit/cross_suite/profile_metadata.rb +75 -0
  185. data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +19 -9
  186. data/lib/davinci_crd_test_kit/cross_suite/resource_identity.rb +183 -0
  187. data/lib/davinci_crd_test_kit/cross_suite/short_circuit_interaction.rb +28 -0
  188. data/lib/davinci_crd_test_kit/cross_suite/tags.rb +15 -1
  189. data/lib/davinci_crd_test_kit/generator/crd_must_support_metadata_extractor.rb +147 -0
  190. data/lib/davinci_crd_test_kit/generator/must_support_metadata_generator.rb +207 -0
  191. data/lib/davinci_crd_test_kit/generator/must_support_test_generator.rb +249 -0
  192. data/lib/davinci_crd_test_kit/generator/templates/must_support_group.rb.erb +118 -0
  193. data/lib/davinci_crd_test_kit/generator/templates/must_support_test.rb.erb +22 -0
  194. data/lib/davinci_crd_test_kit/generator/templates/reference_resolution_test.rb.erb +22 -0
  195. data/lib/davinci_crd_test_kit/igs/davinci_crd_2.2.1.tgz +0 -0
  196. data/lib/davinci_crd_test_kit/igs/davinci_hrex_1.2.0.tgz +0 -0
  197. data/lib/davinci_crd_test_kit/metadata.rb +2 -2
  198. data/lib/davinci_crd_test_kit/requirements/davinci_crd_test_kit_requirements.csv +3 -2
  199. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +1 -1
  200. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_v221_requirements_coverage.csv +90 -89
  201. data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.2.1_requirements.xlsx +0 -0
  202. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_create_endpoint.rb +2 -0
  203. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_delete_endpoint.rb +2 -0
  204. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_read_endpoint.rb +2 -0
  205. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_request_handler.rb +6 -0
  206. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_search_endpoint.rb +21 -12
  207. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_update_endpoint.rb +2 -0
  208. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr_endpoints.rb +3 -0
  209. data/lib/davinci_crd_test_kit/server/server_abstract_invoke_hook_test.rb +2 -2
  210. data/lib/davinci_crd_test_kit/server/v2.2.1/must_support/supported_us_core_versions_test.rb +2 -2
  211. data/lib/davinci_crd_test_kit/server/v2.2.1/server_appointment_book_group.rb +1 -1
  212. data/lib/davinci_crd_test_kit/server/v2.2.1/server_demonstrate_hook_response_group.rb +1 -1
  213. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_discharge_group.rb +1 -1
  214. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_start_group.rb +1 -1
  215. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_dispatch_group.rb +1 -1
  216. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_select_group.rb +1 -1
  217. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_sign_group.rb +1 -1
  218. data/lib/davinci_crd_test_kit/server/v2.2.1/server_required_card_response_validation_group.rb +1 -1
  219. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/coverage_not_found_group.rb +1 -1
  220. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_active_coverage_group.rb +1 -1
  221. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_member_found_group.rb +1 -1
  222. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/technical_issues_group.rb +1 -1
  223. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_context_validation_test.rb +1 -1
  224. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_no_custom_extensions_test.rb +2 -2
  225. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_optional_fields_validation_test.rb +1 -1
  226. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_required_fields_validation_test.rb +1 -1
  227. data/lib/davinci_crd_test_kit/version.rb +2 -2
  228. metadata +100 -12
  229. data/lib/davinci_crd_test_kit/client/endpoints/gather_response_generation_data.rb +0 -413
  230. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_authorized_scope_attestation_test.rb +0 -45
  231. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_exposure_attestation_test.rb +0 -43
  232. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_order_sign_support_attestation_test.rb +0 -42
  233. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_no_request_test.rb +0 -30
  234. data/lib/davinci_crd_test_kit/server/resource_extractor.rb +0 -68
@@ -6,14 +6,14 @@ module DaVinciCRDTestKit
6
6
  class ClientHookInstancesUniqueTest < Inferno::Test
7
7
  include MultiRequestMessageHelper
8
8
 
9
- title 'Client does not reuse hookInstance values'
9
+ title 'CRD client does not reuse hookInstance values'
10
10
  id :crd_v221_client_hook_instances_unique
11
11
  description <<~DESCRIPTION
12
12
  The CDS Hooks specification requires that the `hookInstance` field of each hook
13
13
  request be globally unique so that it can be used for tracking
14
14
  and auditing.
15
15
 
16
- During this test, Inferno will check that across all hook invocations performed during these
16
+ During this test, Inferno will verify that across all hook invocations performed during these
17
17
  tests, the `hookInstance` field was never reused.
18
18
  DESCRIPTION
19
19
 
@@ -0,0 +1,89 @@
1
+ require_relative '../../tagged_request_load_helper'
2
+ require_relative '../../../cross_suite/tags'
3
+
4
+ module DaVinciCRDTestKit
5
+ module V221
6
+ class ClientJwtIdsUniqueTest < Inferno::Test
7
+ include TaggedRequestLoadHelper
8
+
9
+ title 'CRD client does not reuse JWT `jti` values'
10
+ id :crd_v221_client_jwt_ids_unique
11
+ description <<~DESCRIPTION
12
+ The CDS Hooks specification requires that the `jti` claim of the authentication JWT sent
13
+ with each hook request be a nonce that uniquely identifies that JWT, so that CDS Services can
14
+ use it to protect against replay attacks. A CDS Service does so by rejecting a `jti` it has
15
+ already received, so each hook request must carry a new JWT with its own `jti`.
16
+
17
+ During this test, Inferno will verify that no `jti` value was sent on more than one of the hook
18
+ requests it processed during these tests, including those made during the scenarios.
19
+ DESCRIPTION
20
+
21
+ verifies_requirements 'cds-hooks_3.0.0-ballot@192'
22
+
23
+ def bearer_token(request)
24
+ request.request_header('Authorization')&.value&.delete_prefix('Bearer ')
25
+ end
26
+
27
+ def jwt_id(token)
28
+ payload, = JWT.decode(token, nil, false)
29
+ payload['jti'] if payload.is_a?(Hash)
30
+ rescue JWT::DecodeError
31
+ nil
32
+ end
33
+
34
+ def tagged_requests_exist?(tag)
35
+ Inferno::Repositories::Requests.new.tagged_requests(test_session_id, [tag]).present?
36
+ end
37
+
38
+ # The `jti` values the hook endpoint found on an earlier request when it received a later one. The
39
+ # duplicate requests are not loaded into the result, since each is loaded with the others sharing
40
+ # its `jti`.
41
+ def repeated_jwt_ids
42
+ Inferno::Repositories::Requests.new.tagged_requests(test_session_id, [DUPLICATED_JWT_ID_TAG])
43
+ .filter_map { |request| jwt_id(bearer_token(request)) }
44
+ .uniq
45
+ end
46
+
47
+ # identifies a request by its hook and `hookInstance`, since the requests can come from any group
48
+ def request_label(request)
49
+ body = begin
50
+ JSON.parse(request.request_body.to_s)
51
+ rescue JSON::ParserError
52
+ nil
53
+ end
54
+ body = {} unless body.is_a?(Hash)
55
+ "`#{body['hook'] || 'unknown hook'}` (hookInstance `#{body['hookInstance'] || 'none'}`)"
56
+ end
57
+
58
+ def request_list(hook_requests)
59
+ labels = hook_requests.sort_by(&:index).map { |request| request_label(request) }
60
+ "#{labels.length} hook requests: #{labels.to_sentence}"
61
+ end
62
+
63
+ # Says whether the JWT itself was resent or the `jti` was reused in new JWTs, since the two point
64
+ # to different fixes in the CRD client.
65
+ def report_repeated_jti(jti, requests_by_token)
66
+ sent_on = request_list(requests_by_token.values.flatten)
67
+ repetition =
68
+ if requests_by_token.length == 1
69
+ "The same JWT (`jti` #{jti.to_json}) was sent on #{sent_on}."
70
+ else
71
+ "`jti` #{jti.to_json} was used by #{requests_by_token.length} different JWTs, sent on #{sent_on}."
72
+ end
73
+ add_message('error', "#{repetition} Each hook request must carry a new JWT with its own `jti`.")
74
+ end
75
+
76
+ run do
77
+ skip_if !tagged_requests_exist?(CROSS_HOOK_ANALYSIS_TAG), 'No hook requests received.'
78
+
79
+ repeated_jwt_ids.each do |jti|
80
+ requests_sharing_jti = load_tagged_requests(TagMethods.jwt_id_tag(jti))
81
+ report_repeated_jti(jti, requests_sharing_jti.group_by { |request| bearer_token(request) })
82
+ end
83
+
84
+ assert_no_error_messages('Inferno received the same `jti` value on more than one hook request. ' \
85
+ 'See Messages for details.')
86
+ end
87
+ end
88
+ end
89
+ end
@@ -1,3 +1,4 @@
1
+ require_relative '../../../cross_suite/resource_identity'
1
2
  require_relative '../../../cross_suite/tags'
2
3
  require_relative '../../tagged_request_load_helper'
3
4
 
@@ -6,7 +7,7 @@ module DaVinciCRDTestKit
6
7
  class ClientLocationAddressPropagationTest < Inferno::Test
7
8
  include TaggedRequestLoadHelper
8
9
 
9
- title 'Client propagates addresses to child Location resources'
10
+ title 'CRD client propagates addresses to child Location resources'
10
11
  id :crd_v221_client_location_address_propagation
11
12
  description <<~DESCRIPTION
12
13
  The CRD IG requires that ([prof-13](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/StructureDefinition-profile-location.html#ci-c-prof-13))
@@ -28,27 +29,27 @@ module DaVinciCRDTestKit
28
29
  skip_if loaded_requests.blank?, 'No hook requests received.'
29
30
  pass_if prefetched_location_hash.blank?, 'No Location resources in use, so verification not needed.'
30
31
 
31
- prefetched_location_hash.each_value do |location|
32
- check_location_address_propagation(location)
32
+ prefetched_location_hash.each do |identity, location|
33
+ check_location_address_propagation(location, identity)
33
34
  end
34
35
 
35
36
  assert_no_error_messages('Address propagation issues found. See Messages for details.')
36
37
  end
37
38
 
38
39
  # checks that the location has an address if a parent also has an address
39
- def check_location_address_propagation(location, root_id = location.id)
40
+ def check_location_address_propagation(location, identity, root_id = location.id)
40
41
  return if location.address.present?
41
42
  return unless location.partOf.present? && location.partOf.reference.present?
42
43
 
43
- parent = prefetched_location_hash[location.partOf.reference]
44
- parent = fetched_location_hash[location.partOf.reference] unless parent.present?
44
+ parent_identity = parent_identity(location.partOf.reference, identity)
45
+ parent = prefetched_location_hash[parent_identity] || fetched_location_hash[parent_identity]
45
46
  if parent.present?
46
- check_location_conformance(parent, root_id)
47
+ check_location_conformance(parent, parent_identity, root_id)
47
48
  if parent.address.present?
48
49
  add_message('error', "Address missing on prefetched 'Location/#{root_id}': " \
49
50
  "parent 'Location/#{parent.id}' has an address.")
50
51
  else
51
- check_location_address_propagation(parent, root_id)
52
+ check_location_address_propagation(parent, parent_identity, root_id)
52
53
  end
53
54
  else
54
55
  add_message('error', "Unable to check address propagation prefetched 'Location/#{root_id}': " \
@@ -58,12 +59,21 @@ module DaVinciCRDTestKit
58
59
  nil
59
60
  end
60
61
 
62
+ # The identity of the Location a `partOf` reference names, resolved against the base of the
63
+ # Location holding it, following the FHIR rules for resolving references. As when Inferno read
64
+ # the parent during the hook request, a prefetched Location whose identity is not a RESTful URL,
65
+ # such as a `urn:uuid:` fullUrl, falls back to its request's FHIR server. A reference with no
66
+ # absolute form is used as given.
67
+ def parent_identity(reference, child_identity)
68
+ base = ResourceIdentity.base_for(child_identity) || prefetched_location_fhir_servers[child_identity]
69
+ ResourceIdentity.normalized_url(ResourceIdentity.absolute_reference(reference, base)) || reference
70
+ end
71
+
61
72
  # skip profile check if in the prefetch hash (done elsewhere) or already checked
62
- def check_location_conformance(location, root_id)
63
- key = "Location/#{location.id}"
64
- return if prefetched_location_hash.key?(key) || fetched_locations_checked_for_conformance.key?(key)
73
+ def check_location_conformance(location, identity, root_id)
74
+ return if prefetched_location_hash.key?(identity) || fetched_locations_checked_for_conformance.key?(identity)
65
75
 
66
- fetched_locations_checked_for_conformance[key] = location
76
+ fetched_locations_checked_for_conformance[identity] = location
67
77
  validator_response_details = []
68
78
  return if resource_is_valid?(resource: location, profile_url: 'http://hl7.org/fhir/us/davinci-crd/StructureDefinition/profile-location|2.2.1',
69
79
  add_messages_to_runnable: false, validator_response_details:)
@@ -85,6 +95,8 @@ module DaVinciCRDTestKit
85
95
  @loaded_requests ||= load_requests_for_cross_hook_analysis
86
96
  end
87
97
 
98
+ # The prefetched Locations of every hook request, keyed by the normalized absolute URL identifying each (see
99
+ # ResourceIdentity), or by `Location/id` when the request gives nothing to make one from.
88
100
  def prefetched_location_hash
89
101
  @prefetched_location_hash ||= build_prefetched_locations_hash
90
102
  end
@@ -94,17 +106,39 @@ module DaVinciCRDTestKit
94
106
  request_body = JSON.parse(request.request_body)
95
107
  next unless request_body.is_a?(Hash)
96
108
 
97
- prefetched_location_bundle = extract_prefetched_location_bundle(request_body)
98
- next unless prefetched_location_bundle.present?
99
-
100
- prefetched_location_bundle.entry.each do |entry|
101
- add_location_to_hash(entry.resource, location_hash)
102
- end
109
+ add_prefetched_locations(request_body, location_hash)
103
110
  rescue JSON::ParserError
104
111
  next
105
112
  end
106
113
  end
107
114
 
115
+ def add_prefetched_locations(request_body, location_hash)
116
+ fhir_server = ResourceIdentity.fhir_server_base(request_body)
117
+ extract_prefetched_location_bundle(request_body)&.entry&.each do |entry|
118
+ location = entry.resource
119
+ next unless location.is_a?(FHIR::Location) && location.id.present?
120
+
121
+ add_prefetched_location(location_hash, prefetched_location_identity(entry, fhir_server), location,
122
+ fhir_server)
123
+ end
124
+ end
125
+
126
+ def add_prefetched_location(location_hash, identity, location, fhir_server)
127
+ location_hash[identity] ||= location
128
+ prefetched_location_fhir_servers[identity] ||= fhir_server
129
+ end
130
+
131
+ # The FHIR server of the hook request that carried each prefetched Location, by identity.
132
+ def prefetched_location_fhir_servers
133
+ @prefetched_location_fhir_servers ||= {}
134
+ end
135
+
136
+ # A Location given without a fullUrl is taken to be on the request's FHIR server.
137
+ def prefetched_location_identity(entry, fhir_server)
138
+ identity = entry.fullUrl.presence || ResourceIdentity.restful_identity(entry.resource, fhir_server)
139
+ ResourceIdentity.normalized_url(identity) || "Location/#{entry.resource.id}"
140
+ end
141
+
108
142
  def extract_prefetched_location_bundle(request_body)
109
143
  locations_data = request_body.dig('prefetch', 'locations') || request_body.dig('prefetch', 'locs')
110
144
  locations = FHIR.from_contents(locations_data.to_json) if locations_data.present?
@@ -114,26 +148,22 @@ module DaVinciCRDTestKit
114
148
  FHIR::Bundle.new({ entry: [FHIR::Bundle::Entry.new({ resource: locations })] })
115
149
  end
116
150
 
151
+ # The parent Locations read during hook requests, keyed by the normalized URL each was read from. A read
152
+ # only counts when it returned the Location that URL names.
117
153
  def fetched_location_hash
118
154
  @fetched_location_hash ||= build_fetched_locations_hash
119
155
  end
120
156
 
121
157
  def build_fetched_locations_hash
122
- load_tagged_requests(PARENT_LOCATION_FETCH_TAG, DATA_FETCH_TAG).each_with_object({}) do |request, location_hash|
123
- add_location_to_hash(FHIR.from_contents(request.response_body), location_hash)
158
+ load_tagged_requests(PARENT_LOCATION_FETCH_TAG).each_with_object({}) do |request, location_hash|
159
+ location = FHIR.from_contents(request.response_body)
160
+ next unless location.is_a?(FHIR::Location) && ResourceIdentity.names?(request.url, location)
161
+
162
+ location_hash[ResourceIdentity.normalized_url(request.url)] ||= location
124
163
  rescue JSON::ParserError
125
164
  next
126
165
  end
127
166
  end
128
-
129
- def add_location_to_hash(location, location_hash)
130
- return unless location.is_a?(FHIR::Location) && location.id.present?
131
-
132
- relative_reference = "#{location.resourceType}/#{location.id}"
133
- return if location_hash.key?(relative_reference)
134
-
135
- location_hash[relative_reference] = location
136
- end
137
167
  end
138
168
  end
139
169
  end
@@ -0,0 +1,101 @@
1
+ require_relative '../../../cross_suite/hook_request_resource_extraction'
2
+ require_relative '../../../cross_suite/profiles_and_resource_types'
3
+ require_relative '../../../cross_suite/tags'
4
+
5
+ module DaVinciCRDTestKit
6
+ module V221
7
+ class ClientOrderTypesSignedTest < Inferno::Test
8
+ include HookRequestResourceExtraction
9
+
10
+ title 'Observed order types were submitted as draftOrders on the order-sign hook'
11
+ id :crd_v221_client_order_types_signed
12
+ description <<~DESCRIPTION
13
+ CRD clients are required to support the `order-sign` hook for the order types they handle.
14
+ During this test, Inferno will verify that every order type it observed appeared as a
15
+ `draftOrder` on an `order-sign` invocation.
16
+ DESCRIPTION
17
+
18
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.2.1@hook-3'
19
+
20
+ def requests_repo
21
+ @requests_repo ||= Inferno::Repositories::Requests.new
22
+ end
23
+
24
+ # Reads the requests directly rather than going through `load_tagged_requests`, which would
25
+ # also associate every cross-invocation request with this test's own result.
26
+ def tagged_requests(*tags)
27
+ requests_repo.tagged_requests(test_session_id, tags)
28
+ end
29
+
30
+ # The hooks each order type was seen on, so that an unsigned type can say where it did turn up
31
+ # rather than only where it did not.
32
+ def hooks_by_order_type
33
+ tagged_requests(CROSS_HOOK_ANALYSIS_TAG).each_with_object({}) do |request, hooks|
34
+ request_body = parse_request_body(request)
35
+ hook = request_body['hook'] if request_body.is_a?(Hash)
36
+
37
+ each_hook_request_resource(request_body) do |raw_resource|
38
+ resource_type = raw_resource['resourceType']
39
+ next unless ProfilesAndResourceTypes::ORDER_RESOURCE_TYPES.include?(resource_type)
40
+
41
+ (hooks[resource_type] ||= Set.new) << hook if hook.present?
42
+ end
43
+ end
44
+ end
45
+
46
+ # Only the draftOrders bundle counts, since that is where an order-sign invocation carries the
47
+ # orders being signed. The same resource elsewhere in the request does not demonstrate signing.
48
+ def signed_order_types
49
+ tagged_requests(ORDER_SIGN_TAG, CROSS_HOOK_ANALYSIS_TAG).each_with_object(Set.new) do |request, types|
50
+ each_resource_within(draft_orders(request)) do |raw_resource|
51
+ resource_type = raw_resource['resourceType']
52
+ types << resource_type if ProfilesAndResourceTypes::ORDER_RESOURCE_TYPES.include?(resource_type)
53
+ end
54
+ end
55
+ end
56
+
57
+ # A malformed request may carry a body or `context` that is not a JSON object, which `dig` would
58
+ # raise on, so each level is checked before reading from it.
59
+ def draft_orders(request)
60
+ body = parse_request_body(request)
61
+ context = body['context'] if body.is_a?(Hash)
62
+ context['draftOrders'] if context.is_a?(Hash)
63
+ end
64
+
65
+ # An order type can turn up on an order-sign request without being in its `draftOrders`, so the
66
+ # hook is named only where it does not contradict the finding.
67
+ def unsigned_message(resource_type, hooks)
68
+ elsewhere = Array(hooks&.to_a) - ['order-sign']
69
+ if elsewhere.blank?
70
+ return "There was an instance of `#{resource_type}` that was observed, but never seen as a " \
71
+ 'draft order on an `order-sign` invocation. All supported order types must be able ' \
72
+ 'to be sent as a draft order on an order-sign hook invocation.'
73
+ end
74
+
75
+ "There was an instance of `#{resource_type}` that was observed on the " \
76
+ "#{elsewhere.sort.map { |hook| "`#{hook}`" }.to_sentence} " \
77
+ "#{'hook'.pluralize(elsewhere.length)}, but never seen as a draft order on an " \
78
+ '`order-sign` invocation. All supported order types must be able to be sent as a draft ' \
79
+ 'order on an order-sign hook invocation.'
80
+ end
81
+
82
+ run do
83
+ observed_hooks = hooks_by_order_type
84
+ observed = observed_hooks.keys
85
+ skip_if observed.blank?, 'No order resources were found in the hook requests received.'
86
+
87
+ unsigned = observed - signed_order_types.to_a
88
+
89
+ unsigned.each do |resource_type|
90
+ add_message('error', unsigned_message(resource_type, observed_hooks[resource_type]))
91
+ end
92
+
93
+ assert unsigned.blank?,
94
+ "#{unsigned.length} of the #{observed.length} order type(s) observed were never signed: " \
95
+ "#{unsigned.join(', ')}."
96
+
97
+ pass "All #{observed.length} order type(s) observed were signed: #{observed.join(', ')}."
98
+ end
99
+ end
100
+ end
101
+ end
@@ -7,37 +7,23 @@ module DaVinciCRDTestKit
7
7
  class ClientPrefetchCompleteAndSubsetTest < Inferno::Test
8
8
  include TaggedRequestLoadHelper
9
9
  include CrossHookHelper
10
+ include ClientURLs
10
11
 
11
- title 'Client can provide both the complete standard prefetch data set and a subset'
12
+ title 'CRD client can provide both the complete standard prefetch data set and a subset'
12
13
  id :crd_v221_client_prefetch_complete_and_subset
13
14
  description <<~DESCRIPTION
14
- The CRD IG requires clients to be able to prefetch a standard set of resources that
15
+ The CRD IG requires that CRD clients be able to prefetch a standard set of resources that
15
16
  payers are expected to need to evaluate coverage requirements. They are also
16
17
  required to be able to prefetch a subset of these standard prefetch requirements
17
18
  if a payer requests fewer in their service discovery responses because the payer
18
19
  does not always need the complete set of standard prefetch resources to evaluate
19
20
  coverage.
20
21
 
21
- During this test, Inferno will verify that the client has demonstrated requests
22
- - made against both of Inferno's simulated CRD servers,
23
- one of which requests the all standard prefetch resources while the
24
- other requests only a subset.
25
- - which demonstrate the capability to distinguish the difference between
26
- the two prefetch sets.
27
-
28
- The CRD server that requests only a subset of the standard prefetch data does not request
29
- resources referenced from the following elements. Request made to each Inferno service
30
- endpoint with one of these elements populated with a reference to a resource not referenced
31
- elsewhere will demonstrate the required capability.
32
- - On an `appointment-book` hook request, an Appointment with a participant entry that
33
- references a Practitioner or PractitionerRole resource in its actor element
34
- - On an `encounter-start` or `encounter-discharge` hook request, an Encounter with a
35
- referenced Location via the `location` element or referenced Organization via the
36
- `serviceProvider` element.
37
- - On an `order-select`, `order-sign`, or `order-dispatch` hook request, one of the following order resources:
38
- - A CommunicationRequest, DeviceRequest, MedicationRequest, or ServiceRequest that references a Practitioner or PractitionerRole resource in its `requester` element, or
39
- - A NutritionOrder that references a Practitioner or PractitionerRole resource in its `orderer` element
40
- - A VisionPrescription that references a Practitioner or PractitionerRole resource in its `prescriber` element
22
+ During this test, Inferno will verify that the CRD client has made requests that:
23
+ - Target both of Inferno's simulated CRD servers,
24
+ [one of which requests all standard prefetch resources](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Prefetch-Verification#infernos-standard-services)
25
+ while the other [requests only a subset](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Prefetch-Verification#infernos-subset-services).
26
+ - Demonstrate the capability to [distinguish between the two prefetch sets](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Prefetch-Verification#demonstrating-prefetch-calculation).
41
27
 
42
28
  This test relies on the evaluation performed by the "Hook requests include the
43
29
  requested prefetch data" tests present in each hook-specific "Requests" group. One of these groups must
@@ -52,13 +38,14 @@ module DaVinciCRDTestKit
52
38
 
53
39
  run do
54
40
  subset_prefetch_requests, complete_prefetch_requests =
55
- load_requests_for_cross_hook_analysis.partition { |request| request.url.include?(PREFETCH_SUBSET_PREFIX) }
41
+ load_requests_for_cross_hook_analysis.partition { |request| prefetch_target(request) == :subset }
56
42
  completeness_tests = find_completeness_tests
57
43
  check_for_demonstration(subset_prefetch_requests, completeness_tests, :subset)
58
44
  check_for_demonstration(complete_prefetch_requests, completeness_tests, :complete)
59
45
 
60
46
  skip_if error_messages?,
61
- 'The client did not demonstrate both complete and subset prefetch capability. See Messages for details.'
47
+ 'The CRD client did not demonstrate both complete and subset prefetch capability. ' \
48
+ 'See Messages for details.'
62
49
  end
63
50
 
64
51
  def check_for_demonstration(requests, completeness_tests, target_name)
@@ -1,16 +1,17 @@
1
1
  require_relative 'base_hook_invocation_receive_request_test'
2
+ require_relative '../../client_input_helper'
2
3
 
3
4
  module DaVinciCRDTestKit
4
5
  module V221
5
6
  class AppointmentBookReceiveRequestTest < BaseHookInvocationReceiveRequestTest
6
7
  id :crd_v221_appointment_book_request
7
- title 'Client invokes the appointment-book hook'
8
+ title 'CRD client invokes the appointment-book hook'
8
9
  description %(
9
- During this test, Inferno will wait while the client makes one or more [appointment-book](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/hooks.html#appointment-book)
10
+ During this test, Inferno will wait while the CRD client makes one or more [appointment-book](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/hooks.html#appointment-book)
10
11
  hook requests against Inferno's simulated CRD servers. Inferno will respond
11
12
  based on the response configuration provided when running the test.
12
13
  For more details on how Inferno's simulated CRD servers behave during
13
- hook invocation see the [simulated CRD server](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Details#crd-server-simulation)
14
+ hook invocation see the [simulated CRD server](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Details#simulated-crd-server-in-the-crd-client-v221-suite)
14
15
  documentation.
15
16
 
16
17
  Inferno will pause and wait for inbound requests until told explicitly to continue
@@ -20,31 +21,15 @@ module DaVinciCRDTestKit
20
21
 
21
22
  input :appointment_book_response_approach,
22
23
  title: 'Response generation approach for appointment-book',
23
- description: %(
24
- Determines how Inferno will generate response for appoontment-book
25
- hook invocations.
26
- ),
24
+ description: ClientInputHelper.response_approach_description('appointment-book'),
27
25
  type: 'radio',
28
26
  default: 'mocked',
29
- options: {
30
- list_options: [
31
- {
32
- label: 'Create simple mocks based on selected response types',
33
- value: 'mocked'
34
- },
35
- {
36
- label: 'Generate responses based on a tester-provided template',
37
- value: 'custom'
38
- }
39
- ]
40
- }
27
+ options: ClientInputHelper.response_approach_options
41
28
  input :appointment_book_selected_response_types,
42
29
  title: 'Response types to return from appointment-book hook requests',
43
30
  description: %(
44
- Select the CRD response types that the simulated Inferno CRD server will [mock](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses)
45
- when responding to hook invocations. If no types are selected, Inferno will mock and return
46
- a [Coverage Information](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/cards.html#coverage-information-response-type)
47
- response for this primary hook.
31
+ #{ClientInputHelper.mocked_response_types_intro}
32
+ #{ClientInputHelper.coverage_information_always_included_note}
48
33
  ),
49
34
  type: 'checkbox',
50
35
  default: ['coverage_information', 'external_reference', 'instructions'],
@@ -53,10 +38,7 @@ module DaVinciCRDTestKit
53
38
  enable_when: { input_name: 'appointment_book_response_approach', value: 'mocked' }
54
39
  input :appointment_book_custom_response_template,
55
40
  title: 'Custom response template for appointment-book hook requests',
56
- description: %(
57
- Provide a [custom response template](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#tester-directed-custom-responses)
58
- in JSON form for Inferno to use when responding to hook invocations.
59
- ),
41
+ description: ClientInputHelper.custom_response_template_description,
60
42
  type: 'textarea',
61
43
  optional: true,
62
44
  enable_when: { input_name: 'appointment_book_response_approach', value: 'custom' }
@@ -1,10 +1,13 @@
1
+ require_relative '../../client_wait_messages'
1
2
  require_relative '../client_urls'
2
3
  require_relative '../../../cross_suite/cards_identification'
4
+ require_relative '../../client_input_helper'
3
5
 
4
6
  module DaVinciCRDTestKit
5
7
  module V221
6
8
  class BaseHookInvocationReceiveRequestTest < Inferno::Test
7
9
  include ClientURLs
10
+ include DaVinciCRDTestKit::ClientWaitMessages
8
11
 
9
12
  RESPONSE_TYPE_OPTIONS = [
10
13
  {
@@ -48,13 +51,11 @@ module DaVinciCRDTestKit
48
51
 
49
52
  input :cds_jwt_iss,
50
53
  title: 'CRD JWT Issuer',
51
- description: %(
52
- Value of the `iss` claim that must be present in the JWT used to authorize the client's hook
53
- request sent as the Bearer token in the `Authorization` header.
54
- Run or re-run the "Registration" group to set or change this value.
55
- ),
54
+ description: ClientInputHelper.locked_cds_jwt_iss_description,
56
55
  locked: true
56
+ payer_organization_id_inputs
57
57
  output :continuation_url
58
+ flag_as_tester_initiated_exchange
58
59
 
59
60
  def hook_key
60
61
  raise NotImplementedError, "#{self.class} must implement #hook_key"
@@ -84,28 +85,26 @@ module DaVinciCRDTestKit
84
85
  'against the incoming request to create a response.'
85
86
  else
86
87
  'When responding, Inferno will [mock](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses) ' \
87
- 'the following response types using the incoming request: ' \
88
- "\n - #{selected_response_types_string}"
88
+ 'the following response types using the incoming request:' \
89
+ "\n\n- #{selected_response_types_string}"
89
90
  # rubocop:enable Layout/LineLength
90
91
  end
91
92
  end
92
93
 
93
94
  def selected_response_types_string
94
- response_types =
95
- if selected_response_types.present?
96
- selected_response_types
95
+ response_types = selected_response_types.presence || []
96
+ # mocked responses on primary hooks always include Coverage Information, whether or not it was selected
97
+ response_types |= [DaVinciCRDTestKit::CardsIdentification::COVERAGE_INFORMATION_RESPONSE_TYPE] if primary_hook?
98
+ # an Instructions card is returned when nothing else would be
99
+ response_types = [DaVinciCRDTestKit::CardsIdentification::INSTRUCTIONS_RESPONSE_TYPE] if response_types.empty?
100
+
101
+ format_responded_response_types(response_types.map do |response_type|
102
+ if response_type == DaVinciCRDTestKit::CardsIdentification::COVERAGE_INFORMATION_RESPONSE_TYPE
103
+ "#{response_type}_action"
97
104
  else
98
- # matches the hook's default response type
99
- primary_hook? ? [DaVinciCRDTestKit::CardsIdentification::COVERAGE_INFORMATION_RESPONSE_TYPE] : [DaVinciCRDTestKit::CardsIdentification::INSTRUCTIONS_RESPONSE_TYPE]
100
- end.map do |response_type|
101
- if response_type == DaVinciCRDTestKit::CardsIdentification::COVERAGE_INFORMATION_RESPONSE_TYPE
102
- "#{response_type}_action"
103
- else
104
- "#{response_type}_card"
105
- end
105
+ "#{response_type}_card"
106
106
  end
107
-
108
- format_responded_response_types(response_types)
107
+ end)
109
108
  end
110
109
 
111
110
  def format_responded_response_types(response_types)
@@ -114,15 +113,15 @@ module DaVinciCRDTestKit
114
113
  DaVinciCRDTestKit::CardsIdentification.humanize_response_type(response_type)
115
114
  .sub('Card', '(card)')
116
115
  .sub('Action', '(systemAction)')
117
- end.join("\n - ")
116
+ end.join("\n- ")
118
117
  end
119
118
 
120
119
  def invoke_heading
121
- "Invoke the `#{hook_slug}` hook"
120
+ "Invoke the `#{hook_slug}` Hook"
122
121
  end
123
122
 
124
123
  def invoke_intro
125
- "Invoke #{hook_slug} hook by sending requests to one or both of the two Inferno simulated CRD servers:"
124
+ "Invoke the `#{hook_slug}` hook by sending requests to one or both of the two Inferno simulated CRD servers."
126
125
  end
127
126
 
128
127
  def complete_prefetch_url
@@ -133,29 +132,49 @@ module DaVinciCRDTestKit
133
132
  send(:"#{hook_key}_prefetch_subset_url")
134
133
  end
135
134
 
136
- run do
137
- identifier = cds_jwt_iss
138
- continuation_url = "#{resume_pass_url}?token=#{identifier}"
139
- output(continuation_url:)
135
+ # Overridden by a group whose additional requests are optional, so it can pass without waiting.
136
+ def skip_waiting_for_requests?
137
+ false
138
+ end
140
139
 
141
- wait(
142
- identifier:,
143
- message: %(
144
- **#{invoke_heading}**:
140
+ def wait_message_endpoints_section
141
+ <<~ENDPOINTS
142
+ #### `#{hook_slug}` Service Endpoints
143
+
144
+ - Complete Prefetch `#{hook_slug}` Service#{complete_prefetch_payer_note}: `#{complete_prefetch_url}`
145
+ - Subset Prefetch `#{hook_slug}` Service#{subset_prefetch_payer_note}: `#{subset_prefetch_url}`
146
+ ENDPOINTS
147
+ end
148
+
149
+ def message
150
+ <<~MESSAGE
151
+ #### #{invoke_heading}
145
152
 
146
- #{invoke_intro}
153
+ #{invoke_intro}
147
154
 
148
- - Complete Prefetch: `#{complete_prefetch_url}`
149
- - Subset Prefetch: `#{subset_prefetch_url}`
155
+ [Click here](#{continuation_url}) when you have finished submitting requests.
150
156
 
151
- For Inferno to recognize these requests and associate them with this session,
152
- the authentication JWT sent as a Bearer token in the Authorization header
153
- must have `#{cds_jwt_iss}` as the `iss` claim in the JWT payload.
157
+ #{wait_message_endpoints_section}
158
+ #### Authentication and Identification
154
159
 
155
- #{configured_response_details}
160
+ #{session_identification_message}
156
161
 
157
- [Click here](#{continuation_url}) when you have finished submitting requests.
158
- )
162
+ #### Responses
163
+
164
+ #{configured_response_details}
165
+ MESSAGE
166
+ end
167
+
168
+ run do
169
+ next if skip_waiting_for_requests?
170
+
171
+ identifier = cds_jwt_iss
172
+ continuation_url = resume_pass_url_for(identifier)
173
+ output(continuation_url:)
174
+
175
+ wait(
176
+ identifier:,
177
+ message:
159
178
  )
160
179
  end
161
180
  end