Class: CancerRegistryReportingTestKit::HdeaGenerator::IGResources
- Inherits:
-
Object
- Object
- CancerRegistryReportingTestKit::HdeaGenerator::IGResources
- Defined in:
- lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb
Instance Method Summary collapse
- #add(resource) ⇒ Object
- #capability_statement(mode = 'server') ⇒ Object
- #code_system_by_url(url) ⇒ Object
- #ig ⇒ Object
- #inspect ⇒ Object
- #profile_by_url(url) ⇒ Object
- #resource_for_profile(url) ⇒ Object
-
#resources_by_type ⇒ Object
private.
- #search_param_by_resource_and_name(resource, name) ⇒ Object
- #value_set_by_url(url) ⇒ Object
Instance Method Details
#add(resource) ⇒ Object
6 7 8 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 6 def add(resource) resources_by_type[resource.resourceType] << resource end |
#capability_statement(mode = 'server') ⇒ Object
10 11 12 13 14 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 10 def capability_statement(mode = 'server') resources_by_type['CapabilityStatement'].find do |capability_statement_resource| capability_statement_resource.rest.any? { |r| r.mode == mode } end end |
#code_system_by_url(url) ⇒ Object
36 37 38 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 36 def code_system_by_url(url) resources_by_type['CodeSystem'].find { |system| system.url == url } end |
#ig ⇒ Object
16 17 18 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 16 def ig resources_by_type['ImplementationGuide'].first end |
#inspect ⇒ Object
20 21 22 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 20 def inspect 'IGResources' end |
#profile_by_url(url) ⇒ Object
24 25 26 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 24 def profile_by_url(url) resources_by_type['StructureDefinition'].find { |profile| profile.url == url } end |
#resource_for_profile(url) ⇒ Object
28 29 30 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 28 def resource_for_profile(url) resources_by_type['StructureDefinition'].find { |profile| profile.url == url }.type end |
#resources_by_type ⇒ Object
private
51 52 53 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 51 def resources_by_type @resources_by_type ||= Hash.new { |hash, key| hash[key] = [] } end |
#search_param_by_resource_and_name(resource, name) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 40 def search_param_by_resource_and_name(resource, name) # remove '_' from search parameter name, such as _id or _tag normalized_name = name.to_s.delete_prefix('_') resources_by_type['SearchParameter'].find do |param| param.id == "us-core-#{resource.downcase}-#{normalized_name}" || param.name == name end end |
#value_set_by_url(url) ⇒ Object
32 33 34 |
# File 'lib/cancer_registry_reporting_test_kit/hdea_generator/ig_resources.rb', line 32 def value_set_by_url(url) resources_by_type['ValueSet'].find { |profile| profile.url == url } end |