Class: CancerRegistryReportingTestKit::HDEAV100::CcrrContentBundleParseAndValidationTest

Inherits:
Inferno::Test
  • Object
show all
Includes:
CancerRegistryReportingTestKit::HDEABundleParse, ValidationTest
Defined in:
lib/cancer_registry_reporting_test_kit/hdea_suite/ccrr_content_bundle_parse_and_validation_test.rb

Constant Summary

Constants included from CancerRegistryReportingTestKit::HDEABundleParse

CancerRegistryReportingTestKit::HDEABundleParse::CODE_TO_MULTIPLE_ENTRY_RESOURCE_MAP, CancerRegistryReportingTestKit::HDEABundleParse::CODE_TO_URL_MAP, CancerRegistryReportingTestKit::HDEABundleParse::FIELD_TO_URL_MAP

Constants included from FHIRResourceNavigation

FHIRResourceNavigation::DAR_EXTENSION_URL, FHIRResourceNavigation::PRIMITIVE_DATA_TYPES

Constants included from ValidationTest

ValidationTest::DAR_CODE_SYSTEM_URL, ValidationTest::DAR_EXTENSION_URL

Instance Method Summary collapse

Methods included from CancerRegistryReportingTestKit::HDEABundleParse

#clear_unresolved_references, #find_resource_in_bundle, #look_for_references_in_resource, #multiple_reference_types?, #parse_bundle, #parse_sections, #profile_from_resource_type, #unresolved_references

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 ValidationTest

#check_for_dar, #check_for_dar_code, #check_for_dar_extension, #find_validation_errors, #perform_validation_test

Instance Method Details

#add_ms_resources_to_scratch(reports) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cancer_registry_reporting_test_kit/hdea_suite/ccrr_content_bundle_parse_and_validation_test.rb', line 23

def add_ms_resources_to_scratch(reports)
  reports.each_with_index do |bundle, index|
    parsed_bundle = parse_bundle(FHIR.from_contents(bundle.to_json), index).first
    next unless parsed_bundle.present?

    report_hash = url_keys_to_group_keys(parsed_bundle)
    report_hash.each do |group, resources|
      next unless resources.present?

      scratch[group] ||= {}
      scratch[group][:all] ||= []
      scratch[group][:all].concat(resources)
    end
  end
end

#resource_typeObject



43
44
45
# File 'lib/cancer_registry_reporting_test_kit/hdea_suite/ccrr_content_bundle_parse_and_validation_test.rb', line 43

def resource_type
  'Bundle'
end

#scratch_resourcesObject



47
48
49
# File 'lib/cancer_registry_reporting_test_kit/hdea_suite/ccrr_content_bundle_parse_and_validation_test.rb', line 47

def scratch_resources
  scratch[:ccrr_content_bundle_resources] ||= {}
end

#url_keys_to_group_keys(report_hash) ⇒ Object



39
40
41
# File 'lib/cancer_registry_reporting_test_kit/hdea_suite/ccrr_content_bundle_parse_and_validation_test.rb', line 39

def url_keys_to_group_keys(report_hash)
  report_hash.transform_keys { |key| :"#{HdeaGenerator::Naming.snake_case_for_url(key)}" }
end