Sha256: ee02c0f155694053cc93e1b82f66ad3d30fbd904fcb451a97571401fa07462ca

Contents?: true

Size: 1.41 KB

Versions: 10

Compression:

Stored size: 1.41 KB

Contents

module HealthDataStandards
  module Import
    module CDA
      class ResultImporter < SectionImporter
        def initialize(entry_finder=EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.15.1'] | //cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.15']"))
          super(entry_finder)
          @entry_class = LabResult
        end
        
        def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
          result = super
          extract_interpretation(entry_element, result)
          extract_reference_range(entry_element, result)
          extract_negation(entry_element, result)
          extract_reason_description(entry_element, result, nrh)
          result
        end
    
        private
        def extract_interpretation(parent_element, result)
          interpretation_element = parent_element.at_xpath("./cda:interpretationCode")
          if interpretation_element
            code = interpretation_element['code']
            code_system = CodeSystemHelper.code_system_for(interpretation_element['codeSystem'])
            result.interpretation = {'code' => code, 'codeSystem' => code_system}
          end
        end

        def extract_reference_range(parent_element, result)
          result.reference_range = parent_element.at_xpath("./cda:referenceRange/cda:observationRange/cda:text").try(:text)
        end
    
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
health-data-standards-3.6.1 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.5.3 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.5.2 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.5.1 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.5.0 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.4.6 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.4.5 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.4.4 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.4.3 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.4.2 lib/health-data-standards/import/cda/result_importer.rb