Sha256: 8faeb9b9a37a2de0c64aff79e86b01875c2e8708a56368de3517e833b54ce6f2

Contents?: true

Size: 1.61 KB

Versions: 10

Compression:

Stored size: 1.61 KB

Contents

module HealthDataStandards
  module Import
    module C32
      class MedicalEquipmentImporter < SectionImporter
        
        def initialize
          @entry_xpath = "//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.128']/cda:entry/cda:supply"
          @code_xpath = "./cda:participant/cda:participantRole/cda:playingDevice/cda:code"
          @description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value]"
          @check_for_usable = true
        end
        
        def create_entries(doc,id_map = {})
          entry_list = []
          entry_elements = doc.xpath(@entry_xpath)
          entry_elements.each do |entry_element|
            entry = create_entry(entry_element, id_map)
            if @check_for_usable
              entry_list << entry if entry.usable?
            else
              entry_list << entry
            end
          end
          entry_list
        end
        
        def create_entry(entry_element, id_map={})
          entry = MedicalEquipment.new
          extract_codes(entry_element, entry)
          extract_dates(entry_element, entry)
          extract_value(entry_element, entry)
          
          extract_description(entry_element, entry, id_map)
          extract_manufacturer(entry_element, entry)
          entry
        end
        
        def extract_manufacturer(entry_element, entry)
          manufacturer = entry_element.at_xpath("./cda:participant/cda:participantRole/cda:scopingEntity/cda:desc").try(:inner_text)
          entry.manufacturer = manufacturer.strip if manufacturer
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
health-data-standards-2.2.1 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-2.2.0 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-2.1.4 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-2.1.3 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-2.1.2 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-2.1.1 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-2.1.0 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-2.0.0 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-1.0.1 lib/health-data-standards/import/c32/medical_equipment_importer.rb
health-data-standards-1.0.0 lib/health-data-standards/import/c32/medical_equipment_importer.rb