Module: AUCoreTestKit::ChainedSearchTest

Extended by:
Forwardable
Includes:
SearchTest
Included in:
AUCoreV100::AllergyIntolerancePatientChainSearchTest, AUCoreV100::AllergyIntolerancePatient_DVA_ChainSearchTest, AUCoreV100::AllergyIntolerancePatient_IHI_ChainSearchTest, AUCoreV100::AllergyIntolerancePatient_Medicare_ChainSearchTest, AUCoreV100::BloodpressurePatientChainSearchTest, AUCoreV100::BloodpressurePatient_DVA_ChainSearchTest, AUCoreV100::BloodpressurePatient_IHI_ChainSearchTest, AUCoreV100::BloodpressurePatient_Medicare_ChainSearchTest, AUCoreV100::BodyheightPatientChainSearchTest, AUCoreV100::BodyheightPatient_DVA_ChainSearchTest, AUCoreV100::BodyheightPatient_IHI_ChainSearchTest, AUCoreV100::BodyheightPatient_Medicare_ChainSearchTest, AUCoreV100::BodytempPatientChainSearchTest, AUCoreV100::BodytempPatient_DVA_ChainSearchTest, AUCoreV100::BodytempPatient_IHI_ChainSearchTest, AUCoreV100::BodytempPatient_Medicare_ChainSearchTest, AUCoreV100::BodyweightPatientChainSearchTest, AUCoreV100::BodyweightPatient_DVA_ChainSearchTest, AUCoreV100::BodyweightPatient_IHI_ChainSearchTest, AUCoreV100::BodyweightPatient_Medicare_ChainSearchTest, AUCoreV100::ConditionPatientChainSearchTest, AUCoreV100::ConditionPatient_DVA_ChainSearchTest, AUCoreV100::ConditionPatient_IHI_ChainSearchTest, AUCoreV100::ConditionPatient_Medicare_ChainSearchTest, AUCoreV100::DiagnosticresultPathPatientChainSearchTest, AUCoreV100::DiagnosticresultPathPatient_DVA_ChainSearchTest, AUCoreV100::DiagnosticresultPathPatient_IHI_ChainSearchTest, AUCoreV100::DiagnosticresultPathPatient_Medicare_ChainSearchTest, AUCoreV100::DiagnosticresultPatientChainSearchTest, AUCoreV100::DiagnosticresultPatient_DVA_ChainSearchTest, AUCoreV100::DiagnosticresultPatient_IHI_ChainSearchTest, AUCoreV100::DiagnosticresultPatient_Medicare_ChainSearchTest, AUCoreV100::EncounterPatientChainSearchTest, AUCoreV100::EncounterPatient_DVA_ChainSearchTest, AUCoreV100::EncounterPatient_IHI_ChainSearchTest, AUCoreV100::EncounterPatient_Medicare_ChainSearchTest, AUCoreV100::HeartratePatientChainSearchTest, AUCoreV100::HeartratePatient_DVA_ChainSearchTest, AUCoreV100::HeartratePatient_IHI_ChainSearchTest, AUCoreV100::HeartratePatient_Medicare_ChainSearchTest, AUCoreV100::ImmunizationPatientChainSearchTest, AUCoreV100::ImmunizationPatient_DVA_ChainSearchTest, AUCoreV100::ImmunizationPatient_IHI_ChainSearchTest, AUCoreV100::ImmunizationPatient_Medicare_ChainSearchTest, AUCoreV100::MedicationRequestPatientChainSearchTest, AUCoreV100::MedicationRequestPatient_DVA_ChainSearchTest, AUCoreV100::MedicationRequestPatient_IHI_ChainSearchTest, AUCoreV100::MedicationRequestPatient_Medicare_ChainSearchTest, AUCoreV100::PractitionerRolePractitionerChainSearchTest, AUCoreV100::ProcedurePatientChainSearchTest, AUCoreV100::ProcedurePatient_DVA_ChainSearchTest, AUCoreV100::ProcedurePatient_IHI_ChainSearchTest, AUCoreV100::ProcedurePatient_Medicare_ChainSearchTest, AUCoreV100::RespratePatientChainSearchTest, AUCoreV100::RespratePatient_DVA_ChainSearchTest, AUCoreV100::RespratePatient_IHI_ChainSearchTest, AUCoreV100::RespratePatient_Medicare_ChainSearchTest, AUCoreV100::SmokingstatusPatientChainSearchTest, AUCoreV100::SmokingstatusPatient_DVA_ChainSearchTest, AUCoreV100::SmokingstatusPatient_IHI_ChainSearchTest, AUCoreV100::SmokingstatusPatient_Medicare_ChainSearchTest, AUCoreV100::WaistcircumPatientChainSearchTest, AUCoreV100::WaistcircumPatient_DVA_ChainSearchTest, AUCoreV100::WaistcircumPatient_IHI_ChainSearchTest, AUCoreV100::WaistcircumPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::AllergyIntolerancePatientChainSearchTest, AUCoreV110_PREVIEW::AllergyIntolerancePatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::AllergyIntolerancePatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::AllergyIntolerancePatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::BloodpressurePatientChainSearchTest, AUCoreV110_PREVIEW::BloodpressurePatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::BloodpressurePatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::BloodpressurePatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::BodyheightPatientChainSearchTest, AUCoreV110_PREVIEW::BodyheightPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::BodyheightPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::BodyheightPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::BodytempPatientChainSearchTest, AUCoreV110_PREVIEW::BodytempPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::BodytempPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::BodytempPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::BodyweightPatientChainSearchTest, AUCoreV110_PREVIEW::BodyweightPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::BodyweightPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::BodyweightPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::ConditionPatientChainSearchTest, AUCoreV110_PREVIEW::ConditionPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::ConditionPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::ConditionPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::DiagnosticresultPathPatientChainSearchTest, AUCoreV110_PREVIEW::DiagnosticresultPathPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::DiagnosticresultPathPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::DiagnosticresultPathPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::DiagnosticresultPatientChainSearchTest, AUCoreV110_PREVIEW::DiagnosticresultPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::DiagnosticresultPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::DiagnosticresultPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::EncounterPatientChainSearchTest, AUCoreV110_PREVIEW::EncounterPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::EncounterPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::EncounterPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::HeartratePatientChainSearchTest, AUCoreV110_PREVIEW::HeartratePatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::HeartratePatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::HeartratePatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::ImmunizationPatientChainSearchTest, AUCoreV110_PREVIEW::ImmunizationPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::ImmunizationPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::ImmunizationPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::MedicationRequestPatientChainSearchTest, AUCoreV110_PREVIEW::MedicationRequestPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::MedicationRequestPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::MedicationRequestPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::MedicationStatementPatientChainSearchTest, AUCoreV110_PREVIEW::MedicationStatementPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::MedicationStatementPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::MedicationStatementPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::PractitionerRolePractitionerChainSearchTest, AUCoreV110_PREVIEW::ProcedurePatientChainSearchTest, AUCoreV110_PREVIEW::ProcedurePatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::ProcedurePatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::ProcedurePatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::RespratePatientChainSearchTest, AUCoreV110_PREVIEW::RespratePatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::RespratePatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::RespratePatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::SmokingstatusPatientChainSearchTest, AUCoreV110_PREVIEW::SmokingstatusPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::SmokingstatusPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::SmokingstatusPatient_Medicare_ChainSearchTest, AUCoreV110_PREVIEW::WaistcircumPatientChainSearchTest, AUCoreV110_PREVIEW::WaistcircumPatient_DVA_ChainSearchTest, AUCoreV110_PREVIEW::WaistcircumPatient_IHI_ChainSearchTest, AUCoreV110_PREVIEW::WaistcircumPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::AllergyIntolerancePatientChainSearchTest, AUCoreV200_DRAFT::AllergyIntolerancePatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::AllergyIntolerancePatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::AllergyIntolerancePatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::BloodpressurePatientChainSearchTest, AUCoreV200_DRAFT::BloodpressurePatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::BloodpressurePatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::BloodpressurePatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::BodyheightPatientChainSearchTest, AUCoreV200_DRAFT::BodyheightPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::BodyheightPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::BodyheightPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::BodytempPatientChainSearchTest, AUCoreV200_DRAFT::BodytempPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::BodytempPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::BodytempPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::BodyweightPatientChainSearchTest, AUCoreV200_DRAFT::BodyweightPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::BodyweightPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::BodyweightPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::ConditionPatientChainSearchTest, AUCoreV200_DRAFT::ConditionPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::ConditionPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::ConditionPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::DiagnosticresultPathPatientChainSearchTest, AUCoreV200_DRAFT::DiagnosticresultPathPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::DiagnosticresultPathPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::DiagnosticresultPathPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::DiagnosticresultPatientChainSearchTest, AUCoreV200_DRAFT::DiagnosticresultPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::DiagnosticresultPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::DiagnosticresultPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::EncounterPatientChainSearchTest, AUCoreV200_DRAFT::EncounterPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::EncounterPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::EncounterPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::HeartratePatientChainSearchTest, AUCoreV200_DRAFT::HeartratePatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::HeartratePatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::HeartratePatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::ImmunizationPatientChainSearchTest, AUCoreV200_DRAFT::ImmunizationPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::ImmunizationPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::ImmunizationPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::MedicationRequestPatientChainSearchTest, AUCoreV200_DRAFT::MedicationRequestPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::MedicationRequestPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::MedicationRequestPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::MedicationStatementPatientChainSearchTest, AUCoreV200_DRAFT::MedicationStatementPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::MedicationStatementPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::MedicationStatementPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::PractitionerRolePractitionerChainSearchTest, AUCoreV200_DRAFT::ProcedurePatientChainSearchTest, AUCoreV200_DRAFT::ProcedurePatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::ProcedurePatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::ProcedurePatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::RespratePatientChainSearchTest, AUCoreV200_DRAFT::RespratePatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::RespratePatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::RespratePatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::SmokingstatusPatientChainSearchTest, AUCoreV200_DRAFT::SmokingstatusPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::SmokingstatusPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::SmokingstatusPatient_Medicare_ChainSearchTest, AUCoreV200_DRAFT::WaistcircumPatientChainSearchTest, AUCoreV200_DRAFT::WaistcircumPatient_DVA_ChainSearchTest, AUCoreV200_DRAFT::WaistcircumPatient_IHI_ChainSearchTest, AUCoreV200_DRAFT::WaistcircumPatient_Medicare_ChainSearchTest
Defined in:
lib/au_core_test_kit/chained_search_test.rb

