Class: HealthDataStandards::Import::GreenC32::SupportImporter

Inherits:
SectionImporter
  • Object
show all
Includes:
Singleton
Defined in:
lib/health-data-standards/import/green_c32/support_importer.rb

Instance Method Summary collapse

Methods inherited from SectionImporter

#extract_address, #extract_code, #extract_description, #extract_effective_time, #extract_entry, #extract_facility, #extract_interval, #extract_name, #extract_organization, #extract_quantity, #extract_status, #extract_telecom, #extract_time, #extract_value, #generic_import, #initialize

Constructor Details

This class inherits a constructor from HealthDataStandards::Import::GreenC32::SectionImporter

Instance Method Details

#import(support_doc) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/health-data-standards/import/green_c32/support_importer.rb', line 7

def import(support_doc)
  support_doc.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
  support_element = support_doc.at_xpath("./gc32:support")
  support = Support.new(type: support_element.at_xpath("./gc32:type").try(:content),
                        relationship: support_element.at_xpath("./gc32:relationship").try(:text))
  extract_name(support_element, support)
  support.address = extract_address(support_element.at_xpath("./gc32:address"))
  support.telecom = extract_telecom(support_element.at_xpath("./gc32:telecom"))
  support.mothers_maiden_name = support_element.at_xpath("./gc32:mothersMaidenName").try(:text)
  support
end