Class: DaVinciPASTestKit::ServerResponseBundleValidationTest

Inherits:
Inferno::Test
  • Object
show all
Includes:
PasBundleValidation
Defined in:
lib/davinci_pas_test_kit/server/server_response_bundle_validation_test.rb

Constant Summary

Constants included from PasBundleValidation

PasBundleValidation::BASE_R4_PROFILE, PasBundleValidation::CLAIM_ENCOUNTER_EXTENSION_URL, PasBundleValidation::DIAGNOSTIC_REPORT_CATEGORY_SYSTEM, PasBundleValidation::LOINC_SYSTEM, PasBundleValidation::OBSERVATION_CATEGORY_SYSTEM, PasBundleValidation::TERMINOLOGY_CONDITION_CATEGORY_SYSTEM, PasBundleValidation::US_CORE_CONDITION_ENCOUNTER_DIAGNOSIS_PROFILE_ID, PasBundleValidation::US_CORE_CONDITION_PROBLEMS_HEALTH_CONCERNS_PROFILE_ID, PasBundleValidation::US_CORE_DIAGNOSTIC_REPORT_LAB_PROFILE_ID, PasBundleValidation::US_CORE_DIAGNOSTIC_REPORT_NOTE_PROFILE_ID, PasBundleValidation::US_CORE_OBSERVATION_CLINICAL_RESULT_PROFILE_ID, PasBundleValidation::US_CORE_OBSERVATION_CODE_PROFILE_IDS, PasBundleValidation::US_CORE_OBSERVATION_LAB_PROFILE_ID, PasBundleValidation::US_CORE_OBSERVATION_SCREENING_ASSESSMENT_PROFILE_ID, PasBundleValidation::US_CORE_PROFILE_BASE, PasBundleValidation::US_CORE_SIMPLE_OBSERVATION_PROFILE_ID, PasBundleValidation::US_CORE_SINGLE_PROFILE_IDS_BY_RESOURCE, PasBundleValidation::US_CORE_SMOKING_STATUS_PROFILE_ID, PasBundleValidation::US_CORE_VERSION, PasBundleValidation::US_CORE_VITAL_SIGNS_PROFILE_ID

Instance Method Summary collapse

Methods included from PasBundleValidation

#absolute_url, #add_declared_profiles, #add_profile_to_instance, #add_resource_target_profile_to_map, #add_us_core_profiles_to_unprofiled_entries, #bundle_entry_map, #bundle_profile_valid?, #bundle_resources_target_profile_map, #category_code_present?, #check_presence_of_referenced_resources, #claim_related_attr?, #claim_response_request_attr?, #codeable_concept_has_code?, #determine_claim_submit_profile_url, #extract_base_url, #extract_profiles_to_validate_each_entry, #extract_resources_from_bundle, #find_profile_url, #find_referenced_instance_in_bundle, #generate_non_conformance_message, #handle_claim_profile, #metadata_map, #perform_bundle_validation, #perform_request_validation, #perform_response_validation, #process_instance_profiles, #process_reference_element, #profile_url_for_validation, #profile_url_without_version, #reject_entry_resource_issues, #reset_bundle_profile_inference_state, #resource_full_url_for_entry, #resource_present_in_pa_request_and_response_msg, #resource_shall_appear_once_message, #us_core_condition_profile_ids, #us_core_diagnostic_report_profile_ids, #us_core_observation_profile_ids, #us_core_profile_fallback_enabled?, #us_core_profile_url?, #us_core_profile_urls, #us_core_profile_urls_for_resource, #valid_url_or_urn_uuid?, #validate_bundle_entries_against_profiles, #validate_bundle_entries_full_url, #validate_pa_request_payload_structure, #validate_pa_response_body_structure, #validate_pas_bundle_json, #validate_resources_conformance_against_profile, #validate_uniqueness_of_supporting_info_sequences, #validation_error_messages

Methods included from ParametersHelper

#extract_bundles_from_pas_inquiry_response_parameters

Methods included from ValidationTest

#perform_validation_test

Instance Method Details

#ig_versionObject



17
18
19
# File 'lib/davinci_pas_test_kit/server/server_response_bundle_validation_test.rb', line 17

def ig_version
  config.options[:ig_version]
end

#operationObject



13
14
15
# File 'lib/davinci_pas_test_kit/server/server_response_bundle_validation_test.rb', line 13

def operation
  config.options[:operation]
end

#response_bundlesObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/davinci_pas_test_kit/server/server_response_bundle_validation_test.rb', line 31

def response_bundles
  requests = load_tagged_requests(DaVinciPASTestKit.operation_tag(operation),
                                  workflow_tag)
  bundles = []
  requests.map(&:response_body).compact.uniq.each do |response_body|
    resource = FHIR.from_contents(response_body)
    next unless resource.present?

    # Handle Parameters resource (v2.2.1 inquire responses)
    if resource.resourceType == 'Parameters'
      # Extract all Bundles from Parameters.parameter entries
      parameter_bundles = extract_bundles_from_pas_inquiry_response_parameters(resource)
      bundles.concat(parameter_bundles)
    elsif resource.is_a?(FHIR::Bundle)
      # Handle Bundle resource (v2.0.1 or v2.2.1 non-inquire)
      bundles << resource
    end
  rescue StandardError
    next
  end

  bundles
end

#use_caseObject



21
22
23
# File 'lib/davinci_pas_test_kit/server/server_response_bundle_validation_test.rb', line 21

def use_case
  config.options[:use_case]
end

#workflow_tagObject

Tests that tag a single submission with an explicit request_tag (e.g. Claim Updates) reload by that tag; standard workflow tests fall back to the use-case-derived tag.



27
28
29
# File 'lib/davinci_pas_test_kit/server/server_response_bundle_validation_test.rb', line 27

def workflow_tag
  config.options[:request_tag].presence || DaVinciPASTestKit.use_case_tag(use_case)
end