Constant Summary

Constants included from FHIRResourceNavigation

FHIRResourceNavigation::DAR_EXTENSION_URL

Instance Method Summary collapse

Methods included from SearchTest

#all_comparator_searches_tested?, #all_provenance_revinclude_search_params, #all_scratch_resources, #all_search_params, #all_search_params_present?, #all_search_variants_tested?, #any_valid_search_params?, #array_of_codes, #birthdate_comparator_value, #cant_resolve_next_bundle_message, #chain_search_restriction, #check_availability_of_count_search_parameter, #check_resource_against_params, #check_search_response, #date_comparator_value, #default_search_values, #default_search_values_clean, #default_values_for_param, #element_has_valid_value?, #empty_search_params_message, #extension_check, #extract_existing_values_safety, #fetch_all_bundled_resources, #filter_conditions, #filter_devices, #find_include_resources, #fixed_value_search_param_name, #fixed_value_search_param_values, #fixed_value_search_params, #initial_search_variant_test_records, #insufficient_number_of_values, #is_count_available_for_resource_type?, #is_reference_match?, #modify_value_by_multiple_type, #no_resources_skip_message, #optional_search_and_check_response, #patient_id_list, #patient_id_param?, #patient_search?, #perform_comparator_searches, #perform_multiple_and_search_test, #perform_multiple_or_search_test, #perform_multiple_search_test, #perform_post_search, #perform_reference_with_type_search, #perform_search, #perform_search_with_status, #perform_search_with_system, #references_to_save, #required_comparators, #run_include_test, #run_provenance_revinclude_search_test, #run_read_test_and_skip_first_search, #run_search_test, #run_search_test_with_system, #save_delayed_references, #save_resource_reference, #scratch_resources_for_patient, #search_and_check_response, #search_by_patient_id_is_available, #search_param_paths, #search_param_value, #search_params_with_values, #search_variant_test_records, #status_search_param_name, #status_search_values, #test_include_param, #unable_to_resolve_params_message

