Module: AUCoreTestKit::SpecialIdentifierSearchTest
- Extended by:
- Forwardable
- Includes:
- AssertHelpers, SearchTest
- Included in:
- AUCoreV100::OrganizationIdentifierABNSearchTest, AUCoreV100::OrganizationIdentifierHPIOSearchTest, AUCoreV100::PatientIdentifierDVASearchTest, AUCoreV100::PatientIdentifierIHISearchTest, AUCoreV100::PatientIdentifierMedicareSearchTest, AUCoreV100::PractitionerIdentifierHPIISearchTest, AUCoreV100::PractitionerRoleIdentifierMedicareSearchTest, AUCoreV110_PREVIEW::OrganizationIdentifierABNSearchTest, AUCoreV110_PREVIEW::OrganizationIdentifierHPIOSearchTest, AUCoreV110_PREVIEW::PatientIdentifierDVASearchTest, AUCoreV110_PREVIEW::PatientIdentifierIHISearchTest, AUCoreV110_PREVIEW::PatientIdentifierMedicareSearchTest, AUCoreV110_PREVIEW::PractitionerIdentifierHPIISearchTest, AUCoreV110_PREVIEW::PractitionerRoleIdentifierMedicareSearchTest, AUCoreV200_DRAFT::OrganizationIdentifierABNSearchTest, AUCoreV200_DRAFT::OrganizationIdentifierHPIOSearchTest, AUCoreV200_DRAFT::PatientIdentifierDVASearchTest, AUCoreV200_DRAFT::PatientIdentifierIHISearchTest, AUCoreV200_DRAFT::PatientIdentifierMedicareSearchTest, AUCoreV200_DRAFT::PractitionerIdentifierHPIISearchTest, AUCoreV200_DRAFT::PractitionerRoleIdentifierMedicareSearchTest
- Defined in:
- lib/au_core_test_kit/special_identifier_search_test.rb
Constant Summary
Constants included from FHIRResourceNavigation
FHIRResourceNavigation::DAR_EXTENSION_URL
Instance Method Summary collapse
- #all_search_params ⇒ Object
- #default_search_params(search_param_names, patient_id) ⇒ Object
- #get_resource_identifiers(resource, target_identifier) ⇒ Object
- #run_special_identifier_search_test ⇒ Object
- #search_param_value(_name, resource, include_system: false) ⇒ Object
- #search_params_with_values(search_param_names, patient_id, include_system: false) ⇒ Object
Methods included from AssertHelpers
#act_if_with_message, #act_with_message, #conditional_skip_with_msg, #skip_with_msg
Methods included from SearchTest
#all_comparator_searches_tested?, #all_provenance_revinclude_search_params, #all_scratch_resources, #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_variant_test_records, #status_search_param_name, #status_search_values, #test_include_param, #unable_to_resolve_params_message
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_search_params ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/au_core_test_kit/special_identifier_search_test.rb', line 32 def all_search_params @all_search_params ||= patient_id_list.each_with_object({}) do |patient_id, params| params[patient_id] ||= [] new_params = [search_params_with_values(search_param_names, patient_id)] new_params.reject! do |params| params.any? { |_key, value| value.blank? } end params[patient_id].concat(new_params) end end |
#default_search_params(search_param_names, patient_id) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/au_core_test_kit/special_identifier_search_test.rb', line 61 def default_search_params(search_param_names, patient_id) search_param_names.each_with_object({}) do |name, params| value = patient_id_param?(name) ? patient_id : nil params[name] = value end end |
#get_resource_identifiers(resource, target_identifier) ⇒ Object
68 69 70 |
# File 'lib/au_core_test_kit/special_identifier_search_test.rb', line 68 def get_resource_identifiers(resource, target_identifier) resource.identifier.filter { |ident| ident.system == target_identifier[:url] } end |
#run_special_identifier_search_test ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/au_core_test_kit/special_identifier_search_test.rb', line 82 def run_special_identifier_search_test conditional_skip_with_msg scratch_resources[:all].empty?, conditional_skip_with_msg !any_valid_search_params?(all_search_params), resources_returned = all_search_params.flat_map do |patient_id, params_list| params_list.flat_map { |params| perform_search_with_system(params, patient_id) } end conditional_skip_with_msg resources_returned.empty?, end |
#search_param_value(_name, resource, include_system: false) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/au_core_test_kit/special_identifier_search_test.rb', line 72 def search_param_value(_name, resource, include_system: false) search_value = nil resource_identifiers = get_resource_identifiers(resource, target_identifier) if resource_identifiers.length.positive? resource_identifier = resource_identifiers.first search_value = include_system ? "#{resource_identifier.system}|#{resource_identifier.value}" : resource_identifier.value.to_s end search_value&.gsub(',', '\\,') end |
#search_params_with_values(search_param_names, patient_id, include_system: false) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/au_core_test_kit/special_identifier_search_test.rb', line 44 def search_params_with_values(search_param_names, patient_id, include_system: false) resources = scratch_resources_for_patient(patient_id) return default_search_params if resources.empty? resources.each_with_object({}) do |resource, outer_params| results_from_one_resource = search_param_names.each_with_object({}) do |name, params| value = search_param_value(name, resource, include_system:) params[name] = value end outer_params.merge!(results_from_one_resource) # stop if all parameter values are found return outer_params if outer_params.all? { |_key, value| value.present? } end end |