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
@@ -0,0 +1,331 @@
1
+ require_relative '../../../cross_suite/hook_request_resource_extraction'
2
+ require_relative '../../../cross_suite/profile_metadata'
3
+ require_relative '../../../cross_suite/must_support_slice_matching'
4
+ require_relative '../../../cross_suite/tags'
5
+ require_relative '../client_urls'
6
+ require_relative 'request_must_support_scope'
7
+
8
+ module DaVinciCRDTestKit
9
+ module V221
10
+ # Checks that the CRD profiles within a given scope were observed in the hook requests made
11
+ # by the CRD client, and that every must support element on them was populated on at least one
12
+ # instance. Anything not observed falls back to a tester attestation.
13
+ class RequestMustSupportWithAttestationOption < Inferno::Test
14
+ include HookRequestResourceExtraction
15
+ include ClientURLs
16
+ include RequestMustSupportScope
17
+
18
+ id :crd_v221_request_must_support_with_attestation_option
19
+
20
+ MISMATCH_KINDS = [:invoked_hook_type, :unexpected_type, :missing_type].freeze
21
+
22
+ # The type matters: Inferno parses a checkbox input's stored JSON into an array, and without
23
+ # it the raw string arrives instead.
24
+ input :order_types_supported, optional: true, type: 'checkbox'
25
+ input :supporting_types_supported, optional: true, type: 'checkbox'
26
+
27
+ output :attest_true_url
28
+ output :attest_false_url
29
+
30
+ class << self
31
+ def build_description(options)
32
+ sections = options[:profiles].map do |profile|
33
+ metadata = metadata_for(options[:ig_version], profile)
34
+ multiple_profiles = profile[:profile_keys].length > 1
35
+
36
+ "### #{profile_links(options[:ig_version], profile)}\n\n#{multiple_profiles_note if multiple_profiles}" \
37
+ "#{element_list(metadata)}#{choice_section(metadata)}"
38
+ end
39
+
40
+ "#{description_intro}\n\n#{sections.join("\n\n")}"
41
+ end
42
+
43
+ def element_list(metadata)
44
+ (metadata.must_support_strings - choice_paths(metadata))
45
+ .map { |element| "- `#{element}`" }.join("\n")
46
+ end
47
+
48
+ def choice_paths(metadata)
49
+ Array(metadata.must_supports[:choices]).flat_map { |choice| choice_locations(choice) }
50
+ end
51
+
52
+ # A choice lists its locations as element paths or, for slices, as slice ids.
53
+ def choice_locations(choice)
54
+ Array(choice[:paths]) +
55
+ Array(choice[:slice_names]).map { |slice_id| Inferno::DSL::MustSupportStrings.without_resource_type(slice_id) }
56
+ end
57
+
58
+ def choice_section(metadata)
59
+ choices = Array(metadata.must_supports[:choices])
60
+ return '' if choices.blank?
61
+
62
+ "\n\n#{choice_note}#{choices.map { |choice| choice_entry(choice) }.join("\n\n")}"
63
+ end
64
+
65
+ def choice_entry(choice)
66
+ locations = choice_locations(choice).map { |path| " - `#{path}`" }.join("\n")
67
+
68
+ "- `#{choice[:element]}`, on any one of:\n#{locations}"
69
+ end
70
+
71
+ def choice_note
72
+ <<~NOTE
73
+ #### Timing
74
+
75
+ The CRD Timing elements below appear in more than one place on this profile. Each only
76
+ needs to be demonstrated in one of the locations listed under it.
77
+
78
+ NOTE
79
+ end
80
+
81
+ def multiple_profiles_note
82
+ <<~NOTE
83
+ The elements below are drawn from both appointment profiles, and each may be demonstrated on
84
+ an instance of either of them. A CRD client that supports only one of these profiles can
85
+ attest to non-support of the related elements.
86
+ NOTE
87
+ end
88
+
89
+ # Each of the profile's names, linked to its page in the IG.
90
+ def profile_links(ig_version, profile)
91
+ profile[:profile_keys].map do |key|
92
+ metadata = ProfileMetadata.for(ig_version, key)
93
+ "[#{metadata.profile_name}](#{profile_page_url(metadata)})"
94
+ end.to_sentence(two_words_connector: ' or ', last_word_connector: ', or ')
95
+ end
96
+
97
+ def profile_page_url(metadata)
98
+ ig_base, structure_definition = metadata.profile_url.split('/StructureDefinition/')
99
+
100
+ "#{ig_base}/#{metadata.profile_version}/en/StructureDefinition-#{structure_definition}.html"
101
+ end
102
+
103
+ def description_intro
104
+ <<~INTRO
105
+ The CRD IG [requires](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/conformance.html#ci-c-conf-3)
106
+ that when a client "maintains a mustSupport data element and surfaces it to users, then it
107
+ SHALL be exposed in their FHIR interface when the data exists and privacy constraints permit."
108
+
109
+ During this test, Inferno will verify that all must support elements defined in the
110
+ profile(s) listed below are demonstrated within hook requests made during this session.
111
+ This check may vacuously pass if the tester has attested that this resource type is not
112
+ supported by the CRD client.
113
+
114
+ If any must support elements are not demonstrated, the tester will have the option to attest
115
+ that these elements are not supported by the CRD client or surfaced to its users. Testers
116
+ must set up scenarios in which the "data exists and privacy constraints permit" Inferno to view
117
+ the must support information.
118
+
119
+ Inferno will consider resources present within the `context` and `prefetch` elements of all hook
120
+ requests made during the latest run of each "Hooks" subgroup and the "Additional Hook
121
+ Invocations" group, but not any made within the "Scenarios"
122
+ subgroups. If any of the considered groups are re-run, then requests made during prior runs will
123
+ no longer be considered and must support elements demonstrated only during that prior run must
124
+ be re-demonstrated on the new run or a subsequent one.
125
+
126
+ For additional details on this test, see the [Client Must Support Tests](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Must-Support)
127
+ page and specifically the [Requests](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Must-Support#requests)
128
+ section in the CRD Test Kit wiki.
129
+ INTRO
130
+ end
131
+
132
+ def metadata_for(ig_version, profile)
133
+ ProfileMetadata.merged(ig_version, profile[:profile_keys])
134
+ end
135
+
136
+ def title_for(metadata, profile)
137
+ profile[:title] || metadata.profile_name
138
+ end
139
+ end
140
+
141
+ # Every must support test in this group reads the same pooled requests, so the extraction is
142
+ # kept in scratch, which persists across test instances. The request ids it was built from are
143
+ # stored alongside it, since a tester can send more hook requests and re-run the group.
144
+ def extraction
145
+ request_ids = must_support_requests.map(&:id)
146
+ cached = scratch[:must_support_extraction]
147
+ return cached if cached && cached[:request_ids] == request_ids
148
+
149
+ scratch[:must_support_extraction] = { request_ids:, **extract(must_support_requests) }
150
+ end
151
+
152
+ # The resources of each type, and the ids of the requests that carried them, so that each test
153
+ # can associate just the requests holding the types it checks.
154
+ def extract(requests)
155
+ requests.each_with_object({ resources_by_type: {}, request_ids_by_type: {} }) do |request, extracted|
156
+ fhir_resources_by_type([request]).each do |resource_type, resources|
157
+ (extracted[:resources_by_type][resource_type] ||= []).concat(resources)
158
+ (extracted[:request_ids_by_type][resource_type] ||= []) << request.id
159
+ end
160
+ end
161
+ end
162
+
163
+ def resources_by_type
164
+ extraction[:resources_by_type]
165
+ end
166
+
167
+ def relevant_requests
168
+ request_ids = profile_resource_types.flat_map do |resource_type|
169
+ Array(extraction[:request_ids_by_type][resource_type])
170
+ end
171
+ must_support_requests.select { |request| request_ids.include?(request.id) }
172
+ end
173
+
174
+ def ig_version
175
+ config.options[:ig_version]
176
+ end
177
+
178
+ def invoked_requiring_hooks(resource_type)
179
+ Array(requiring_hooks(resource_type)).select { |hook_tag| hook_invoked?(hook_tag) }
180
+ end
181
+
182
+ def required_by_invoked_hook?(resource_type)
183
+ invoked_requiring_hooks(resource_type).present?
184
+ end
185
+
186
+ def requiring_hooks(resource_type)
187
+ ClientCrossHookMustSupportGroup::REQUIRING_HOOKS[resource_type]
188
+ end
189
+
190
+ # The pooled requests carry their tags, so a hook's invocation is read from them rather than
191
+ # with another query.
192
+ def hook_invoked?(hook_tag)
193
+ must_support_requests.any? { |request| request.tags.include?(hook_tag) }
194
+ end
195
+
196
+ # Only a type the tester declared unsupported contradicts what they said.
197
+ def declared_type_mismatch(resource_type, resources)
198
+ return :invoked_hook_type if declared_unsupported?(resource_type) && required_by_invoked_hook?(resource_type)
199
+ return :unexpected_type if resources.present? && declared_unsupported?(resource_type)
200
+
201
+ :missing_type if resources.blank? && expected?(resource_type)
202
+ end
203
+
204
+ def gather_unobserved
205
+ config.options[:profiles].filter_map do |profile|
206
+ metadata = self.class.metadata_for(ig_version, profile)
207
+ title = self.class.title_for(metadata, profile)
208
+ resource_type = profile[:resource_type]
209
+ resources = resources_by_type[resource_type] || []
210
+
211
+ mismatch = declared_type_mismatch(resource_type, resources)
212
+ next { kind: mismatch, title:, resource_type:, count: resources.length } if mismatch
213
+
214
+ # The must support assessment returns nil rather than the full list when handed no
215
+ # resources, so an absent resource type has to be caught before calling it.
216
+ next if resources.blank?
217
+
218
+ missing = MustSupportLogic.new.perform_must_support_test_with_metadata(
219
+ resources, metadata, debug_metadata: config.options[:debug_must_support_metadata]
220
+ )
221
+ next if missing.blank?
222
+
223
+ { kind: :unobserved_elements, title:, resource_type:, count: resources.length, missing:,
224
+ profile_links: self.class.profile_links(ig_version, profile) }
225
+ end
226
+ end
227
+
228
+ # What the tester declared and what the CRD client sent have to agree: a type they said is
229
+ # supported must turn up, and one they said is not must not, nor may a hook that carries it be
230
+ # invoked.
231
+ def check_declared_types(unobserved)
232
+ mismatched = unobserved.select { |entry| MISMATCH_KINDS.include?(entry[:kind]) }
233
+
234
+ assert mismatched.blank?, mismatched.map { |entry| declared_type_message(entry) }.join(' ')
235
+ end
236
+
237
+ def declared_type_message(entry)
238
+ case entry[:kind]
239
+ when :invoked_hook_type
240
+ "The CRD client invoked the #{hook_list(invoked_requiring_hooks(entry[:resource_type]))} hook(s), " \
241
+ "which are expected to include the `#{entry[:resource_type]}` resource type, but " \
242
+ "#{DECLARED_UNSUPPORTED_REASON}."
243
+ when :unexpected_type
244
+ "Observed #{entry[:count]} `#{entry[:resource_type]}` instance(s) in the hook requests made by the " \
245
+ "CRD client, but #{DECLARED_UNSUPPORTED_REASON}."
246
+ else
247
+ missing_type_message(entry[:resource_type])
248
+ end
249
+ end
250
+
251
+ def hook_list(hook_tags)
252
+ hook_tags.map { |hook_tag| "`#{hook_tag}`" }.to_sentence
253
+ end
254
+
255
+ # A type that was neither observed nor expected passes without the tester having to say
256
+ # anything, so the message says why rather than claiming its elements were seen.
257
+ def pass_message
258
+ vacuous = config.options[:profiles].map { |profile| profile[:resource_type] }
259
+ .reject { |resource_type| resources_by_type[resource_type].present? }
260
+ return 'All must support elements were observed.' if vacuous.blank?
261
+
262
+ "No instances of #{vacuous.to_sentence} observed, and none expected: " \
263
+ "#{DECLARED_UNSUPPORTED_REASON}."
264
+ end
265
+
266
+ def log_info_messages(unobserved)
267
+ unobserved.each do |entry|
268
+ next unless entry[:kind] == :unobserved_elements
269
+
270
+ add_message('info',
271
+ "Observed #{entry[:count]} #{entry[:resource_type]} instance(s) across " \
272
+ "#{must_support_requests.length} hook request(s) for #{entry[:title]}.")
273
+ entry[:missing].each do |element|
274
+ add_message('info', "Unobserved must support element for #{entry[:title]}: #{element}")
275
+ end
276
+ end
277
+ end
278
+
279
+ def attestation_message(unobserved, attest_true_url, attest_false_url)
280
+ <<~MESSAGE
281
+ **Must Support Attestation**:
282
+
283
+ #{unobserved.map { |entry| attestation_section(entry) }.join("\n\n")}
284
+
285
+ [Click here](#{attest_true_url}) if the above statement is **true**.
286
+
287
+ [Click here](#{attest_false_url}) if the above statement is **false**.
288
+ MESSAGE
289
+ end
290
+
291
+ def attestation_section(entry)
292
+ <<~SECTION.chomp
293
+ Inferno observed #{entry[:count]} `#{entry[:resource_type]}` instance(s) in the hook requests
294
+ made by the CRD client, but the following #{entry[:profile_links]} must support elements were not
295
+ observed on any of them#{nutrition_order_schedule_note if entry[:resource_type] == 'NutritionOrder'}:
296
+
297
+ #{entry[:missing].map { |element| "- `#{element}`" }.join("\n")}
298
+
299
+ I attest that the CRD client either does not capture or does not surface to its users the data represented by the elements in the list above.
300
+ SECTION
301
+ end
302
+
303
+ def nutrition_order_schedule_note
304
+ ' (NOTE - `schedule` subelements from the [CRD Timing data type profile]' \
305
+ '(https://hl7.org/fhir/us/davinci-crd/2.2.1/en/StructureDefinition-profile-timing.html) ' \
306
+ 'appear under elements `enteralFormula.administration`, `oralDiet`, and `supplement` ' \
307
+ 'but only have to be demonstrated under one of them)'
308
+ end
309
+
310
+ run do
311
+ skip_if must_support_requests.blank?, 'No hook requests received.'
312
+ associate_requests(relevant_requests)
313
+
314
+ unobserved = gather_unobserved
315
+ check_declared_types(unobserved)
316
+ log_info_messages(unobserved)
317
+ pass pass_message if unobserved.blank?
318
+
319
+ identifier = SecureRandom.hex(32)
320
+ attest_true_url = resume_pass_url_for(identifier)
321
+ attest_false_url = resume_fail_url_for(
322
+ identifier, message: 'Not all must support elements demonstrated. See messages for details.'
323
+ )
324
+ output(attest_true_url:)
325
+ output(attest_false_url:)
326
+
327
+ wait(identifier:, message: attestation_message(unobserved, attest_true_url, attest_false_url))
328
+ end
329
+ end
330
+ end
331
+ end
@@ -1,5 +1,6 @@
1
1
  require 'jwt'
2
2
  require_relative '../client_urls'
3
+ require_relative '../../client_input_helper'
3
4
 
4
5
  module DaVinciCRDTestKit
5
6
  module V221
@@ -7,19 +8,19 @@ module DaVinciCRDTestKit
7
8
  include ClientURLs
8
9
 
9
10
  id :crd_v221_client_registration_verification
10
- title 'CRD client registers with Inferno'
11
+ title 'CRD client registration details are complete and valid'
11
12
  description %(
12
13
  In order to register with and be able to make hook requests against Inferno's
13
14
  simulated CRD servers, the tester must provide the `iss` (issuer) claim in
14
15
  the payload of the JWT sent in the Authorization header of hook requests
15
- made by the client against Inferno. This information is used to
16
+ made by the CRD client against Inferno. This information is used to
16
17
  associate inbound requests to Inferno's simulated CRD servers with this session.
17
18
  Requests made without a JWT or with a different `iss` value will not appear in this
18
19
  session or be analyzed.
19
20
 
20
- Inferno also requires some additional information to verify conformant client behavior.
21
- This information is not needed to execute the tests, but the tests will not completely
22
- pass without it:
21
+ Inferno also requires some additional information to verify that the CRD client behaves
22
+ in a conformant manner. This information is not needed to execute the tests, but the
23
+ tests will not completely pass without it:
23
24
  - A JSON Web Key Set (JWKS) containing the key used to sign the JWT sent in the Authorization
24
25
  header for use in signature validation. It can be provided either as a URL where it is
25
26
  publicly hosted (preferred) or the raw JWKS as JSON.
@@ -29,8 +30,8 @@ module DaVinciCRDTestKit
29
30
  These are used to verify that the prefetched coverage is linked to the correct payer for the invoked
30
31
  service.
31
32
 
32
- During this test, registration information provided will be checked for conformance
33
- with these requirements.
33
+ During this test, Inferno will verify that the provided registration information is
34
+ complete and valid.
34
35
  )
35
36
 
36
37
  verifies_requirements 'cds-hooks_3.0.0-ballot@199'
@@ -38,7 +39,7 @@ module DaVinciCRDTestKit
38
39
  input :cds_jwt_iss,
39
40
  title: 'CRD JWT Issuer',
40
41
  description: %(
41
- Value of the `iss` claim that will be sent in the JWT used to authorize the client's hook
42
+ Value of the `iss` claim that will be sent in the JWT used to authorize the CRD client's hook
42
43
  request sent as the Bearer token in the `Authorization` header.
43
44
  This value will be used to associate incoming requests with this test
44
45
  session and any requests that use a different `iss` value will not be recognized.
@@ -47,34 +48,19 @@ module DaVinciCRDTestKit
47
48
  input :cds_jwk_set,
48
49
  title: 'CRD JSON Web Key Set (JWKS)',
49
50
  type: 'textarea',
50
- description: %(
51
- The CRD client's JWK Set containing it's public key. May be either
52
- a publicly accessible url containing the JWKS, or the raw JWKS.
53
- The client suite may be run without this input, but it is required
54
- for the tests to pass.
55
- ),
51
+ description: ClientInputHelper.registration_cds_jwk_set_description,
56
52
  optional: true
57
53
  input :complete_prefetch_service_organization_id,
58
54
  title: 'Complete Prefetch Service Organization id',
59
- description: %(
60
- The FHIR Organization id associated with Inferno's simulated
61
- complete prefetch CRD server. This Organization must be referenced as the
62
- payer on Coverages in hook requests made to services described by the
63
- `#{ClientURLs.discovery_url}` discovery endpoint.
64
- The client suite may be run without this input, but it is required
65
- for the tests to pass.
55
+ description: ClientInputHelper.service_organization_id_description(
56
+ 'complete', ClientURLs.discovery_url
66
57
  ),
67
58
  type: 'text',
68
59
  optional: true
69
60
  input :subset_prefetch_service_organization_id,
70
61
  title: 'Subset Prefetch Service Organization id',
71
- description: %(
72
- The FHIR Organization id associated with Inferno's simulated
73
- subset prefetch CRD server. This Organization must be referenced
74
- payer on Coverages in hook requests made to services described by the
75
- `#{ClientURLs.prefetch_subset_discovery_url}` discovery endpoint.
76
- The client suite may be run without this input, but it is required
77
- for the tests to pass.
62
+ description: ClientInputHelper.service_organization_id_description(
63
+ 'subset', ClientURLs.prefetch_subset_discovery_url
78
64
  ),
79
65
  type: 'text',
80
66
  optional: true
@@ -133,7 +119,7 @@ module DaVinciCRDTestKit
133
119
  begin
134
120
  JSON.parse(retrieved.body)
135
121
  rescue JSON::ParserError
136
- warning_messages << "Failed to fetch valid json from jwks uri #{jku}."
122
+ warning_messages << "Failed to fetch valid JSON from JWKS URL #{jku}."
137
123
  nil
138
124
  end
139
125
  else
@@ -147,7 +133,7 @@ module DaVinciCRDTestKit
147
133
  begin
148
134
  JWT::JWK.new(key_hash)
149
135
  rescue JWT::JWKError => e
150
- id = key_hash['kid'] | index
136
+ id = key_hash['kid'] || index
151
137
  warning_messages << "Key #{id} invalid: #{e}"
152
138
  nil
153
139
  end
@@ -1,50 +1,57 @@
1
+ require_relative '../../client_wait_messages'
2
+ require_relative '../../client_input_helper'
3
+
1
4
  module DaVinciCRDTestKit
2
5
  module V221
3
6
  class CRDClientServiceRegistrationAttestation < Inferno::Test
4
7
  include ClientURLs
8
+ include DaVinciCRDTestKit::ClientWaitMessages
5
9
 
6
10
  id :crd_v221_client_service_registration_attestation
7
- title 'CRD client registers Inferno'
11
+ title "CRD client registers Inferno's simulated CRD servers"
8
12
  description %(
9
13
  Inferno simulates two CRD servers which can be discovered at the following endpoints:
10
- - Complete Prefetch Service Discovery Endpoint: #{ClientURLs.discovery_url}
11
- - Subset Prefetch Service Discovery Endpoint: #{ClientURLs.prefetch_subset_discovery_url}
14
+ - Complete Prefetch Services Discovery Endpoint: #{ClientURLs.discovery_url}
15
+ - Subset Prefetch Services Discovery Endpoint: #{ClientURLs.prefetch_subset_discovery_url}
12
16
 
13
- During this test, the tester will confirm that these two endpoints
14
- have been registered by the client as trusted CRD servers that can access the CRD client's
17
+ During this test, the tester will confirm that these two discovery endpoints
18
+ have been registered by the CRD client as trusted CRD servers that can access the CRD client's
15
19
  FHIR server and that they have each been
16
20
  - Associated with a particular payer organization (used to check that the
17
- hook requests are sent by the client system to the appropriate payers based on
21
+ hook requests are sent by the CRD client to the appropriate payers based on
18
22
  the Patient's coverage).
19
23
  - Granted patient- or user-level read and search access to all US Core resource
20
- types in the selected US Core version (required to verify the client's support
24
+ types in the selected US Core version (required to verify the CRD client's support
21
25
  of the US Core FHIR API and used to verify the `fhirAuthorization.scope`
22
26
  hook request field).
27
+
28
+ Testers can make hook requests during this test, but Inferno will never return
29
+ a successful response while waiting here as hook requests are tested during other steps.
30
+ Typical error responses include:
31
+ - HTTP 422 (*Unprocessable Content*) - indicates that connectivity succeeded: Inferno recognized
32
+ the request and associated it with this session, but will not return successful hook responses
33
+ during this test.
34
+ - HTTP 500 (*Internal Server Error*) - indicates that connectivity failed: Inferno was not able
35
+ to associate the request with this session.
23
36
  )
24
- attestation
37
+ flag_as_attestation
38
+ flag_as_tester_initiated_exchange
25
39
  verifies_requirements 'cds-hooks_3.0.0-ballot@174'
26
40
 
41
+ config options: { hook_requests_unavailable: true }
42
+
43
+ input :cds_jwt_iss
27
44
  input :complete_prefetch_service_organization_id,
28
45
  title: 'Complete Prefetch Service Organization id',
29
- description: %(
30
- The FHIR Organization id associated with Inferno's simulated
31
- complete prefetch CRD server. This Organization must be referenced as the
32
- payer on Coverages in hook requests made to services described by the
33
- `#{ClientURLs.discovery_url}` discovery endpoint.
34
- The client suite may be run without this input, but it is required
35
- for the tests to pass.
46
+ description: ClientInputHelper.service_organization_id_description(
47
+ 'complete', ClientURLs.discovery_url
36
48
  ),
37
49
  type: 'text',
38
50
  optional: true
39
51
  input :subset_prefetch_service_organization_id,
40
52
  title: 'Subset Prefetch Service Organization id',
41
- description: %(
42
- The FHIR Organization id associated with Inferno's simulated
43
- subset prefetch CRD server. This Organization must be referenced
44
- payer on Coverages in hook requests made to services described by the
45
- `#{ClientURLs.prefetch_subset_discovery_url}` discovery endpoint.
46
- The client suite may be run without this input, but it is required
47
- for the tests to pass.
53
+ description: ClientInputHelper.service_organization_id_description(
54
+ 'subset', ClientURLs.prefetch_subset_discovery_url
48
55
  ),
49
56
  type: 'text',
50
57
  optional: true
@@ -71,35 +78,73 @@ module DaVinciCRDTestKit
71
78
  end.join('`, `')
72
79
  end
73
80
 
81
+ def service_configuration_message(discovery_url, payer_id)
82
+ <<~MESSAGE
83
+ - **Discovery Endpoint**: `#{discovery_url}`
84
+ - **Associated Payer**: #{payer_message(payer_id)}
85
+ - **Access Scope**: Inferno has been granted patient- or user-level read and search access scopes for
86
+ all US Core #{us_core_version} profiled resource types (`#{us_core_version_resource_types}`).
87
+ MESSAGE
88
+ end
89
+
90
+ def payer_message(payer_id)
91
+ if payer_id.present?
92
+ 'The CRD client will invoke these CRD services for patients with a coverage issued by ' \
93
+ "the payer represented by `Organization/#{payer_id}`."
94
+ else
95
+ 'Not configured.'
96
+ end
97
+ end
98
+
74
99
  run do
75
- identifier = SecureRandom.hex(32)
76
- attest_true_url = "#{resume_pass_url}?token=#{identifier}"
77
- attest_false_url = "#{resume_fail_url}?token=#{identifier}"
100
+ identifier = cds_jwt_iss
101
+ attest_true_url = resume_pass_url_for(identifier)
102
+ attest_false_url = resume_fail_url_for(identifier)
78
103
  output(attest_true_url:)
79
104
  output(attest_false_url:)
80
105
  wait(
81
106
  identifier:,
82
107
  message: <<~MESSAGE
83
- **Registration of Inferno as a trusted CRD server**:
108
+ #### Register Inferno's CRD Servers
84
109
 
85
- I attest that the following Inferno CRD servers have been registered as trusted
86
- within the client system:
110
+ Set up the CRD client to connect to and trust Inferno's CRD servers
111
+ and their services using the information below. Test connectivity
112
+ if desired and then respond to the following statement as appropriate:
87
113
 
88
- - Complete Prefetch Service Discovery Endpoint: `#{discovery_url}`
89
- - Services on this CRD server will be invoked for patients with a primary coverage issued by the payer
90
- represented by the Organization resource with id `#{complete_prefetch_service_organization_id}`.
91
- - The CRD server has been granted patient- or user-level read and search access scopes for
92
- all US Core #{us_core_version} profiled resource types (`#{us_core_version_resource_types}`).
93
-
94
- - Subset Prefetch Service Discovery Endpoint: `#{prefetch_subset_discovery_url}`
95
- - Services on this CRD server will be invoked for patients with a primary coverage issued by the payer
96
- represented by the Organization resource with id `#{subset_prefetch_service_organization_id}`.
97
- - The CRD server has been granted patient- or user-level read and search access scopes for
98
- all US Core #{us_core_version} profiled resource types (`#{us_core_version_resource_types}`).
114
+ I attest that Inferno's CRD servers have been registered as trusted
115
+ within the CRD client and granted the access described below.
99
116
 
100
117
  [Click here](#{attest_true_url}) if the above statement is **true**.
101
118
 
102
119
  [Click here](#{attest_false_url}) if the above statement is **false**.
120
+
121
+ #### Trusted Endpoints Configuration
122
+
123
+ *Complete Prefetch Services*:
124
+
125
+ #{service_configuration_message(discovery_url, complete_prefetch_service_organization_id)}
126
+
127
+ *Subset Prefetch Services*:
128
+
129
+ #{service_configuration_message(prefetch_subset_discovery_url, subset_prefetch_service_organization_id)}
130
+
131
+ #### Testing Connectivity
132
+
133
+ Testers are not required to make hook requests during this test.
134
+ However, testers may do so in order to confirm connectivity if desired.
135
+
136
+ *Authentication and Identification*
137
+
138
+ #{session_identification_message}
139
+
140
+ *Responses*
141
+
142
+ During this test, Inferno will always respond with an error to hook requests
143
+ but the details of the error will indicate whether connectivity was successful:
144
+ - HTTP 422 (*Unprocessable Content*) - indicates that connectivity succeeded:
145
+ Inferno recognized the request and associated it with this session.
146
+ - HTTP 500 (*Internal Server Error*) - indicates that connectivity failed:
147
+ Inferno was not able to associate the request with this session.
103
148
  MESSAGE
104
149
  )
105
150
  end