Class: DaVinciPASTestKit::Generator::IGMetadataExtractor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ig_resources) ⇒ IGMetadataExtractor

Returns a new instance of IGMetadataExtractor.



9
10
11
12
# File 'lib/davinci_pas_test_kit/generator/ig_metadata_extractor.rb', line 9

def initialize(ig_resources)
  self.ig_resources = ig_resources
  self. = .new
end

Instance Attribute Details

#ig_resourcesObject

Returns the value of attribute ig_resources.



7
8
9
# File 'lib/davinci_pas_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/davinci_pas_test_kit/generator/ig_metadata_extractor.rb', line 7

def 
  
end

Instance Method Details

#add_metadata_from_igObject



20
21
22
# File 'lib/davinci_pas_test_kit/generator/ig_metadata_extractor.rb', line 20

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

#add_metadata_from_resourcesObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/davinci_pas_test_kit/generator/ig_metadata_extractor.rb', line 42

def 
  .groups =
    resources_in_capability_statement.flat_map do |resource|
      resource.supportedProfile&.map do |supported_profile|
        GroupMetadataExtractor.new(resource, supported_profile, , ig_resources).
      end
    end

  .postprocess_groups(ig_resources)
end

#extractObject



14
15
16
17
18
# File 'lib/davinci_pas_test_kit/generator/ig_metadata_extractor.rb', line 14

def extract
  
  
  
end

#resources_in_capability_statementObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/davinci_pas_test_kit/generator/ig_metadata_extractor.rb', line 24

def resources_in_capability_statement
  # TODO: uncomment bellow when PAS IG will have a solid capability statement.
  # ig_resources.capability_statement.rest.first.resource

  # Work around for the code above to extract the IG supported profiles/resources
  resources = []
  ig_resources.base_resources_and_supported_profiles.each do |k, v|
    resource = FHIR::CapabilityStatement::Rest::Resource.new(
      type: k,
      supportedProfile: v,
      operation: k == 'Claim' ? [{ name: '$submit' }, { name: '$inquire' }] : []
    )
    resources << resource
  end

  resources
end