Methods included from AssertHelpers

#act_if_with_message, #act_with_message, #conditional_skip_with_msg, #skip_with_msg

Methods included from ReadTest

#all_scratch_resources, #bad_resource_id_message, #basic_read_and_validate, #create_reference, #fetch_resource_ids, #get_resources_to_read_from_arr_ids, #no_resources_custom_skip_message, #no_resources_skip_message, #perform_read_test, #read_and_validate, #read_and_validate_as_first, #read_and_validate_resourses_arr, #readable_resources, #resource_class, #resource_id, #resource_ids_str_to_arr

Methods included from FHIRResourceNavigation

#find_a_value_at, #find_slice_via_discriminator, #get_extension_url, #get_next_value, #get_value_from_extension, #is_extension?, #resolve_path, #verify_slice_by_values

Methods included from DateSearchValidation

#fhir_date_comparer, #get_fhir_datetime_range, #get_fhir_period_range, #is_date?, #validate_date_search, #validate_datetime_search, #validate_period_search

Instance Method Details

#all_chain_identifier_values(patient_id_list, all_resources, chain_target, target_identifier) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/au_core_test_kit/chained_search_test.rb', line 32

def all_chain_identifier_values(patient_id_list, all_resources, chain_target, target_identifier)
  patient_id_list.map do |patient_id|
    next unless !all_resources.nil? && all_resources.include?(patient_id)

    resource_identifiers = get_resources_identifier(
      all_resources[patient_id].filter { |r| r.resourceType == chain_target },
      target_identifier
    )
    resource_identifiers.map do |identifier|
      { patient_id:, identifier: }
    end
  end.flatten
