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.
- checksums.yaml +4 -4
- data/config/presets/client_v221_against_inferno_crd_server_suite.json.erb +13 -1
- data/config/presets/server_v221_against_inferno_crd_client_suite.json.erb +1 -1
- data/config/presets/server_v221_against_inferno_crd_client_suite_prefetch_subset.json.erb +1 -1
- 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/endpoints/custom_service_response.rb +25 -10
- 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 +116 -25
- data/lib/davinci_crd_test_kit/client/endpoints/mock_service_response.rb +5 -24
- data/lib/davinci_crd_test_kit/client/endpoints/scenario_service_response.rb +1 -1
- 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 +8 -0
- data/lib/davinci_crd_test_kit/client/v2.0.1/auth/retrieve_jwks_test.rb +1 -1
- 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 +8 -1
- data/lib/davinci_crd_test_kit/client/v2.0.1/cds-services-v201.json +1 -1
- 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 +2 -5
- 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/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_optional_fields_test.rb +1 -1
- data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/client_display_cards_attest.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/inferno_response_validation.rb +1 -1
- data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_coverage_info_update_test.rb +9 -9
- 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/client_coverage_based_invocation_attestation_test.rb +10 -10
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_data_element_expectations_attestation_test.rb +7 -7
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_hook_invocation_logging_attestation_test.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_use_attestation_test.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_prefetch_key_omission_attestation_test.rb +6 -5
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_resource_identifiers_attestation_test.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_response_case_distinction_attestation_test.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_security_and_privacy_attestation_test.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_workflow_integration_attestation_test.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/auth/decode_auth_token_test.rb +3 -1
- data/lib/davinci_crd_test_kit/client/v2.2.1/auth/retrieve_jwks_test.rb +23 -13
- 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 +25 -11
- data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-prefetch-subset-v221.json +1 -1
- data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-v221.json +1 -1
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +10 -3
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_attestations_group.rb +1 -7
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_group.rb +13 -10
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_interaction_group.rb +12 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +9 -2
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +9 -2
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_fhir_api_group.rb +25 -3
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +7 -10
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +3 -3
- 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 +9 -2
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +8 -1
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +9 -2
- 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 +10 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_self_pay_hook_group.rb +2 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/client_unknown_content_hook_group.rb +3 -3
- 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 +7 -3
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_card_must_support_coverage_information_test.rb +4 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_fhirpath_collection_as_comma_delimited_string_test.rb +3 -3
- data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_hook_instances_unique_test.rb +2 -2
- 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 +59 -29
- 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 +11 -24
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/appointment_book_receive_request_test.rb +9 -27
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/base_hook_invocation_receive_request_test.rb +59 -40
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/cross_hooks_receive_request_test.rb +64 -35
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_discharge_receive_request_test.rb +9 -27
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_start_receive_request_test.rb +9 -27
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_dispatch_receive_request_test.rb +9 -27
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_select_receive_request_test.rb +9 -27
- data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_sign_receive_request_test.rb +9 -27
- data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_long_running_receive_request_test.rb +50 -38
- data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +11 -11
- 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 +27 -20
- data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_attestation_test.rb +7 -7
- data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_receive_request_test.rb +38 -33
- 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 +63 -6
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb +23 -73
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_data_fetch_verification_test.rb +12 -2
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_granted_scopes_test.rb +7 -7
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +11 -13
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_profiles_test.rb +2 -2
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_requested_version_test.rb +16 -4
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_secured_transport_test.rb +1 -1
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +8 -8
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/hook_response_support_coverage_information_test.rb +3 -3
- data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/inferno_response_validation.rb +8 -9
- data/lib/davinci_crd_test_kit/cross_suite/base_urls.rb +12 -0
- data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +9 -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 +17 -9
- 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/profile_metadata.rb +75 -0
- data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +19 -9
- data/lib/davinci_crd_test_kit/cross_suite/resource_identity.rb +183 -0
- data/lib/davinci_crd_test_kit/cross_suite/short_circuit_interaction.rb +28 -0
- data/lib/davinci_crd_test_kit/cross_suite/tags.rb +15 -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/davinci_crd_test_kit_requirements.csv +3 -2
- data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +1 -1
- data/lib/davinci_crd_test_kit/requirements/generated/crd_client_v221_requirements_coverage.csv +90 -89
- 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.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 +1 -1
- 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_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 +100 -12
- data/lib/davinci_crd_test_kit/client/endpoints/gather_response_generation_data.rb +0 -413
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_authorized_scope_attestation_test.rb +0 -45
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_exposure_attestation_test.rb +0 -43
- data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_order_sign_support_attestation_test.rb +0 -42
- data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_no_request_test.rb +0 -30
- data/lib/davinci_crd_test_kit/server/resource_extractor.rb +0 -68
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
require 'inferno/dsl/must_support_metadata_extractor'
|
|
2
|
+
|
|
3
|
+
module DaVinciCRDTestKit
|
|
4
|
+
module Generator
|
|
5
|
+
# Extends the extractor inferno_core provides with the handling CRD's profiles need.
|
|
6
|
+
class CRDMustSupportMetadataExtractor < Inferno::DSL::MustSupportMetadataExtractor
|
|
7
|
+
US_CORE_CATEGORY_SYSTEM = 'http://hl7.org/fhir/us/core/CodeSystem/us-core-category'.freeze
|
|
8
|
+
SNOMED_SYSTEM = 'http://snomed.info/sct'.freeze
|
|
9
|
+
V3_ACT_CODE_SYSTEM = 'http://terminology.hl7.org/CodeSystem/v3-ActCode'.freeze
|
|
10
|
+
MEDICATION_REQUEST_CATEGORY_SYSTEM =
|
|
11
|
+
'http://terminology.hl7.org/CodeSystem/medicationrequest-category'.freeze
|
|
12
|
+
|
|
13
|
+
# Value sets the CRD profiles bind to that are not in the packages Inferno loads, so nothing
|
|
14
|
+
# can resolve them at generation time. This is a short term solution for now, so the concepts are listed
|
|
15
|
+
# here until the packages they live in are available and until inferno-core metadata extractor
|
|
16
|
+
# logic is reworked to handle this better.
|
|
17
|
+
# - https://hl7.org/fhir/us/core/STU7/ValueSet-us-core-servicerequest-category.html
|
|
18
|
+
# - https://terminology.hl7.org/7.1.0/en/ValueSet-v3-ActEncounterCode.html
|
|
19
|
+
# - https://hl7.org/fhir/R4/valueset-medicationrequest-category.html
|
|
20
|
+
UNRESOLVABLE_VALUE_SETS = {
|
|
21
|
+
'http://hl7.org/fhir/us/core/ValueSet/us-core-servicerequest-category' => [
|
|
22
|
+
{ system: US_CORE_CATEGORY_SYSTEM, code: 'sdoh' },
|
|
23
|
+
{ system: US_CORE_CATEGORY_SYSTEM, code: 'functional-status' },
|
|
24
|
+
{ system: US_CORE_CATEGORY_SYSTEM, code: 'disability-status' },
|
|
25
|
+
{ system: US_CORE_CATEGORY_SYSTEM, code: 'cognitive-status' },
|
|
26
|
+
{ system: US_CORE_CATEGORY_SYSTEM, code: 'treatment-intervention-preference' },
|
|
27
|
+
{ system: US_CORE_CATEGORY_SYSTEM, code: 'care-experience-preference' },
|
|
28
|
+
{ system: SNOMED_SYSTEM, code: '386053000' },
|
|
29
|
+
{ system: SNOMED_SYSTEM, code: '410606002' },
|
|
30
|
+
{ system: SNOMED_SYSTEM, code: '108252007' },
|
|
31
|
+
{ system: SNOMED_SYSTEM, code: '363679005' },
|
|
32
|
+
{ system: SNOMED_SYSTEM, code: '409063005' },
|
|
33
|
+
{ system: SNOMED_SYSTEM, code: '409073007' },
|
|
34
|
+
{ system: SNOMED_SYSTEM, code: '387713003' }
|
|
35
|
+
].freeze,
|
|
36
|
+
'http://terminology.hl7.org/ValueSet/v3-ActEncounterCode' => [
|
|
37
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'AMB' },
|
|
38
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'EMER' },
|
|
39
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'FLD' },
|
|
40
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'HH' },
|
|
41
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'IMP' },
|
|
42
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'ACUTE' },
|
|
43
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'NONAC' },
|
|
44
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'OBSENC' },
|
|
45
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'PRENC' },
|
|
46
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'SS' },
|
|
47
|
+
{ system: V3_ACT_CODE_SYSTEM, code: 'VR' }
|
|
48
|
+
].freeze,
|
|
49
|
+
'http://hl7.org/fhir/ValueSet/medicationrequest-category' => [
|
|
50
|
+
{ system: MEDICATION_REQUEST_CATEGORY_SYSTEM, code: 'inpatient' },
|
|
51
|
+
{ system: MEDICATION_REQUEST_CATEGORY_SYSTEM, code: 'outpatient' },
|
|
52
|
+
{ system: MEDICATION_REQUEST_CATEGORY_SYSTEM, code: 'community' },
|
|
53
|
+
{ system: MEDICATION_REQUEST_CATEGORY_SYSTEM, code: 'discharge' }
|
|
54
|
+
].freeze
|
|
55
|
+
}.freeze
|
|
56
|
+
|
|
57
|
+
# Must support elements of the CRD Timing profile, which the extractor does not follow into
|
|
58
|
+
# because it stops at the type boundary.
|
|
59
|
+
# - https://hl7.org/fhir/us/davinci-crd/2.2.1/en/StructureDefinition-profile-timing.html
|
|
60
|
+
TIMING_MUST_SUPPORTS = [
|
|
61
|
+
'event', 'repeat', 'repeat.count', 'repeat.duration', 'repeat.durationUnit', 'repeat.frequency',
|
|
62
|
+
'repeat.period', 'repeat.periodUnit'
|
|
63
|
+
].freeze
|
|
64
|
+
|
|
65
|
+
# The CRD Timing profile type slices repeat.bounds[x] and makes only the Period slice must support.
|
|
66
|
+
TIMING_BOUNDS_SLICE_PATH = 'repeat.bounds[x]'.freeze
|
|
67
|
+
TIMING_BOUNDS_SLICE_NAME = 'boundsPeriod'.freeze
|
|
68
|
+
TIMING_BOUNDS_SLICE_ELEMENT = "#{TIMING_BOUNDS_SLICE_PATH}:#{TIMING_BOUNDS_SLICE_NAME}".freeze
|
|
69
|
+
|
|
70
|
+
# Elements across the CRD profiles whose type is the CRD Timing profile.
|
|
71
|
+
TIMING_ELEMENT_PATHS = [
|
|
72
|
+
'dosageInstruction.timing', 'occurrenceTiming', 'oralDiet.schedule', 'supplement.schedule',
|
|
73
|
+
'enteralFormula.administration.schedule'
|
|
74
|
+
].freeze
|
|
75
|
+
|
|
76
|
+
INTERCHANGEABLE_TIMING_PATHS = ['oralDiet.schedule', 'supplement.schedule',
|
|
77
|
+
'enteralFormula.administration.schedule'].freeze
|
|
78
|
+
|
|
79
|
+
def extract_required_binding_values(pattern_element, _metadata)
|
|
80
|
+
hand_coded_values(pattern_element).presence ||
|
|
81
|
+
Inferno::DSL::ValueExtractor.new(ig_resources, resource, profile_elements)
|
|
82
|
+
.codings_from_value_set_binding(pattern_element)
|
|
83
|
+
.presence || []
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def hand_coded_values(pattern_element)
|
|
87
|
+
UNRESOLVABLE_VALUE_SETS[pattern_element.binding&.valueSet&.split('|')&.first]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# A reference that may point to any resource type, which constrains nothing.
|
|
91
|
+
ANY_RESOURCE_TARGET = 'http://hl7.org/fhir/StructureDefinition/Resource'.freeze
|
|
92
|
+
|
|
93
|
+
# inferno_core keeps only the target profiles that must each be demonstrated, dropping the rest
|
|
94
|
+
# along with any base FHIR resource definitions. When none qualify, every target is kept under
|
|
95
|
+
# its own key instead, so a resolved reference can still be checked against one of them.
|
|
96
|
+
def handle_type_must_support_target_profiles(type, metadata)
|
|
97
|
+
super
|
|
98
|
+
targets = Array(type.targetProfile)
|
|
99
|
+
return if metadata[:target_profiles].present? || targets.blank?
|
|
100
|
+
return if targets.any? { |target| target.split('|').first == ANY_RESOURCE_TARGET }
|
|
101
|
+
|
|
102
|
+
metadata[:allowed_target_profiles] = targets.dup
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def must_supports
|
|
106
|
+
@expanded_must_supports ||= # rubocop:disable Naming/MemoizedInstanceVariableName
|
|
107
|
+
begin
|
|
108
|
+
base = super
|
|
109
|
+
timing_paths = TIMING_ELEMENT_PATHS & base[:elements].map { |element| element[:path] }
|
|
110
|
+
base.merge(elements: base[:elements].flat_map { |element| with_timing(element) },
|
|
111
|
+
slices: base[:slices].to_a + timing_paths.map { |path| timing_bounds_slice(path) },
|
|
112
|
+
choices: base[:choices].to_a + timing_choices(base[:elements]))
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def with_timing(element)
|
|
117
|
+
return [element] unless TIMING_ELEMENT_PATHS.include?(element[:path])
|
|
118
|
+
|
|
119
|
+
[element] + TIMING_MUST_SUPPORTS.map { |sub_path| { path: "#{element[:path]}.#{sub_path}" } }
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def timing_bounds_slice(timing_path)
|
|
123
|
+
{
|
|
124
|
+
slice_id: timing_bounds_slice_id(timing_path),
|
|
125
|
+
slice_name: TIMING_BOUNDS_SLICE_NAME,
|
|
126
|
+
path: "#{timing_path}.#{TIMING_BOUNDS_SLICE_PATH}",
|
|
127
|
+
discriminator: { type: 'type', code: 'Period' }
|
|
128
|
+
}
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def timing_bounds_slice_id(timing_path)
|
|
132
|
+
"#{resource}.#{timing_path}.#{TIMING_BOUNDS_SLICE_ELEMENT}"
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# The bounds slice shares its name across locations, so its choice identifies the slices by id.
|
|
136
|
+
def timing_choices(elements)
|
|
137
|
+
locations = INTERCHANGEABLE_TIMING_PATHS & elements.map { |element| element[:path] }
|
|
138
|
+
return [] if locations.length < 2
|
|
139
|
+
|
|
140
|
+
TIMING_MUST_SUPPORTS.map do |sub_path|
|
|
141
|
+
{ element: sub_path, paths: locations.map { |location| "#{location}.#{sub_path}" } }
|
|
142
|
+
end + [{ element: TIMING_BOUNDS_SLICE_ELEMENT,
|
|
143
|
+
slice_names: locations.map { |location| timing_bounds_slice_id(location) } }]
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
require 'inferno'
|
|
2
|
+
require 'yaml'
|
|
3
|
+
require_relative 'crd_must_support_metadata_extractor'
|
|
4
|
+
require_relative '../cross_suite/must_support_references'
|
|
5
|
+
require_relative '../cross_suite/profile_metadata'
|
|
6
|
+
|
|
7
|
+
module DaVinciCRDTestKit
|
|
8
|
+
module Generator
|
|
9
|
+
# Run with `bundle exec rake crd:generate`.
|
|
10
|
+
class MustSupportMetadataGenerator
|
|
11
|
+
IG_VERSIONS = ['2.2.1'].freeze
|
|
12
|
+
|
|
13
|
+
IG_DIRECTORY = File.join(__dir__, '..', 'igs').freeze
|
|
14
|
+
OUTPUT_DIRECTORY = File.join(__dir__, '..', 'cross_suite', 'generated').freeze
|
|
15
|
+
|
|
16
|
+
PACKAGES = {
|
|
17
|
+
'2.2.1' => {
|
|
18
|
+
crd: 'davinci_crd_2.2.1.tgz',
|
|
19
|
+
hrex: 'davinci_hrex_1.2.0.tgz'
|
|
20
|
+
}
|
|
21
|
+
}.freeze
|
|
22
|
+
|
|
23
|
+
# Must support references can target US Core profiles, which are not in the packages above,
|
|
24
|
+
# so the US Core package the CRD IG depends on is read from the US Core test kit when writing
|
|
25
|
+
# stubs for those targets.
|
|
26
|
+
US_CORE_PACKAGES = {
|
|
27
|
+
'2.2.1' => 'us_core_700.tgz'
|
|
28
|
+
}.freeze
|
|
29
|
+
|
|
30
|
+
PROFILES = {
|
|
31
|
+
'2.2.1' => [
|
|
32
|
+
# Request types.
|
|
33
|
+
{ key: 'vision_prescription', package: :crd, id: 'profile-visionprescription' },
|
|
34
|
+
{ key: 'service_request', package: :crd, id: 'profile-servicerequest' },
|
|
35
|
+
{ key: 'nutrition_order', package: :crd, id: 'profile-nutritionorder' },
|
|
36
|
+
{ key: 'medication_request', package: :crd, id: 'profile-medicationrequest' },
|
|
37
|
+
{ key: 'device_request', package: :crd, id: 'profile-devicerequest' },
|
|
38
|
+
{ key: 'communication_request', package: :crd, id: 'profile-communicationrequest' },
|
|
39
|
+
{ key: 'appointment_with_order', package: :crd, id: 'profile-appointment-with-order' },
|
|
40
|
+
{ key: 'appointment_without_order', package: :crd, id: 'profile-appointment-no-order' },
|
|
41
|
+
{ key: 'encounter', package: :crd, id: 'profile-encounter' },
|
|
42
|
+
# Supporting profiles.
|
|
43
|
+
{ key: 'coverage', package: :crd, id: 'profile-coverage' },
|
|
44
|
+
{ key: 'device', package: :crd, id: 'profile-device' },
|
|
45
|
+
{ key: 'location', package: :crd, id: 'profile-location' },
|
|
46
|
+
{ key: 'medication', package: :crd, id: 'profile-medication' },
|
|
47
|
+
{ key: 'organization', package: :crd, id: 'profile-organization' },
|
|
48
|
+
{ key: 'patient', package: :crd, id: 'profile-patient' },
|
|
49
|
+
{ key: 'practitioner', package: :crd, id: 'profile-practitioner' },
|
|
50
|
+
{ key: 'practitioner_role', package: :hrex, id: 'hrex-practitionerrole' }
|
|
51
|
+
]
|
|
52
|
+
}.freeze
|
|
53
|
+
|
|
54
|
+
def run
|
|
55
|
+
IG_VERSIONS.each do |ig_version|
|
|
56
|
+
puts "CRD v#{ig_version}"
|
|
57
|
+
generated = PROFILES.fetch(ig_version).map do |config|
|
|
58
|
+
metadata = extract(ig_version, config)
|
|
59
|
+
write(ig_version, config[:key], metadata)
|
|
60
|
+
puts " #{config[:key].ljust(26)} #{metadata.must_support_strings.length} must support element(s)"
|
|
61
|
+
metadata
|
|
62
|
+
end
|
|
63
|
+
write_target_profile_stubs(ig_version, generated)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
def igs_for(ig_version)
|
|
70
|
+
@igs ||= {}
|
|
71
|
+
@igs[ig_version] ||= PACKAGES.fetch(ig_version).transform_values do |file_name|
|
|
72
|
+
Inferno::Entities::IG.from_file(File.join(IG_DIRECTORY, file_name))
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def extract(ig_version, config)
|
|
77
|
+
implementation_guide = igs_for(ig_version).fetch(config[:package])
|
|
78
|
+
profile = implementation_guide.profiles.find { |candidate| candidate.id == config[:id] }
|
|
79
|
+
raise "Profile #{config[:id]} not found in the #{config[:package]} package" if profile.nil?
|
|
80
|
+
|
|
81
|
+
elements = profile.snapshot&.element
|
|
82
|
+
raise "Profile #{config[:id]} has no elements" if elements.blank?
|
|
83
|
+
|
|
84
|
+
extractor =
|
|
85
|
+
CRDMustSupportMetadataExtractor.new(elements, profile, profile.type, implementation_guide)
|
|
86
|
+
|
|
87
|
+
ProfileMetadata.new(
|
|
88
|
+
resource: extractor.resource,
|
|
89
|
+
profile_url: extractor.profile_url,
|
|
90
|
+
# Titles in the published IGs occasionally carry stray whitespace.
|
|
91
|
+
profile_name: extractor.profile_name&.strip,
|
|
92
|
+
profile_version: extractor.profile_version,
|
|
93
|
+
must_supports: normalize(extractor.must_supports, profile, implementation_guide, ig_version)
|
|
94
|
+
)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Sorts each collection and forces the sub-keys to be present even when empty, so that the
|
|
98
|
+
# output is stable across runs and the must support assessment never has to nil-check them.
|
|
99
|
+
def normalize(must_supports, profile, implementation_guide, ig_version)
|
|
100
|
+
slices = Array(must_supports[:slices]).filter_map do |slice|
|
|
101
|
+
slice = add_reference_target(slice, profile, ig_version)
|
|
102
|
+
add_binding_systems(slice, profile, implementation_guide)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
{
|
|
106
|
+
extensions: Array(must_supports[:extensions]).sort_by { |extension| extension[:id].to_s },
|
|
107
|
+
slices: slices.sort_by { |slice| slice[:slice_id].to_s },
|
|
108
|
+
elements: Array(must_supports[:elements]).sort_by { |element| element[:path].to_s },
|
|
109
|
+
choices: Array(must_supports[:choices]).sort_by do |choice|
|
|
110
|
+
[choice[:element].to_s, (choice[:paths] || choice[:slice_names]).to_a.first.to_s]
|
|
111
|
+
end,
|
|
112
|
+
recursive_elements: Array(must_supports[:recursive_elements]).sort
|
|
113
|
+
}
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# A must support reference test looks up each target profile by URL to learn its resource
|
|
117
|
+
# type, so a target profile without generated metadata of its own gets a stub carrying just
|
|
118
|
+
# its identifying details and no must supports.
|
|
119
|
+
def write_target_profile_stubs(ig_version, generated)
|
|
120
|
+
generated_urls = generated.map(&:profile_url)
|
|
121
|
+
target_urls = generated.flat_map { |metadata| target_profile_urls(metadata) }.uniq - generated_urls
|
|
122
|
+
|
|
123
|
+
target_urls.sort.each do |url|
|
|
124
|
+
profile = target_igs_for(ig_version).flat_map(&:profiles).find { |one| one.url == url }
|
|
125
|
+
raise "Target profile #{url} not found in any package" if profile.nil?
|
|
126
|
+
|
|
127
|
+
key = stub_key(profile)
|
|
128
|
+
write(ig_version, key, stub_metadata(profile))
|
|
129
|
+
puts " #{key.ljust(26)} stub for target profile"
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Base FHIR resource definitions are identified by their URL alone, so they need no stub.
|
|
134
|
+
def target_profile_urls(metadata)
|
|
135
|
+
metadata.must_supports[:elements]
|
|
136
|
+
.flat_map { |element| Array(element[:target_profiles]) + Array(element[:allowed_target_profiles]) }
|
|
137
|
+
.map { |target_profile| target_profile.split('|').first }
|
|
138
|
+
.reject { |url| MustSupportReferences.base_resource_type(url) }
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def stub_key(profile)
|
|
142
|
+
profile.id.delete_prefix('profile-').tr('-', '_')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def stub_metadata(profile)
|
|
146
|
+
ProfileMetadata.new(
|
|
147
|
+
resource: profile.type,
|
|
148
|
+
profile_url: profile.url,
|
|
149
|
+
profile_name: profile.title&.strip,
|
|
150
|
+
profile_version: profile.version
|
|
151
|
+
)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def target_igs_for(ig_version)
|
|
155
|
+
@target_igs ||= {}
|
|
156
|
+
@target_igs[ig_version] ||= igs_for(ig_version).values + [us_core_ig(ig_version)]
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def us_core_ig(ig_version)
|
|
160
|
+
directory = File.join(Gem.loaded_specs['us_core_test_kit'].full_gem_path, 'lib', 'us_core_test_kit', 'igs')
|
|
161
|
+
Inferno::Entities::IG.from_file(File.join(directory, US_CORE_PACKAGES.fetch(ig_version)))
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def add_binding_systems(slice, profile, implementation_guide)
|
|
165
|
+
discriminator = slice[:discriminator]
|
|
166
|
+
|
|
167
|
+
return slice if discriminator&.dig(:type) != 'requiredBinding' || discriminator[:values].present?
|
|
168
|
+
|
|
169
|
+
includes = binding_includes(slice[:slice_id], profile, implementation_guide)
|
|
170
|
+
return nil if includes.empty?
|
|
171
|
+
|
|
172
|
+
systems = includes.map { |include| { system: include.system } }.uniq
|
|
173
|
+
slice.merge(discriminator: discriminator.merge(values: systems))
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def add_reference_target(slice, profile, ig_version)
|
|
177
|
+
return slice if slice.dig(:discriminator, :type) != 'unsupported'
|
|
178
|
+
|
|
179
|
+
resource_type = actor_resource_type(slice[:slice_id], profile, ig_version)
|
|
180
|
+
return slice if resource_type.blank?
|
|
181
|
+
|
|
182
|
+
slice.merge(discriminator: slice[:discriminator].merge(type: 'referenceTarget', resource_type:))
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def actor_resource_type(slice_id, profile, ig_version) # rubocop:disable Metrics/CyclomaticComplexity
|
|
186
|
+
actor = profile.snapshot.element.find { |candidate| candidate.id == "#{slice_id}.actor" }
|
|
187
|
+
targets = Array(actor&.type).flat_map { |type| Array(type.targetProfile) }.compact.uniq
|
|
188
|
+
return unless targets.one?
|
|
189
|
+
|
|
190
|
+
igs_for(ig_version).values.flat_map(&:profiles).find { |one| one.url == targets.first }&.type
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def binding_includes(slice_id, profile, implementation_guide)
|
|
194
|
+
element = profile.snapshot.element.find { |candidate| candidate.id == slice_id }
|
|
195
|
+
value_set = implementation_guide.value_set_by_url(element&.binding&.valueSet)
|
|
196
|
+
|
|
197
|
+
Array(value_set&.compose&.include).reject { |include| include.concept.present? }
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def write(ig_version, key, metadata)
|
|
201
|
+
directory = File.join(OUTPUT_DIRECTORY, "v#{ig_version}", key)
|
|
202
|
+
FileUtils.mkdir_p(directory)
|
|
203
|
+
File.write(File.join(directory, 'metadata.yml'), metadata.to_hash.to_yaml)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
require 'erb'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
require_relative '../cross_suite/profile_metadata'
|
|
4
|
+
require_relative '../client/v2.2.1/must_support/request_must_support_with_attestation_option'
|
|
5
|
+
require_relative '../client/v2.2.1/must_support/request_must_support_reference_resolution'
|
|
6
|
+
|
|
7
|
+
module DaVinciCRDTestKit
|
|
8
|
+
module Generator
|
|
9
|
+
# Generates the must support group, the must support element test for each resource type it
|
|
10
|
+
# holds, and a reference resolution test for each of those types with must support Reference
|
|
11
|
+
# elements. Run as part of `bundle exec rake crd:generate`.
|
|
12
|
+
class MustSupportTestGenerator
|
|
13
|
+
CONF_3 = 'hl7.fhir.us.davinci-crd_2.2.1@conf-3'.freeze
|
|
14
|
+
HOOK_3 = 'hl7.fhir.us.davinci-crd_2.2.1@hook-3'.freeze
|
|
15
|
+
# billing-options is must support on the profiles that can carry billing codes, so their must
|
|
16
|
+
# support tests show whether the CRD client conveys them
|
|
17
|
+
BILLOPT_1 = 'hl7.fhir.us.davinci-crd_2.2.1@billopt-1'.freeze
|
|
18
|
+
|
|
19
|
+
# One test per request type, plus one for each profile that is referenced from within a
|
|
20
|
+
# request rather than being a request itself. Order here is the order in the UI, which is
|
|
21
|
+
# alphabetical by resource type.
|
|
22
|
+
TEST_DEFINITIONS = [
|
|
23
|
+
{ id: :crd_v221_appointment_must_support, requirements: [CONF_3, BILLOPT_1],
|
|
24
|
+
profiles: [{ resource_type: 'Appointment', title: 'CRD Appointment', supporting_profile: true,
|
|
25
|
+
profile_keys: %w[appointment_with_order appointment_without_order] }] },
|
|
26
|
+
{ id: :crd_v221_communication_request_must_support, requirements: [CONF_3, HOOK_3, BILLOPT_1],
|
|
27
|
+
profiles: [{ resource_type: 'CommunicationRequest', profile_keys: ['communication_request'] }] },
|
|
28
|
+
{ id: :crd_v221_coverage_must_support, requirements: [CONF_3],
|
|
29
|
+
profiles: [{ resource_type: 'Coverage', supporting_profile: true, profile_keys: ['coverage'] }] },
|
|
30
|
+
{ id: :crd_v221_device_must_support, requirements: [CONF_3, BILLOPT_1],
|
|
31
|
+
profiles: [{ resource_type: 'Device', supporting_profile: true, profile_keys: ['device'] }] },
|
|
32
|
+
{ id: :crd_v221_device_request_must_support, requirements: [CONF_3, HOOK_3, BILLOPT_1],
|
|
33
|
+
profiles: [{ resource_type: 'DeviceRequest', profile_keys: ['device_request'] }] },
|
|
34
|
+
{ id: :crd_v221_encounter_must_support, requirements: [CONF_3, BILLOPT_1],
|
|
35
|
+
profiles: [{ resource_type: 'Encounter', supporting_profile: true, profile_keys: ['encounter'] }] },
|
|
36
|
+
{ id: :crd_v221_location_must_support, requirements: [CONF_3],
|
|
37
|
+
profiles: [{ resource_type: 'Location', supporting_profile: true, profile_keys: ['location'] }] },
|
|
38
|
+
{ id: :crd_v221_medication_must_support, requirements: [CONF_3, BILLOPT_1],
|
|
39
|
+
profiles: [{ resource_type: 'Medication', supporting_profile: true, profile_keys: ['medication'] }] },
|
|
40
|
+
{ id: :crd_v221_medication_request_must_support, requirements: [CONF_3, HOOK_3, BILLOPT_1],
|
|
41
|
+
profiles: [{ resource_type: 'MedicationRequest', profile_keys: ['medication_request'] }] },
|
|
42
|
+
{ id: :crd_v221_nutrition_order_must_support, requirements: [CONF_3, HOOK_3],
|
|
43
|
+
profiles: [{ resource_type: 'NutritionOrder', profile_keys: ['nutrition_order'] }] },
|
|
44
|
+
{ id: :crd_v221_organization_must_support, requirements: [CONF_3],
|
|
45
|
+
profiles: [{ resource_type: 'Organization', supporting_profile: true, profile_keys: ['organization'] }] },
|
|
46
|
+
{ id: :crd_v221_patient_must_support, requirements: [CONF_3],
|
|
47
|
+
profiles: [{ resource_type: 'Patient', supporting_profile: true, profile_keys: ['patient'] }] },
|
|
48
|
+
{ id: :crd_v221_practitioner_must_support, requirements: [CONF_3],
|
|
49
|
+
profiles: [{ resource_type: 'Practitioner', supporting_profile: true, profile_keys: ['practitioner'] }] },
|
|
50
|
+
{ id: :crd_v221_practitioner_role_must_support, requirements: [CONF_3],
|
|
51
|
+
profiles: [{ resource_type: 'PractitionerRole', supporting_profile: true,
|
|
52
|
+
profile_keys: ['practitioner_role'] }] },
|
|
53
|
+
{ id: :crd_v221_service_request_must_support, requirements: [CONF_3, HOOK_3, BILLOPT_1],
|
|
54
|
+
profiles: [{ resource_type: 'ServiceRequest', profile_keys: ['service_request'] }] },
|
|
55
|
+
{ id: :crd_v221_vision_prescription_must_support, requirements: [CONF_3, HOOK_3, BILLOPT_1],
|
|
56
|
+
profiles: [{ resource_type: 'VisionPrescription', profile_keys: ['vision_prescription'] }] }
|
|
57
|
+
].freeze
|
|
58
|
+
|
|
59
|
+
# The order types a tester can declare support for, and the supporting types that are not
|
|
60
|
+
# required of every client.
|
|
61
|
+
ORDER_TYPE_OPTIONS = %w[
|
|
62
|
+
CommunicationRequest DeviceRequest MedicationRequest NutritionOrder ServiceRequest
|
|
63
|
+
VisionPrescription
|
|
64
|
+
].freeze
|
|
65
|
+
SUPPORTING_TYPE_OPTIONS = %w[
|
|
66
|
+
Appointment Device Encounter Location Medication Organization Practitioner PractitionerRole
|
|
67
|
+
].freeze
|
|
68
|
+
|
|
69
|
+
REQUIRING_HOOKS = {
|
|
70
|
+
'Appointment' => ['APPOINTMENT_BOOK_TAG'],
|
|
71
|
+
'Encounter' => %w[ENCOUNTER_START_TAG ENCOUNTER_DISCHARGE_TAG]
|
|
72
|
+
}.freeze
|
|
73
|
+
|
|
74
|
+
IG_VERSION = 'v2.2.1'.freeze
|
|
75
|
+
MODULE_NAME = 'V221'.freeze
|
|
76
|
+
GROUP_ID = 'crd_v221_client_cross_hook_must_support'.freeze
|
|
77
|
+
REQUESTS_GROUP_ID = "#{GROUP_ID}_requests".freeze
|
|
78
|
+
RESPONSES_GROUP_ID = "#{GROUP_ID}_responses".freeze
|
|
79
|
+
ORDER_TYPES_SIGNED_TEST_ID = 'crd_v221_client_order_types_signed'.freeze
|
|
80
|
+
COVERAGE_INFORMATION_TEST_ID = 'crd_v221_client_card_must_support_coverage_information'.freeze
|
|
81
|
+
|
|
82
|
+
# The group is written alongside its tests so that every generated file sits in one folder.
|
|
83
|
+
OUTPUT_DIRECTORY = File.join(__dir__, '..', 'client', 'v2.2.1', 'must_support', 'generated').freeze
|
|
84
|
+
|
|
85
|
+
# Generated files are linted along with the rest of the project.
|
|
86
|
+
MAX_LINE_LENGTH = 120
|
|
87
|
+
|
|
88
|
+
def run
|
|
89
|
+
FileUtils.mkdir_p(OUTPUT_DIRECTORY)
|
|
90
|
+
|
|
91
|
+
TEST_DEFINITIONS.each do |definition|
|
|
92
|
+
File.write(File.join(OUTPUT_DIRECTORY, file_name_for(definition)), render_test(definition))
|
|
93
|
+
puts " #{file_name_for(definition)}"
|
|
94
|
+
next unless references?(definition)
|
|
95
|
+
|
|
96
|
+
File.write(File.join(OUTPUT_DIRECTORY, reference_file_name_for(definition)),
|
|
97
|
+
render_reference_test(definition))
|
|
98
|
+
puts " #{reference_file_name_for(definition)}"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
File.write(File.join(OUTPUT_DIRECTORY, 'client_cross_hook_must_support_group.rb'), render_group)
|
|
102
|
+
puts ' client_cross_hook_must_support_group.rb'
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
private
|
|
106
|
+
|
|
107
|
+
def render(template_name, variables)
|
|
108
|
+
template = File.read(File.join(__dir__, 'templates', template_name))
|
|
109
|
+
ERB.new(template, trim_mode: '-').result_with_hash(variables)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def render_test(definition)
|
|
113
|
+
profile = definition[:profiles].first
|
|
114
|
+
options = { ig_version: IG_VERSION, profiles: definition[:profiles] }
|
|
115
|
+
|
|
116
|
+
render('must_support_test.rb.erb',
|
|
117
|
+
module_name: MODULE_NAME,
|
|
118
|
+
class_name: class_name_for(definition),
|
|
119
|
+
test_id: definition[:id],
|
|
120
|
+
title: title_for(profile, definition),
|
|
121
|
+
indented_description: indent(description_for(options), 8),
|
|
122
|
+
requirements: definition[:requirements],
|
|
123
|
+
ig_version: IG_VERSION,
|
|
124
|
+
profiles_literal: profiles_literal(definition[:profiles]))
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Each reference resolution test follows the element test for the same resource type.
|
|
128
|
+
def render_reference_test(definition)
|
|
129
|
+
profile = definition[:profiles].first
|
|
130
|
+
options = { ig_version: IG_VERSION, profiles: definition[:profiles] }
|
|
131
|
+
metadata = test_class.metadata_for(IG_VERSION, profile)
|
|
132
|
+
|
|
133
|
+
render('reference_resolution_test.rb.erb',
|
|
134
|
+
module_name: MODULE_NAME,
|
|
135
|
+
class_name: reference_class_name_for(definition),
|
|
136
|
+
test_id: reference_test_id_for(definition),
|
|
137
|
+
title: "#{definition[:title] || test_class.title_for(metadata, profile)} must support references " \
|
|
138
|
+
'resolve',
|
|
139
|
+
indented_description: indent(reference_test_class.build_description(options), 8),
|
|
140
|
+
requirements: [CONF_3],
|
|
141
|
+
ig_version: IG_VERSION,
|
|
142
|
+
profiles_literal: profiles_literal(definition[:profiles]))
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def render_group
|
|
146
|
+
render('must_support_group.rb.erb',
|
|
147
|
+
module_name: MODULE_NAME,
|
|
148
|
+
group_id: GROUP_ID,
|
|
149
|
+
requests_group_id: REQUESTS_GROUP_ID,
|
|
150
|
+
responses_group_id: RESPONSES_GROUP_ID,
|
|
151
|
+
test_file_names: group_file_names,
|
|
152
|
+
test_ids: group_test_ids,
|
|
153
|
+
order_type_options: ORDER_TYPE_OPTIONS,
|
|
154
|
+
supporting_type_options: SUPPORTING_TYPE_OPTIONS,
|
|
155
|
+
requiring_hooks: REQUIRING_HOOKS,
|
|
156
|
+
order_types_signed_test_id: ORDER_TYPES_SIGNED_TEST_ID,
|
|
157
|
+
coverage_information_test_id: COVERAGE_INFORMATION_TEST_ID)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def group_test_ids
|
|
161
|
+
TEST_DEFINITIONS.flat_map do |definition|
|
|
162
|
+
[definition[:id], (reference_test_id_for(definition) if references?(definition))].compact
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def group_file_names
|
|
167
|
+
file_names = TEST_DEFINITIONS.flat_map do |definition|
|
|
168
|
+
[file_name_for(definition), (reference_file_name_for(definition) if references?(definition))].compact
|
|
169
|
+
end
|
|
170
|
+
file_names.map { |file_name| file_name.delete_suffix('.rb') }
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def references?(definition)
|
|
174
|
+
definition[:profiles].any? do |profile|
|
|
175
|
+
MustSupportReferences.reference_elements(test_class.metadata_for(IG_VERSION, profile)).present?
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def test_class
|
|
180
|
+
V221::RequestMustSupportWithAttestationOption
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def reference_test_class
|
|
184
|
+
V221::RequestMustSupportReferenceResolution
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def reference_test_id_for(definition)
|
|
188
|
+
:"#{definition[:id]}_reference_resolution"
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def reference_class_name_for(definition)
|
|
192
|
+
"#{definition[:profiles].first[:resource_type]}ReferenceResolutionTest"
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def reference_file_name_for(definition)
|
|
196
|
+
"#{reference_class_name_for(definition).underscore}.rb"
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def description_for(options)
|
|
200
|
+
test_class.build_description(options)
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def title_for(profile, definition)
|
|
204
|
+
return definition[:title] if definition[:title].present?
|
|
205
|
+
|
|
206
|
+
metadata = test_class.metadata_for(IG_VERSION, profile)
|
|
207
|
+
"#{test_class.title_for(metadata, profile)} must support elements are observed"
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def class_name_for(definition)
|
|
211
|
+
"#{definition[:profiles].first[:resource_type]}MustSupportTest"
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def file_name_for(definition)
|
|
215
|
+
"#{class_name_for(definition).underscore}.rb"
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def indent(text, spaces)
|
|
219
|
+
text.each_line.map { |line| line.strip.empty? ? line : "#{' ' * spaces}#{line}" }.join
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# The profiles are written back out as Ruby so the generated test carries them literally
|
|
223
|
+
# rather than reaching for the generator at boot.
|
|
224
|
+
def profiles_literal(profiles)
|
|
225
|
+
entries = profiles.map { |profile| profile_literal(profile) }
|
|
226
|
+
|
|
227
|
+
"[\n#{entries.join(",\n")}\n ]"
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# One pair per line once the whole hash will not fit, so the generated file stays within the
|
|
231
|
+
# line length the project lints for.
|
|
232
|
+
def profile_literal(profile)
|
|
233
|
+
pairs = profile.map { |key, value| "#{key}: #{ruby_literal(value)}" }
|
|
234
|
+
single_line = " { #{pairs.join(', ')} }"
|
|
235
|
+
return single_line if single_line.length <= MAX_LINE_LENGTH
|
|
236
|
+
|
|
237
|
+
" { #{pairs.join(",\n ")} }"
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def ruby_literal(value)
|
|
241
|
+
case value
|
|
242
|
+
when String then "'#{value}'"
|
|
243
|
+
when Array then "[#{value.map { |entry| ruby_literal(entry) }.join(', ')}]"
|
|
244
|
+
else value.inspect
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
end
|