Class: HealthDataStandards::Import::CDA::ConditionImporter

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

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.103']/cda:entry/cda:act/cda:entryRelationship/cda:observation")) ⇒ ConditionImporter

Returns a new instance of ConditionImporter.



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

def initialize(entry_finder=EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.103']/cda:entry/cda:act/cda:entryRelationship/cda:observation"))
  @entry_finder = entry_finder
  @code_xpath = "./cda:value"
  @id_xpath = "./cda:id"
  @status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.50']/cda:value"
  @ordinality_xpath = "./cda:priorityCode"
  @description_xpath = "./cda:text/cda:reference[@value]"
  @provider_xpath = "./cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.27']/cda:performer"
  @priority_xpath = "../cda:sequenceNumber"
  @entry_class = Condition
  @value_xpath = nil
end

Instance Method Details

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/health-data-standards/import/cda/condition_importer.rb', line 19

def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
  condition = super

  extract_ordinality(entry_element, condition)
  extract_reason_or_negation(entry_element, condition)
  extract_priority(entry_element, condition)

  if @provider_xpath
    entry_element.xpath(@provider_xpath).each do |provider_element|
      condition.treating_provider << import_actor(provider_element)
    end
  end

  condition
end