Class: HealthDataStandards::Import::Cat1::DiagnosisActiveImporter

Inherits:
HealthDataStandards::Import::CDA::ConditionImporter show all
Defined in:
lib/health-data-standards/import/cat1/diagnosis_active_importer.rb

Instance Attribute Summary

Attributes inherited from HealthDataStandards::Import::CDA::SectionImporter

#check_for_usable, #code_xpath, #status_xpath

Instance Method Summary collapse

Methods inherited from HealthDataStandards::Import::CDA::SectionImporter

#create_entries

Methods included from HealthDataStandards::Import::CDA::LocatableImportUtils

#import_address, #import_telecom

Constructor Details

#initializeDiagnosisActiveImporter

Returns a new instance of DiagnosisActiveImporter.



6
7
8
9
10
11
# File 'lib/health-data-standards/import/cat1/diagnosis_active_importer.rb', line 6

def initialize
  super(CDA::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.11']"))
  @status_xpath = nil # We'll hardcode this to active in create entry because this is from the 
                      # diagnosis active template
  @severity_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.8']/cda:value"                    
end

Instance Method Details

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



13
14
15
16
17
# File 'lib/health-data-standards/import/cat1/diagnosis_active_importer.rb', line 13

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

#extract_severity(entry_element, condition) ⇒ Object



19
20
21
22
23
24
# File 'lib/health-data-standards/import/cat1/diagnosis_active_importer.rb', line 19

def extract_severity(entry_element,condition)
  severity = entry_element.at_xpath(@severity_xpath)
  if(severity)
    condition.severity = {CodeSystemHelper.code_system_for(severity['codeSystem']) => [severity['code']]}
  end
end