Sha256: f25f31b8f9e7797c1c6cdc8b92e073c5694004cde628a4697a5a6864c2db4b80

Contents?: true

Size: 1.42 KB

Versions: 16

Compression:

Stored size: 1.42 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_reason_or_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

16 entries across 16 versions & 1 rubygems

Version Path
health-data-standards-4.3.5 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.3.4 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.3.3 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.3.2 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.3.1 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.3.0 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.2.0 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.1.0 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.0.6 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.0.5 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.0.4 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.0.3 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.0.2 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.0.1 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-4.0.0 lib/health-data-standards/import/cda/result_importer.rb
health-data-standards-3.7.0 lib/health-data-standards/import/cda/result_importer.rb