Class: HealthDataStandards::Import::GreenC32::EncounterImporter

Inherits:
SectionImporter
  • Object
show all
Includes:
Singleton
Defined in:
lib/health-data-standards/import/green_c32/encounter_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

Constructor Details

#initializeEncounterImporter

Returns a new instance of EncounterImporter.



7
8
9
# File 'lib/health-data-standards/import/green_c32/encounter_importer.rb', line 7

def initialize
  super
end

Instance Method Details

#import(encounter_xml) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/health-data-standards/import/green_c32/encounter_importer.rb', line 11

def import(encounter_xml)
  encounter = Encounter.new
  encounter_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
  encounter_element = encounter_xml.xpath("/gc32:encounter")
  extract_entry(encounter_element, encounter)
  extract_code(encounter_element, encounter, "./gc32:dischargeDisposition", :discharge_disposition)
  extract_code(encounter_element, encounter, "./gc32:admissionType", :admit_type)
  extract_code(encounter_element, encounter, "./gc32:reasonForVisit", :reason)
  extract_code(encounter_element, encounter)
  
  facility_element = encounter_element.at_xpath("./gc32:facility")
  if facility_element
    facility = extract_facility(facility_element)
    encounter.facility = facility
  end

  encounter
end