Class: DaVinciPlanNetTestKit::Generator::IGMetadataExtractor
- Inherits:
-
Object
- Object
- DaVinciPlanNetTestKit::Generator::IGMetadataExtractor
- Defined in:
- lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb
Instance Attribute Summary collapse
-
#ig_resources ⇒ Object
Returns the value of attribute ig_resources.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
Instance Method Summary collapse
- #add_metadata_from_ig ⇒ Object
- #add_metadata_from_resources ⇒ Object
- #add_missing_supported_profiles ⇒ Object
- #extract ⇒ Object
-
#initialize(ig_resources) ⇒ IGMetadataExtractor
constructor
A new instance of IGMetadataExtractor.
- #remove_extra_supported_profiles ⇒ Object
- #resources_in_capability_statement ⇒ Object
Constructor Details
#initialize(ig_resources) ⇒ IGMetadataExtractor
Returns a new instance of IGMetadataExtractor.
9 10 11 12 13 14 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 9 def initialize(ig_resources) self.ig_resources = ig_resources add_missing_supported_profiles #remove_extra_supported_profiles self. = IGMetadata.new end |
Instance Attribute Details
#ig_resources ⇒ Object
Returns the value of attribute ig_resources.
7 8 9 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 7 def ig_resources @ig_resources end |
#metadata ⇒ Object
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 7 def @metadata end |
Instance Method Details
#add_metadata_from_ig ⇒ Object
22 23 24 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 22 def .ig_version = "v#{ig_resources.ig.version}" end |
#add_metadata_from_resources ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 45 def .groups = resources_in_capability_statement.flat_map do |resource| resource.supportedProfile&.map do |supported_profile| next if supported_profile == 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire' GroupMetadataExtractor.new(resource, supported_profile, , ig_resources). end end.compact .postprocess_groups(ig_resources) end |
#add_missing_supported_profiles ⇒ Object
30 31 32 33 34 35 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 30 def add_missing_supported_profiles case ig_resources.ig.version when '1.1.0' # This is the only expected version currently, just leaving this blank for now. end end |
#extract ⇒ Object
16 17 18 19 20 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 16 def extract end |
#remove_extra_supported_profiles ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 37 def remove_extra_supported_profiles ig_resources.capability_statement.rest.first.resource .find { |resource| resource.type == 'Observation' } .supportedProfile.delete_if do |profile_url| SpecialCases::PROFILES_TO_EXCLUDE.include?(profile_url) end end |
#resources_in_capability_statement ⇒ Object
26 27 28 |
# File 'lib/davinci_plan_net_test_kit/generator/ig_metadata_extractor.rb', line 26 def resources_in_capability_statement ig_resources.capability_statement.rest.first.resource end |