davinci_crd_test_kit 0.14.1 → 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.
- checksums.yaml +4 -4
- data/config/presets/{inferno_crd_server_suite.json.erb → client_against_inferno_crd_server_suite.json.erb} +0 -33
- data/config/presets/{ri_crd_request_generator.json.erb → client_against_ri_crd_request_generator.json.erb} +1 -14
- data/config/presets/client_v221_against_inferno_crd_server_suite.json.erb +96 -0
- data/config/presets/client_v221_against_ri_br_provider.json.erb +31 -0
- data/config/presets/{ri_crd_request_generator.json_v221.json.erb → client_v221_against_ri_crd_request_generator.json.erb} +1 -1
- data/config/presets/{inferno_crd_client_suite.json.erb → server_against_inferno_crd_client_suite.json.erb} +0 -43
- data/config/presets/{ri_crd_server.json.erb → server_against_ri_crd_server.json.erb} +1 -44
- data/config/presets/{inferno_crd_client_suite_v221.json.erb → server_v221_against_inferno_crd_client_suite.json.erb} +1 -62
- data/config/presets/{inferno_crd_client_suite_prefetch_subset_v221.json.erb → server_v221_against_inferno_crd_client_suite_prefetch_subset.json.erb} +1 -47
- data/config/presets/server_v221_against_inferno_g31_suite.json.erb +49 -0
- data/lib/davinci_crd_test_kit/client/client_base_urls.rb +5 -0
- data/lib/davinci_crd_test_kit/client/client_input_helper.rb +102 -0
- data/lib/davinci_crd_test_kit/client/client_wait_messages.rb +68 -0
- data/lib/davinci_crd_test_kit/client/cross_hook_helper.rb +26 -0
- data/lib/davinci_crd_test_kit/client/endpoints/custom_service_response.rb +32 -17
- data/lib/davinci_crd_test_kit/client/endpoints/hook_request_data_access.rb +228 -0
- data/lib/davinci_crd_test_kit/client/endpoints/hook_request_endpoint.rb +172 -56
- data/lib/davinci_crd_test_kit/client/endpoints/mock_service_response.rb +29 -29
- data/lib/davinci_crd_test_kit/client/endpoints/scenario_service_response.rb +54 -0
- data/lib/davinci_crd_test_kit/client/endpoints/v201_hook_request_data_gathering.rb +219 -0
- data/lib/davinci_crd_test_kit/client/endpoints/v221_hook_request_data_gathering.rb +172 -0
- data/lib/davinci_crd_test_kit/client/jwt_claim_types.rb +28 -0
- data/lib/davinci_crd_test_kit/client/multi_request_message_helper.rb +1 -1
- data/lib/davinci_crd_test_kit/client/prefetched_coverage_payer_helper.rb +81 -0
- data/lib/davinci_crd_test_kit/client/prefetched_coverage_value.rb +14 -0
- data/lib/davinci_crd_test_kit/client/tagged_request_load_helper.rb +14 -25
- data/lib/davinci_crd_test_kit/client/v2.0.1/auth/retrieve_jwks_test.rb +36 -24
- data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_header_test.rb +14 -4
- data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_payload_test.rb +42 -22
- data/lib/davinci_crd_test_kit/client/v2.0.1/cds-services-v201.json +21 -21
- data/lib/davinci_crd_test_kit/client/v2.0.1/client_appointment_book_group.rb +12 -10
- data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_discharge_group.rb +12 -10
- data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_start_group.rb +12 -10
- data/lib/davinci_crd_test_kit/client/v2.0.1/client_fhir_api_group.rb +2 -2
- data/lib/davinci_crd_test_kit/client/v2.0.1/client_hooks_group.rb +7 -10
- data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_dispatch_group.rb +12 -10
- data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_select_group.rb +12 -10
- data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_sign_group.rb +12 -10
- data/lib/davinci_crd_test_kit/client/v2.0.1/crd_client_suite.rb +2 -2
- data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/appointment_book_receive_request_test.rb +10 -31
- data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/encounter_discharge_receive_request_test.rb +10 -31
- data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/encounter_start_receive_request_test.rb +8 -29
- data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_dispatch_receive_request_test.rb +10 -31
- data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_select_receive_request_test.rb +8 -29
- data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_sign_receive_request_test.rb +10 -31
- data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_coverage_information.rb +3 -36
- data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_external_reference.rb +3 -36
- data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_instructions.rb +3 -36
- data/lib/davinci_crd_test_kit/client/v2.0.1/registration/client_registration_verification_test.rb +3 -7
- data/lib/davinci_crd_test_kit/client/v2.0.1/registration/client_service_registration_attestation_test.rb +11 -3
- data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_fetched_data_test.rb +4 -13
- data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_optional_fields_test.rb +1 -1
- data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_prefetch_equals_queried_test.rb +3 -13
- data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/client_display_cards_attest.rb +7 -17
- data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/inferno_response_validation.rb +4 -14
- data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_coverage_info_update_test.rb +10 -10
- data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_crd_update_verification_group.rb +1 -1
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/attestation_instructions.rb +10 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_coverage_based_invocation_attestation_test.rb +44 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_data_element_expectations_attestation_test.rb +44 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_hook_invocation_logging_attestation_test.rb +43 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_use_attestation_test.rb +41 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_prefetch_key_omission_attestation_test.rb +43 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_resource_identifiers_attestation_test.rb +43 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_response_case_distinction_attestation_test.rb +43 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_security_and_privacy_attestation_test.rb +43 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_workflow_integration_attestation_test.rb +44 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/auth/decode_auth_token_test.rb +4 -2
- data/lib/davinci_crd_test_kit/client/v2.2.1/auth/retrieve_jwks_test.rb +47 -26
- data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_header_test.rb +32 -6
- data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_payload_test.rb +60 -33
- data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-prefetch-subset-v221.json +48 -48
- data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-v221.json +51 -51
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +24 -15
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_attestations_group.rb +43 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_group.rb +28 -9
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_interaction_group.rb +106 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +20 -11
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +20 -11
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_fhir_api_group.rb +39 -15
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +16 -19
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +5 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_multiple_payers_hook_group.rb +40 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_dispatch_group.rb +23 -14
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +19 -10
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +23 -14
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_registration_group.rb +7 -7
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_scenarios_group.rb +32 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_self_pay_hook_group.rb +34 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_unknown_content_hook_group.rb +34 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_user_access_level_group.rb +82 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/crd_client_suite.rb +26 -6
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_card_must_support_coverage_information_test.rb +5 -5
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_fhirpath_collection_as_comma_delimited_string_test.rb +7 -14
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_hook_instances_unique_test.rb +3 -11
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_jwt_ids_unique_test.rb +89 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_location_address_propagation_test.rb +65 -31
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_order_types_signed_test.rb +101 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_prefetch_complete_and_subset_test.rb +13 -35
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/appointment_book_receive_request_test.rb +17 -116
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/base_hook_invocation_receive_request_test.rb +182 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/cross_hooks_receive_request_test.rb +126 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_discharge_receive_request_test.rb +17 -117
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_start_receive_request_test.rb +17 -117
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_dispatch_receive_request_test.rb +17 -125
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_select_receive_request_test.rb +17 -125
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_sign_receive_request_test.rb +17 -125
- data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_long_running_receive_request_test.rb +52 -32
- data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +12 -12
- data/lib/davinci_crd_test_kit/client/v2.2.1/multiple_payers/client_multiple_payers_request_verification_test.rb +215 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/multiple_payers/client_multiple_payers_workflow_test.rb +71 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/appointment_must_support_test.rb +84 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/appointment_reference_resolution_test.rb +82 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/client_cross_hook_must_support_group.rb +181 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/communication_request_must_support_test.rb +69 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/communication_request_reference_resolution_test.rb +79 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/coverage_must_support_test.rb +73 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/coverage_reference_resolution_test.rb +67 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_must_support_test.rb +59 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_request_must_support_test.rb +72 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_request_reference_resolution_test.rb +76 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/encounter_must_support_test.rb +83 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/encounter_reference_resolution_test.rb +76 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/location_must_support_test.rb +63 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/location_reference_resolution_test.rb +60 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_must_support_test.rb +54 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_request_must_support_test.rb +95 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_request_reference_resolution_test.rb +79 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/nutrition_order_must_support_test.rb +136 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/nutrition_order_reference_resolution_test.rb +67 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/organization_must_support_test.rb +66 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/organization_reference_resolution_test.rb +60 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/patient_must_support_test.rb +69 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_must_support_test.rb +65 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_role_must_support_test.rb +60 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_role_reference_resolution_test.rb +66 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/service_request_must_support_test.rb +93 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/service_request_reference_resolution_test.rb +81 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/vision_prescription_must_support_test.rb +79 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/vision_prescription_reference_resolution_test.rb +65 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_reference_resolution.rb +379 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_scope.rb +66 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_with_attestation_option.rb +331 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_registration_verification_test.rb +16 -30
- data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_service_registration_attestation_test.rb +84 -39
- data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_workflow_test.rb +62 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_attestation_test.rb +99 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_receive_request_test.rb +67 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_api_access_test.rb +124 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_prefetch_scope_test.rb +85 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_receive_request_test.rb +92 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_same_scenario_test.rb +340 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_target_reference.rb +16 -0
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_conformance_test.rb +64 -7
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb +31 -73
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_data_fetch_verification_test.rb +13 -3
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_granted_scopes_test.rb +8 -8
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +12 -14
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_profiles_test.rb +3 -3
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_requested_version_test.rb +17 -5
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_secured_transport_test.rb +2 -2
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +59 -27
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/hook_response_support_coverage_information_test.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/inferno_response_validation.rb +13 -11
- data/lib/davinci_crd_test_kit/cross_suite/base_urls.rb +12 -0
- data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +18 -2
- data/lib/davinci_crd_test_kit/cross_suite/fhirpath_on_cds_request.rb +10 -9
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/appointment_with_order/metadata.yml +67 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/appointment_without_order/metadata.yml +150 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/communication_request/metadata.yml +71 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/coverage/metadata.yml +71 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/device/metadata.yml +22 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/device_request/metadata.yml +85 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/encounter/metadata.yml +82 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/hrex_organization/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/location/metadata.yml +27 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/medication/metadata.yml +17 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/medication_request/metadata.yml +166 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/nutrition_order/metadata.yml +166 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/organization/metadata.yml +42 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/patient/metadata.yml +29 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/practitioner/metadata.yml +37 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/practitioner_role/metadata.yml +36 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/service_request/metadata.yml +202 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_allergyintolerance/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_condition_encounter_diagnosis/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_condition_problems_health_concerns/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_diagnosticreport_lab/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_diagnosticreport_note/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_documentreference/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_location/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_organization/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_patient/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_practitioner/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_procedure/metadata.yml +6 -0
- data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/vision_prescription/metadata.yml +66 -0
- data/lib/davinci_crd_test_kit/cross_suite/hook_request_field_validation.rb +3 -2
- data/lib/davinci_crd_test_kit/cross_suite/hook_request_resource_extraction.rb +121 -0
- data/lib/davinci_crd_test_kit/cross_suite/logical_models_override_helper.rb +47 -22
- data/lib/davinci_crd_test_kit/cross_suite/must_support_references.rb +49 -0
- data/lib/davinci_crd_test_kit/cross_suite/must_support_slice_matching.rb +50 -0
- data/lib/davinci_crd_test_kit/cross_suite/prefetch_completeness_checker.rb +75 -39
- data/lib/davinci_crd_test_kit/cross_suite/prefetch_profile_validation.rb +2 -0
- data/lib/davinci_crd_test_kit/cross_suite/profile_metadata.rb +75 -0
- data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +45 -36
- data/lib/davinci_crd_test_kit/cross_suite/resource_identity.rb +183 -0
- data/lib/davinci_crd_test_kit/cross_suite/response_logical_model_validation.rb +48 -41
- data/lib/davinci_crd_test_kit/cross_suite/short_circuit_interaction.rb +28 -0
- data/lib/davinci_crd_test_kit/cross_suite/tags.rb +18 -1
- data/lib/davinci_crd_test_kit/generator/crd_must_support_metadata_extractor.rb +147 -0
- data/lib/davinci_crd_test_kit/generator/must_support_metadata_generator.rb +207 -0
- data/lib/davinci_crd_test_kit/generator/must_support_test_generator.rb +249 -0
- data/lib/davinci_crd_test_kit/generator/templates/must_support_group.rb.erb +118 -0
- data/lib/davinci_crd_test_kit/generator/templates/must_support_test.rb.erb +22 -0
- data/lib/davinci_crd_test_kit/generator/templates/reference_resolution_test.rb.erb +22 -0
- data/lib/davinci_crd_test_kit/igs/davinci_crd_2.2.1.tgz +0 -0
- data/lib/davinci_crd_test_kit/igs/davinci_hrex_1.2.0.tgz +0 -0
- data/lib/davinci_crd_test_kit/metadata.rb +2 -2
- data/lib/davinci_crd_test_kit/requirements/cds-hooks_3.0.0-ballot_requirements.xlsx +0 -0
- data/lib/davinci_crd_test_kit/requirements/davinci_crd_test_kit_requirements.csv +9 -4
- data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +107 -107
- data/lib/davinci_crd_test_kit/requirements/generated/crd_client_v221_requirements_coverage.csv +107 -102
- data/lib/davinci_crd_test_kit/requirements/generated/crd_server_requirements_coverage.csv +18 -18
- data/lib/davinci_crd_test_kit/requirements/generated/crd_server_v221_requirements_coverage.csv +36 -32
- data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.2.1_requirements.xlsx +0 -0
- data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_create_endpoint.rb +2 -0
- data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_delete_endpoint.rb +2 -0
- data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_read_endpoint.rb +2 -0
- data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_request_handler.rb +6 -0
- data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_search_endpoint.rb +21 -12
- data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_update_endpoint.rb +2 -0
- data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr_endpoints.rb +3 -0
- data/lib/davinci_crd_test_kit/server/server_abstract_invoke_hook_test.rb +2 -2
- data/lib/davinci_crd_test_kit/server/v2.0.1/crd_server_suite.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.0.1/server_hooks_group.rb +5 -5
- data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_standard_prefetch_expressions_test.rb +1 -2
- data/lib/davinci_crd_test_kit/server/v2.2.1/must_support/supported_us_core_versions_test.rb +2 -2
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_appointment_book_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_demonstrate_hook_response_group.rb +3 -3
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_discharge_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_start_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_hooks_group.rb +5 -5
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_dispatch_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_select_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_sign_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/server_required_card_response_validation_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/coverage_not_found_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_active_coverage_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_member_found_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/technical_issues_group.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_context_validation_test.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_no_custom_extensions_test.rb +2 -2
- data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_optional_fields_validation_test.rb +1 -1
- data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_required_fields_validation_test.rb +1 -1
- data/lib/davinci_crd_test_kit/version.rb +2 -2
- metadata +132 -16
- data/config/presets/inferno_crd_server_suite_v221.json.erb +0 -94
- data/lib/davinci_crd_test_kit/client/endpoints/gather_response_generation_data.rb +0 -410
- data/lib/davinci_crd_test_kit/server/resource_extractor.rb +0 -68
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require_relative '../request_must_support_reference_resolution'
|
|
2
|
+
|
|
3
|
+
module DaVinciCRDTestKit
|
|
4
|
+
module V221
|
|
5
|
+
class VisionPrescriptionReferenceResolutionTest < RequestMustSupportReferenceResolution
|
|
6
|
+
id :crd_v221_vision_prescription_must_support_reference_resolution
|
|
7
|
+
title 'CRD Vision Prescription must support references resolve'
|
|
8
|
+
description <<~DESCRIPTION
|
|
9
|
+
The CRD IG [requires](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/conformance.html#ci-c-conf-3)
|
|
10
|
+
that when a client "maintains a mustSupport data element and surfaces it to users, then it
|
|
11
|
+
SHALL be exposed in their FHIR interface when the data exists and privacy constraints permit."
|
|
12
|
+
For a must support Reference element, this means that the referenced resource can be retrieved.
|
|
13
|
+
Additionally, when some of the element's target profiles are themselves marked must support
|
|
14
|
+
or the element has only one target profile, references to resources conforming to each of
|
|
15
|
+
those profiles must be observed. Otherwise, a referenced resource must conform to any one of
|
|
16
|
+
the element's target profiles.
|
|
17
|
+
|
|
18
|
+
During this test, Inferno will verify that for each must support Reference element listed
|
|
19
|
+
below that was populated, at least one of its references resolved to a resource
|
|
20
|
+
conforming to each target profile listed for the element, or to any one of them where the
|
|
21
|
+
list says so. Target profiles for resource types the tester indicated that the CRD client does
|
|
22
|
+
not support are not checked. The test will skip if Inferno does not observe all of the
|
|
23
|
+
required references, indicating that additional data is needed to demonstrate conformance.
|
|
24
|
+
|
|
25
|
+
Inferno will look at references found in resources in the same hook requests as the must support
|
|
26
|
+
element tests: those made during the latest run of each "Hooks" subgroup and the "Additional Hook
|
|
27
|
+
Invocations" group. If no instances of the tested resource type were observed, the test skips
|
|
28
|
+
unless the tester indicated that the CRD client does not support the resource type.
|
|
29
|
+
|
|
30
|
+
Inferno obtains the reference targets during the hook request by performing FHIR reads of
|
|
31
|
+
referenced resources whose absolute URL can be determined and that are not already present
|
|
32
|
+
in the `context` or `prefetch` fields of the hook request. See the wiki's documentation
|
|
33
|
+
on [reference resolution within hook requests](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Prefetch-Verification#reference-resolution-within-hook-requests)
|
|
34
|
+
and [simulated CRD server behavior](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Details#prefetch-and-additional-data-retrieval)
|
|
35
|
+
for details on how Inferno identifies and obtains these resources.
|
|
36
|
+
|
|
37
|
+
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)
|
|
38
|
+
page and specifically the [Must Support References](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Must-Support#must-support-references)
|
|
39
|
+
section in the CRD Test Kit wiki.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### CRD Vision Prescription
|
|
43
|
+
|
|
44
|
+
- `encounter`
|
|
45
|
+
- [CRD Encounter](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/StructureDefinition-profile-encounter.html)
|
|
46
|
+
- `patient`
|
|
47
|
+
- [CRD Patient](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/StructureDefinition-profile-patient.html)
|
|
48
|
+
- `prescriber`
|
|
49
|
+
- [CRD Practitioner](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/StructureDefinition-profile-practitioner.html)
|
|
50
|
+
- [HRex PractitionerRole Profile](https://hl7.org/fhir/us/davinci-hrex/1.2.0/StructureDefinition-hrex-practitionerrole.html)
|
|
51
|
+
DESCRIPTION
|
|
52
|
+
|
|
53
|
+
verifies_requirements 'hl7.fhir.us.davinci-crd_2.2.1@conf-3'
|
|
54
|
+
|
|
55
|
+
config(
|
|
56
|
+
options: {
|
|
57
|
+
ig_version: 'v2.2.1',
|
|
58
|
+
profiles: [
|
|
59
|
+
{ resource_type: 'VisionPrescription', profile_keys: ['vision_prescription'] }
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
require_relative '../../../cross_suite/hook_request_resource_extraction'
|
|
2
|
+
require_relative '../../../cross_suite/must_support_references'
|
|
3
|
+
require_relative '../../../cross_suite/profile_metadata'
|
|
4
|
+
require_relative '../../../cross_suite/resource_identity'
|
|
5
|
+
require_relative '../../../cross_suite/tags'
|
|
6
|
+
require_relative 'request_must_support_scope'
|
|
7
|
+
|
|
8
|
+
module DaVinciCRDTestKit
|
|
9
|
+
module V221
|
|
10
|
+
# Checks that the references held in the must support Reference elements of a CRD profile resolve
|
|
11
|
+
# to resources conforming to the profiles the element targets. A CRD server can only read the
|
|
12
|
+
# CRD client's FHIR server while a hook request is in progress, so the referenced resources are
|
|
13
|
+
# read by the hook request endpoint as each request arrives, and this test works from what was
|
|
14
|
+
# read then.
|
|
15
|
+
class RequestMustSupportReferenceResolution < Inferno::Test
|
|
16
|
+
include HookRequestResourceExtraction
|
|
17
|
+
include RequestMustSupportScope
|
|
18
|
+
|
|
19
|
+
id :crd_v221_request_must_support_reference_resolution
|
|
20
|
+
|
|
21
|
+
# The FHIR version the CRD IG is built on, which base FHIR resource definitions belong to.
|
|
22
|
+
FHIR_VERSION = '4.0.1'.freeze
|
|
23
|
+
|
|
24
|
+
# Where the pages of each IG version that target profiles come from are published, keyed by
|
|
25
|
+
# the IG's canonical base and the profile version. The published paths do not follow a single
|
|
26
|
+
# pattern (US Core 7.0.0 lives under STU7), so they are listed explicitly.
|
|
27
|
+
PROFILE_PAGE_BASES = {
|
|
28
|
+
['http://hl7.org/fhir/us/davinci-crd', '2.2.1'] => 'https://hl7.org/fhir/us/davinci-crd/2.2.1/en',
|
|
29
|
+
['http://hl7.org/fhir/us/davinci-hrex', '1.2.0'] => 'https://hl7.org/fhir/us/davinci-hrex/1.2.0',
|
|
30
|
+
['http://hl7.org/fhir/us/core', '7.0.0'] => 'https://hl7.org/fhir/us/core/STU7'
|
|
31
|
+
}.freeze
|
|
32
|
+
|
|
33
|
+
# The type matters: Inferno parses a checkbox input's stored JSON into an array, and without
|
|
34
|
+
# it the raw string arrives instead.
|
|
35
|
+
input :order_types_supported, optional: true, type: 'checkbox'
|
|
36
|
+
input :supporting_types_supported, optional: true, type: 'checkbox'
|
|
37
|
+
|
|
38
|
+
class << self
|
|
39
|
+
def build_description(options)
|
|
40
|
+
sections = options[:profiles].map do |profile|
|
|
41
|
+
metadata = metadata_for(options[:ig_version], profile)
|
|
42
|
+
"### #{title_for(metadata, profile)}\n\n#{reference_list(options[:ig_version], metadata)}"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
"#{description_intro}\n\n#{sections.join("\n\n")}"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Each element, with the target profiles it must be demonstrated for as a sublist beneath it,
|
|
49
|
+
# or the target profiles any one of which will do.
|
|
50
|
+
def reference_list(ig_version, metadata)
|
|
51
|
+
MustSupportReferences.reference_elements(metadata).map do |element|
|
|
52
|
+
required = Array(element[:target_profiles])
|
|
53
|
+
targets = required.presence || Array(element[:allowed_target_profiles])
|
|
54
|
+
heading = "- `#{element[:path]}`#{', any one of:' if required.blank? && targets.length > 1}"
|
|
55
|
+
lines = targets.map { |target_profile| " - #{target_profile_link(ig_version, target_profile)}" }
|
|
56
|
+
[heading, *lines].join("\n")
|
|
57
|
+
end.join("\n")
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# The target profile's name, linked to its page in the published IG. A base FHIR resource
|
|
61
|
+
# definition links to the resource's page in the FHIR specification, and a profile whose IG
|
|
62
|
+
# version has no known page location is linked by its canonical URL instead.
|
|
63
|
+
def target_profile_link(ig_version, target_profile)
|
|
64
|
+
base_type = MustSupportReferences.base_resource_type(target_profile)
|
|
65
|
+
return "[#{base_type}](https://hl7.org/fhir/R4/#{base_type.downcase}.html)" if base_type.present?
|
|
66
|
+
|
|
67
|
+
target_metadata = ProfileMetadata.for_profile_url(ig_version, target_profile)
|
|
68
|
+
url = target_profile.split('|').first
|
|
69
|
+
return "[#{url}](#{url})" if target_metadata.blank?
|
|
70
|
+
|
|
71
|
+
base, id = url.split('/StructureDefinition/')
|
|
72
|
+
page_base = PROFILE_PAGE_BASES[[base, target_metadata.profile_version]]
|
|
73
|
+
page = page_base.present? ? "#{page_base}/StructureDefinition-#{id}.html" : url
|
|
74
|
+
"[#{target_metadata.profile_name}](#{page})"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def description_intro
|
|
78
|
+
<<~INTRO
|
|
79
|
+
The CRD IG [requires](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/conformance.html#ci-c-conf-3)
|
|
80
|
+
that when a client "maintains a mustSupport data element and surfaces it to users, then it
|
|
81
|
+
SHALL be exposed in their FHIR interface when the data exists and privacy constraints permit."
|
|
82
|
+
For a must support Reference element, this means that the referenced resource can be retrieved.
|
|
83
|
+
Additionally, when some of the element's target profiles are themselves marked must support
|
|
84
|
+
or the element has only one target profile, references to resources conforming to each of
|
|
85
|
+
those profiles must be observed. Otherwise, a referenced resource must conform to any one of
|
|
86
|
+
the element's target profiles.
|
|
87
|
+
|
|
88
|
+
During this test, Inferno will verify that for each must support Reference element listed
|
|
89
|
+
below that was populated, at least one of its references resolved to a resource
|
|
90
|
+
conforming to each target profile listed for the element, or to any one of them where the
|
|
91
|
+
list says so. Target profiles for resource types the tester indicated that the CRD client does
|
|
92
|
+
not support are not checked. The test will skip if Inferno does not observe all of the
|
|
93
|
+
required references, indicating that additional data is needed to demonstrate conformance.
|
|
94
|
+
|
|
95
|
+
Inferno will look at references found in resources in the same hook requests as the must support
|
|
96
|
+
element tests: those made during the latest run of each "Hooks" subgroup and the "Additional Hook
|
|
97
|
+
Invocations" group. If no instances of the tested resource type were observed, the test skips
|
|
98
|
+
unless the tester indicated that the CRD client does not support the resource type.
|
|
99
|
+
|
|
100
|
+
Inferno obtains the reference targets during the hook request by performing FHIR reads of
|
|
101
|
+
referenced resources whose absolute URL can be determined and that are not already present
|
|
102
|
+
in the `context` or `prefetch` fields of the hook request. See the wiki's documentation
|
|
103
|
+
on [reference resolution within hook requests](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Prefetch-Verification#reference-resolution-within-hook-requests)
|
|
104
|
+
and [simulated CRD server behavior](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Details#prefetch-and-additional-data-retrieval)
|
|
105
|
+
for details on how Inferno identifies and obtains these resources.
|
|
106
|
+
|
|
107
|
+
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)
|
|
108
|
+
page and specifically the [Must Support References](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Must-Support#must-support-references)
|
|
109
|
+
section in the CRD Test Kit wiki.
|
|
110
|
+
INTRO
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def metadata_for(ig_version, profile)
|
|
114
|
+
ProfileMetadata.merged(ig_version, profile[:profile_keys])
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def title_for(metadata, profile)
|
|
118
|
+
profile[:title] || metadata.profile_name
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def ig_version
|
|
123
|
+
config.options[:ig_version]
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Each must support Reference element paired with the profiles a resolved reference may conform
|
|
127
|
+
# to. Every target profile that must be demonstrated is a target of its own; otherwise any one of
|
|
128
|
+
# the element's allowed target profiles will do. An element with neither only has to resolve.
|
|
129
|
+
def reference_targets(metadata)
|
|
130
|
+
MustSupportReferences.reference_elements(metadata).flat_map do |element|
|
|
131
|
+
if element[:target_profiles].present?
|
|
132
|
+
element[:target_profiles].map { |target_profile| { path: element[:path], profiles: [target_profile] } }
|
|
133
|
+
else
|
|
134
|
+
[{ path: element[:path], profiles: Array(element[:allowed_target_profiles]) }]
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def target_type(target_profile)
|
|
140
|
+
MustSupportReferences.base_resource_type(target_profile) ||
|
|
141
|
+
ProfileMetadata.for_profile_url(ig_version, target_profile)&.resource
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# For each hook request, its instances, each with the absolute URL identifying it (see
|
|
145
|
+
# ResourceIdentity) or nil when it has none, and every resource available to resolve references
|
|
146
|
+
# made within it. Every instance's references are checked, but
|
|
147
|
+
# only an identified resource can be the target of a reference, and a relative reference
|
|
148
|
+
# cannot be resolved when the instance holding it has no RESTful identity.
|
|
149
|
+
def hook_request_data
|
|
150
|
+
@hook_request_data ||= must_support_requests.filter_map do |request|
|
|
151
|
+
request_body = parse_request_body(request)
|
|
152
|
+
next unless request_body.is_a?(Hash)
|
|
153
|
+
|
|
154
|
+
instances = request_instances(request_body)
|
|
155
|
+
reads = reads_for(request_body['hookInstance'])
|
|
156
|
+
available = available_from_reads(reads)
|
|
157
|
+
instances.each { |entry| available[entry[:identity]] = entry if entry[:identity].present? }
|
|
158
|
+
{ request:, instances:, available:, reads: }
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# An instance with an identity is only listed once, however many times the request carries it.
|
|
163
|
+
def request_instances(request_body)
|
|
164
|
+
instances = []
|
|
165
|
+
ResourceIdentity.each_resource(request_body) do |identity, raw_resource|
|
|
166
|
+
resource = to_fhir_resource(raw_resource)
|
|
167
|
+
instances << { identity: ResourceIdentity.normalized_url(identity), resource: } if resource.present?
|
|
168
|
+
end
|
|
169
|
+
instances.uniq { |entry| entry[:identity] || entry.object_id }
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# The data fetches made while processing the hook request with the given instance, whether
|
|
173
|
+
# or not they used the access token.
|
|
174
|
+
def reads_for(hook_instance)
|
|
175
|
+
Inferno::Repositories::Requests.new
|
|
176
|
+
.tagged_requests(test_session_id, [TagMethods.hook_instance_data_fetch_tag(hook_instance)])
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def available_from_reads(reads)
|
|
180
|
+
reads.each_with_object({}) do |read, available|
|
|
181
|
+
identified_read_resources(read).each do |identity, resource|
|
|
182
|
+
available[identity] ||= { identity:, resource:, read: }
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# A read resource is identified by the URL it was read from, and only counts when it is the
|
|
188
|
+
# resource that URL names. Search results are identified by their entries' fullUrls, as in any
|
|
189
|
+
# other Bundle.
|
|
190
|
+
def identified_read_resources(read)
|
|
191
|
+
return [] unless read.status.to_s.start_with?('2')
|
|
192
|
+
|
|
193
|
+
resource = FHIR.from_contents(read.response_body.to_s)
|
|
194
|
+
return bundle_identified_resources(resource) if resource.is_a?(FHIR::Bundle)
|
|
195
|
+
|
|
196
|
+
ResourceIdentity.names?(read.url, resource) ? [[ResourceIdentity.normalized_url(read.url), resource]] : []
|
|
197
|
+
rescue JSON::ParserError
|
|
198
|
+
[]
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# every resource in a Bundle is identified by its entry's fullUrl, so no base server is needed
|
|
202
|
+
def bundle_identified_resources(bundle)
|
|
203
|
+
identified = []
|
|
204
|
+
ResourceIdentity.each_identified_within(JSON.parse(bundle.to_json), nil, nil) do |identity, raw|
|
|
205
|
+
identified << [ResourceIdentity.normalized_url(identity), to_fhir_resource(raw)]
|
|
206
|
+
end
|
|
207
|
+
identified
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# The resource a reference resolved to, if any, along with the read made for it, which is
|
|
211
|
+
# attached as evidence for the result. Logical references, and malformed ones that are not
|
|
212
|
+
# strings, cannot be resolved.
|
|
213
|
+
def resolve(reference, entry, request_data)
|
|
214
|
+
return {} unless reference.reference.is_a?(String)
|
|
215
|
+
return resolve_contained(reference, entry[:resource]) if reference.reference.start_with?('#')
|
|
216
|
+
|
|
217
|
+
base = ResourceIdentity.base_for(entry[:identity])
|
|
218
|
+
url = ResourceIdentity.normalized_url(ResourceIdentity.absolute_reference(reference.reference, base))
|
|
219
|
+
return {} if url.blank?
|
|
220
|
+
|
|
221
|
+
request_data[:available][url] ||
|
|
222
|
+
{ read: request_data[:reads].find { |read| ResourceIdentity.normalized_url(read.url) == url } }
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
def resolve_contained(reference, resource)
|
|
226
|
+
contained_id = reference.reference.delete_prefix('#')
|
|
227
|
+
return { resource: } if contained_id.blank?
|
|
228
|
+
|
|
229
|
+
{ resource: Array(resource.contained).find { |one| one.id == contained_id } }.compact
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# Each reference found at the path across every hook request, with what it resolved to.
|
|
233
|
+
def reference_attempts(navigator, resource_type, path)
|
|
234
|
+
hook_request_data.flat_map do |request_data|
|
|
235
|
+
request_data[:instances].select { |entry| entry[:resource].resourceType == resource_type }
|
|
236
|
+
.flat_map do |entry|
|
|
237
|
+
navigator.references(entry[:resource], path).map do |reference|
|
|
238
|
+
resolve(reference, entry, request_data)
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def conforms?(resource, target)
|
|
245
|
+
target[:profiles].blank? || target[:profiles].any? { |target_profile| conforms_to?(resource, target_profile) }
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def conforms_to?(resource, target_profile)
|
|
249
|
+
type = target_type(target_profile)
|
|
250
|
+
return false if type.present? && resource.resourceType != type
|
|
251
|
+
|
|
252
|
+
resource_is_valid?(resource:, profile_url: versioned(target_profile), add_messages_to_runnable: false)
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Target profiles carry a version only when the IG pinned one, typically for profiles from
|
|
256
|
+
# other IGs. Several versions of the CRD, HRex, and US Core IGs can be loaded into the validator
|
|
257
|
+
# at once, so the version of the profile the metadata was generated from is always given, and
|
|
258
|
+
# base FHIR resource definitions get the FHIR version the CRD IG is built on.
|
|
259
|
+
def versioned(target_profile)
|
|
260
|
+
url, version = target_profile.split('|')
|
|
261
|
+
version ||= if MustSupportReferences.base_resource_type(url)
|
|
262
|
+
FHIR_VERSION
|
|
263
|
+
else
|
|
264
|
+
ProfileMetadata.for_profile_url(ig_version, url)&.profile_version
|
|
265
|
+
end
|
|
266
|
+
version.present? ? "#{url}|#{version}" : url
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# The validator is the slow part, so each distinct resolved resource is checked once and the
|
|
270
|
+
# search stops at the first that conforms.
|
|
271
|
+
def target_resolved?(attempts, target)
|
|
272
|
+
attempts.filter_map { |attempt| attempt[:resource] }.uniq(&:to_json)
|
|
273
|
+
.any? { |resource| conforms?(resource, target) }
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def unresolved_targets(profile)
|
|
277
|
+
metadata = self.class.metadata_for(ig_version, profile)
|
|
278
|
+
navigator = MustSupportReferences::Navigator.new(metadata)
|
|
279
|
+
|
|
280
|
+
reference_targets(metadata).filter_map { |target| with_supported_profiles(target) }.filter_map do |target|
|
|
281
|
+
attempts = reference_attempts(navigator, profile[:resource_type], target[:path])
|
|
282
|
+
consulted_reads.concat(attempts.filter_map { |attempt| attempt[:read] })
|
|
283
|
+
next if attempts.blank? || target_resolved?(attempts, target)
|
|
284
|
+
|
|
285
|
+
target
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Drops the target profiles for resource types the tester declared unsupported, or the whole
|
|
290
|
+
# target when none are left.
|
|
291
|
+
def with_supported_profiles(target)
|
|
292
|
+
supported = target[:profiles].reject do |target_profile|
|
|
293
|
+
type = target_type(target_profile)
|
|
294
|
+
type.present? && declared_unsupported?(type)
|
|
295
|
+
end
|
|
296
|
+
return if target[:profiles].present? && supported.blank?
|
|
297
|
+
|
|
298
|
+
target.merge(profiles: supported)
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def relevant_requests
|
|
302
|
+
hook_request_data.filter_map do |request_data|
|
|
303
|
+
carried = request_data[:instances].any? do |entry|
|
|
304
|
+
profile_resource_types.include?(entry[:resource].resourceType)
|
|
305
|
+
end
|
|
306
|
+
request_data[:request] if carried
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# The reads that references from the resource type under test resolved to or failed on, which
|
|
311
|
+
# are attached alongside the hook requests as the evidence for the result.
|
|
312
|
+
def consulted_reads
|
|
313
|
+
@consulted_reads ||= []
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# Counted the same way as for the must support element tests, so the two agree on which types
|
|
317
|
+
# were observed.
|
|
318
|
+
def observed_types
|
|
319
|
+
fhir_resources_by_type(must_support_requests).keys
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
def target_description(target)
|
|
323
|
+
links = target[:profiles].map { |target_profile| target_profile_link(target_profile) }
|
|
324
|
+
return "`#{target[:path]}`" if links.blank?
|
|
325
|
+
return "`#{target[:path]}` using profile #{links.first}" if links.one?
|
|
326
|
+
|
|
327
|
+
"`#{target[:path]}` using any of profiles " \
|
|
328
|
+
"#{links.to_sentence(two_words_connector: ' or ', last_word_connector: ', or ')}"
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def target_profile_link(target_profile)
|
|
332
|
+
self.class.target_profile_link(ig_version, target_profile)
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
# With no instances observed there are no references to check, which is only acceptable when the
|
|
336
|
+
# tester declared the types unsupported, the same as for the must support element tests.
|
|
337
|
+
def check_unobserved_types
|
|
338
|
+
resource_types = profile_resource_types.uniq
|
|
339
|
+
return if (resource_types - observed_types).length < resource_types.length
|
|
340
|
+
|
|
341
|
+
missing = resource_types.select { |resource_type| expected?(resource_type) }
|
|
342
|
+
skip_if missing.present?, missing.map { |resource_type| missing_type_message(resource_type) }.join(' ')
|
|
343
|
+
|
|
344
|
+
pass "No instances of #{resource_types.to_sentence} observed, and none expected: " \
|
|
345
|
+
"#{DECLARED_UNSUPPORTED_REASON}."
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# The relative references held by an instance with no identity, or one identified by a fullUrl
|
|
349
|
+
# that is not a RESTful URL, such as a `urn:uuid:`, cannot be resolved, which may explain why
|
|
350
|
+
# references that would otherwise resolve did not.
|
|
351
|
+
def non_restful_note
|
|
352
|
+
non_restful = hook_request_data.flat_map { |request_data| request_data[:instances] }.any? do |entry|
|
|
353
|
+
profile_resource_types.include?(entry[:resource].resourceType) &&
|
|
354
|
+
ResourceIdentity.base_for(entry[:identity]).blank?
|
|
355
|
+
end
|
|
356
|
+
return unless non_restful
|
|
357
|
+
|
|
358
|
+
' Relative references on some instances were not checked because no base FHIR server could be identified.'
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
run do
|
|
362
|
+
skip_if must_support_requests.blank?, 'No hook requests received.'
|
|
363
|
+
associate_requests(relevant_requests)
|
|
364
|
+
|
|
365
|
+
check_unobserved_types
|
|
366
|
+
|
|
367
|
+
unresolved = config.options[:profiles].flat_map { |profile| unresolved_targets(profile) }
|
|
368
|
+
requests.concat(consulted_reads.uniq(&:id))
|
|
369
|
+
|
|
370
|
+
skip_if unresolved.present?,
|
|
371
|
+
'Could not resolve and validate any must support references for ' \
|
|
372
|
+
"#{unresolved.map { |target| target_description(target) }.to_sentence}.#{non_restful_note}"
|
|
373
|
+
|
|
374
|
+
pass 'At least one reference within each populated must support Reference element resolved to a ' \
|
|
375
|
+
'conforming resource.'
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require_relative '../../../cross_suite/tags'
|
|
2
|
+
|
|
3
|
+
module DaVinciCRDTestKit
|
|
4
|
+
module V221
|
|
5
|
+
# The hook requests the request must support tests look at, and the resource types the tester
|
|
6
|
+
# declared the CRD client supports.
|
|
7
|
+
module RequestMustSupportScope
|
|
8
|
+
DECLARED_UNSUPPORTED_REASON =
|
|
9
|
+
'the tester indicated that the CRD client does not support this resource type'.freeze
|
|
10
|
+
|
|
11
|
+
# Reads the requests directly rather than going through `load_tagged_requests`, which would
|
|
12
|
+
# also associate every cross-invocation request with this test's own result. Only the relevant ones
|
|
13
|
+
# are associated, by `associate_requests`.
|
|
14
|
+
def must_support_requests
|
|
15
|
+
@must_support_requests ||=
|
|
16
|
+
Inferno::Repositories::Requests.new.tagged_requests(test_session_id, [CROSS_HOOK_ANALYSIS_TAG])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def profile_resource_types
|
|
20
|
+
config.options[:profiles].map { |profile| profile[:resource_type] }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Attaches the requests that carried the resource types under test to this test's result so
|
|
24
|
+
# the tester can see what was considered. When none did, every considered request is attached,
|
|
25
|
+
# since together they are the evidence that the types were absent.
|
|
26
|
+
def associate_requests(relevant_requests)
|
|
27
|
+
requests.concat(relevant_requests.presence || must_support_requests)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# nil when the type is required of every CRD client, so no input governs it. A CRD client need not
|
|
31
|
+
# support any order type, so clearing every box means none are expected rather than all.
|
|
32
|
+
def selected_types(resource_type)
|
|
33
|
+
if ClientCrossHookMustSupportGroup::ORDER_TYPE_OPTIONS.any? { |one| one[:value] == resource_type }
|
|
34
|
+
Array(order_types_supported)
|
|
35
|
+
elsif ClientCrossHookMustSupportGroup::SUPPORTING_TYPE_OPTIONS.any? { |one| one[:value] == resource_type }
|
|
36
|
+
Array(supporting_types_supported)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def declared_unsupported?(resource_type)
|
|
41
|
+
selected_types(resource_type)&.exclude?(resource_type) || false
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# A type is expected unless the tester deselected it; a type no input governs is required of
|
|
45
|
+
# every CRD client. Deselecting a type whose hook was invoked is caught separately, by the must
|
|
46
|
+
# support element tests, as a contradiction.
|
|
47
|
+
def expected?(resource_type)
|
|
48
|
+
!declared_unsupported?(resource_type)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def required_of_every_client?(resource_type)
|
|
52
|
+
selected_types(resource_type).nil?
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def missing_type_message(resource_type)
|
|
56
|
+
reason = if required_of_every_client?(resource_type)
|
|
57
|
+
'CRD clients are required to support'
|
|
58
|
+
else
|
|
59
|
+
'The tester indicated the CRD client supports'
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
"#{reason} the `#{resource_type}` resource type, but no instances were observed in the hook requests made."
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|