Class: HealthDataStandards::Import::CDA::EncounterImporter

Inherits:
SectionImporter
  • Object
show all
Defined in:
lib/health-data-standards/import/cda/encounter_importer.rb

Overview

TODO Extract Discharge Disposition

Instance Attribute Summary

Attributes inherited from SectionImporter

#check_for_usable, #code_xpath, #status_xpath

Instance Method Summary collapse

Methods inherited from SectionImporter

#create_entries

Methods included from LocatableImportUtils

#import_address, #import_telecom

Constructor Details

#initialize(entry_finder = EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.127']/cda:entry/cda:encounter")) ⇒ EncounterImporter

Returns a new instance of EncounterImporter.



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

def initialize(entry_finder=EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.127']/cda:entry/cda:encounter"))
  super(entry_finder)
  @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:act"
  @entry_class = Encounter
end

Instance Method Details

#create_entry(entry_element, nrh = NarrativeReferenceHandler.new) ⇒ Object



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

def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
  encounter = super
  extract_performer(entry_element, encounter)
  extract_facility(entry_element, encounter)
  extract_reason(entry_element, encounter, nrh)
  extract_reason_or_negation(entry_element, encounter)
  extract_admission(entry_element, encounter)
  extract_discharge_disposition(entry_element, encounter)
  transfer_elements = entry_element.xpath("./cda:participant[@typeCode='ORG' or 'DST']")
  if transfer_elements
    transfer_elements.each do |transfer_element|
      extract_transfer(transfer_element, encounter)
    end
  end
  encounter
end