Module: HealthDataStandards::Import::CDA::LocatableImportUtils

Included in:
HealthDataStandards::Import::C32::PatientImporter, SectionImporter
Defined in:
lib/health-data-standards/import/cda/locatable_import_utils.rb

Overview

Helpers for importing C32 addresses and telecoms

Instance Method Summary collapse

Instance Method Details

#import_address(address_element) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/health-data-standards/import/cda/locatable_import_utils.rb', line 6

def import_address(address_element)
  address = Address.new
  address.use = address_element['use']
  address.street = address_element.xpath("./cda:streetAddressLine").map {|street| street.text}
  address.city = address_element.at_xpath("./cda:city").try(:text)
  address.state = address_element.at_xpath("./cda:state").try(:text)
  address.zip = address_element.at_xpath("./cda:postalCode").try(:text)
  address.country = address_element.at_xpath("./cda:country").try(:text)
  address
end

#import_telecom(telecom_element) ⇒ Object



17
18
19
20
21
22
# File 'lib/health-data-standards/import/cda/locatable_import_utils.rb', line 17

def import_telecom(telecom_element)
  tele = Telecom.new
  tele.value = telecom_element['value']
  tele.use = telecom_element['use']
  tele
end