Sha256: ddaf4a706c3a07f78025a6aea8cfa535953cc367652e23750de311bdb5a104c8

Contents?: true

Size: 1.6 KB

Versions: 19

Compression:

Stored size: 1.6 KB

Contents

module HealthDataStandards
  module Import
    module CDA
      class AllergyImporter < SectionImporter
    
        def initialize(entry_finder=EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.18']"))
          @entry_finder = entry_finder
          @code_xpath = "./cda:participant/cda:participantRole/cda:playingEntity/cda:code"
          @description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value]"
          @type_xpath = "./cda:code"
          @free_text_xpath= "./cda:participant/cda:participantRole/cda:playingEntity/cda:name"
          @reaction_xpath = "./cda:entryRelationship[@typeCode='MFST']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.54']/cda:value"
          @severity_xpath = "./cda:entryRelationship[@typeCode='SUBJ']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.55']/cda:value"
          @status_xpath   = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.39']/cda:value"
          @entry_class = Allergy
        end
    
        def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
          allergy = super
          allergy.free_text = entry_element.at_xpath(@free_text_xpath).try(:text)
          extract_negation(entry_element, allergy)
          allergy.type = extract_code(entry_element, @type_xpath)
          allergy.reaction = extract_code(entry_element, @reaction_xpath)
          allergy.severity = extract_code(entry_element, @severity_xpath)

          allergy
        end
        
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
health-data-standards-3.2.12 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.3.0 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.11 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.10 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.8 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.7 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.6 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.5 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.4 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.3 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.2 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.1 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.2.0 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.1.1 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.1.0 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.0.6 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.0.5 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.0.4 lib/health-data-standards/import/cda/allergy_importer.rb
health-data-standards-3.0.3 lib/health-data-standards/import/cda/allergy_importer.rb