Class: IpaTestKit::Generator::IGMetadataExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/ipa_test_kit/generator/ig_metadata_extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ig_resources, base_search_params) ⇒ IGMetadataExtractor

Returns a new instance of IGMetadataExtractor.



9
10
11
12
13
14
15
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 9

def initialize(ig_resources, base_search_params)
  self.ig_resources = ig_resources
  self.base_search_params = base_search_params
  add_missing_supported_profiles
  remove_extra_supported_profiles
  self. = IGMetadata.new
end

Instance Attribute Details

#base_search_paramsObject

Returns the value of attribute base_search_params.



7
8
9
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 7

def base_search_params
  @base_search_params
end

#ig_resourcesObject

Returns the value of attribute ig_resources.



7
8
9
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 7

def ig_resources
  @ig_resources
end

#metadataObject

Returns the value of attribute metadata.



7
8
9
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 7

def 
  @metadata
end

Instance Method Details

#add_metadata_from_igObject



23
24
25
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 23

def 
  .ig_version = "v#{ig_resources.ig.version}"
end

#add_metadata_from_resourcesObject



47
48
49
50
51
52
53
54
55
56
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 47

def 
  .groups =
    resources_in_capability_statement.flat_map do |resource|
      ([resource.profile] + resource.supportedProfile).uniq&.map do |supported_profile|
        GroupMetadataExtractor.new(resource, supported_profile, , ig_resources, base_search_params).
      end.compact
    end

  .postprocess_groups(ig_resources)
end

#add_missing_supported_profilesObject



31
32
33
34
35
36
37
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 31

def add_missing_supported_profiles
  ig_resources.capability_statement.rest.first.resource
    .find { |resource| resource.type == 'Observation' }
    .supportedProfile.concat [
      'http://hl7.org/fhir/StructureDefinition/vitalsigns'
    ]
end

#extractObject



17
18
19
20
21
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 17

def extract
  
  
  
end

#remove_extra_supported_profilesObject



39
40
41
42
43
44
45
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 39

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_statementObject



27
28
29
# File 'lib/ipa_test_kit/generator/ig_metadata_extractor.rb', line 27

def resources_in_capability_statement
  ig_resources.capability_statement.rest.first.resource
end