Class: USCoreTestKit::ClinicalNoteTypeTest
- Inherits:
-
Inferno::Test
- Object
- Inferno::Test
- USCoreTestKit::ClinicalNoteTypeTest
- Includes:
- SearchTest
- Defined in:
- lib/us_core_test_kit/custom_groups/clinical_note_type_test.rb
Constant Summary collapse
- REQUIRED_CATEGORIES =
['LP29708-2', 'LP7839-6', 'LP29684-5'].freeze
Constants included from WellKnownCodeSystems
WellKnownCodeSystems::HL7_CODE_SYSTEMS, WellKnownCodeSystems::WELL_KNOWN_CODE_SYSTEMS
Constants included from FHIRResourceNavigation
FHIRResourceNavigation::DAR_EXTENSION_URL, FHIRResourceNavigation::PRIMITIVE_DATA_TYPES
Instance Method Summary collapse
- #diagnostic_report_categories_found(patient_id) ⇒ Object
- #document_reference_types_found(patient_id) ⇒ Object
-
#tags(_params) ⇒ Object
Disable tagging requests since this test doesn’t have properties defined.
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, #check_resource_against_params, #check_search_response, #date_comparator_value, #default_search_values, #element_has_valid_value?, #empty_search_params_message, #fetch_and_assert_all_bundled_resources, #filter_conditions, #filter_devices, #fixed_value_search_param_name, #fixed_value_search_param_values, #fixed_value_search_params, #initial_search_variant_test_records, #is_reference_match?, #no_resources_skip_message, #patient_id_list, #patient_id_param?, #patient_search?, #perform_comparator_searches, #perform_multiple_or_search_test, #perform_post_search, #perform_reference_with_type_search, #perform_search, #perform_search_with_status, #perform_search_with_system, #prefer_well_known_code_system, #references_to_save, #required_comparators, #resource_matches_param?, #run_provenance_revinclude_search_test, #run_search_test, #save_delayed_references, #save_resource_reference, #scratch_resources_for_patient, #search_and_check_response, #search_param_paths, #search_param_value, #search_params_tag, #search_params_with_values, #search_variant_test_records, #status_search_param_name, #status_search_values, #test_medication_inclusion, #unable_to_resolve_params_message, #unescape_search_value
Methods included from WellKnownCodeSystems
Methods included from ResourceSearchParamChecker
#element_has_valid_value?, #resource_matches_param?, #search_param_paths
Methods included from FHIRResourceNavigation
#find_a_value_at, #find_slice_via_discriminator, #get_next_value, #get_primitive_type_value, #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
#diagnostic_report_categories_found(patient_id) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/us_core_test_kit/custom_groups/clinical_note_type_test.rb', line 57 def diagnostic_report_categories_found(patient_id) search_params = { patient: patient_id } status_values = ['registered,partial,preliminary,final,amended,corrected,appended,cancelled,entered-in-error,unknown'] search_and_check_response(search_params, 'DiagnosticReport') if response[:status] == 400 perform_search_with_status( params, patient_id, status_search_values: status_values, resource_type: 'DiagnosticReport' ) end resources = fetch_all_bundled_resources(resource_type: 'DiagnosticReport') .select { |resource| resource.resourceType == 'DiagnosticReport' } scratch[:diagnostic_report_attachments] ||= {} scratch[:diagnostic_report_attachments][patient_id] ||= {} = scratch[:diagnostic_report_attachments][patient_id] codes_found = resources.flat_map do |resource| codes = resource.category&.flat_map do |category| category.coding&.map { |coding| coding.code if REQUIRED_CATEGORIES.include?(coding.code) } end.compact if codes.present? resource.presentedForm &.select { || &.url.present? && !.key?(&.url) } &.each { || [.url] = resource.id } end codes end codes_found.compact.uniq end |
#document_reference_types_found(patient_id) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/us_core_test_kit/custom_groups/clinical_note_type_test.rb', line 23 def document_reference_types_found(patient_id) search_params = { patient: patient_id } status_values = ['current,superseded,entered-in-error'] search_and_check_response(search_params, 'DocumentReference') if response[:status] == 400 perform_search_with_status( params, patient_id, status_search_values: status_values, resource_type: 'DocumentReference' ) end resources = fetch_all_bundled_resources(resource_type: 'DocumentReference') .select { |resource| resource.resourceType == 'DocumentReference' } scratch[:document_reference_attachments] ||= {} scratch[:document_reference_attachments][patient_id] ||= {} = scratch[:document_reference_attachments][patient_id] codes_found = resources.flat_map do |resource| resource.content &.select { |content| content.&.url.present? && !.key?(content.&.url) } &.each { |content| [content..url] = resource.id } resource.type&.coding&.map { |coding| coding.code } end codes_found.compact.uniq end |
#tags(_params) ⇒ Object
Disable tagging requests since this test doesn’t have properties defined. TODO: investigate whether we need to tag these for granular scope checking.
19 20 21 |
# File 'lib/us_core_test_kit/custom_groups/clinical_note_type_test.rb', line 19 def (_params) nil end |