end

#extract_target_resource_from_chained_search_parameter(search_param) ⇒ Object



18
19
20
# File 'lib/au_core_test_kit/chained_search_test.rb', line 18

def extract_target_resource_from_chained_search_parameter(search_param)
  search_param.split(':').second.split('.').first
end

#get_resources_identifier(resources, target_identifier) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/au_core_test_kit/chained_search_test.rb', line 22

def get_resources_identifier(resources, target_identifier)
  if !target_identifier
    resources.map(&:identifier).flatten
  else
    resources.map do |r|
      r.identifier.filter { |idnt| idnt.system == target_identifier[:url] }
    end.flatten
  end
end

#pick_identifier_to_test(patient_id_list, all_patients_resources, search_param, target_identifier) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/au_core_test_kit/chained_search_test.rb', line 56

def pick_identifier_to_test(patient_id_list, all_patients_resources, search_param, target_identifier)
  all_chain_identifier_values(
    patient_id_list,
    all_patients_resources,
    extract_target_resource_from_chained_search_parameter(search_param),
    target_identifier
  ).sample
end

#returned_resources_is_valid?(resources_returned, identifier_to_test, attr_paths) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
69
70
71
72
73
# File 'lib/au_core_test_kit/chained_search_test.rb', line 65

def returned_resources_is_valid?(resources_returned, identifier_to_test, attr_paths)
  existing_values = resources_returned.map do |rr|
    attr_paths.map do |attr_path|
      resolve_path(rr, attr_path).first.reference.split('/').second
    end
  end.flatten.compact.uniq

  existing_values.include? identifier_to_test[:patient_id]
end

#run_chain_search_testObject



46
47
48
49
50
51
52
53
54
# File 'lib/au_core_test_kit/chained_search_test.rb', line 46

def run_chain_search_test
  run_chain_search_test_clean(
    search_param_names[0],
    patient_id_list,
    scratch[:patient_resources],
    attr_paths,
    target_identifier
  )
end

#run_chain_search_test_clean(search_param, patient_id_list, all_patients_resources, attr_paths, target_identifier) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/au_core_test_kit/chained_search_test.rb', line 75

def run_chain_search_test_clean(search_param, patient_id_list, all_patients_resources, attr_paths, target_identifier)
  passed = false

  identifiers_to_test = all_chain_identifier_values(
    patient_id_list,
    all_patients_resources,
    extract_target_resource_from_chained_search_parameter(search_param),
    target_identifier
  )

  identifiers_to_test.each do |identifier_to_test|
    next if identifier_to_test.nil?

    search_and_check_response({ search_param => "#{identifier_to_test[:identifier].system}|#{identifier_to_test[:identifier].value}" })
    result = returned_resources_is_valid?(fetch_all_bundled_resources.select { |resource| resource.resourceType == resource_type }, identifier_to_test, attr_paths)
    next unless result

    passed = true
    break
  end

  assert passed, 'There is no reference to the target resource in the returned result'
end