Sha256: 221feb76919d10def15a9b4a94ca02c5f92adae4fd65ae10d85b4e3bebc4b686

Contents?: true

Size: 915 Bytes

Versions: 20

Compression:

Stored size: 915 Bytes

Contents

module HealthDataStandards
  module Import
    module Cat1
      class MedicationActiveImporter < CDA::MedicationImporter

        def initialize
          super(CDA::EntryFinder.new("//cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.41']"))
        end

        def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
          medication = super
          calculate_cumulative_medication_duration(medication)
          medication
        end

        private

        def calculate_cumulative_medication_duration(medication)
          if medication.start_time.present? && medication.end_time.present?
            duration_in_days = ((medication.end_time - medication.start_time) / (60*60*24)).floor + 1
            medication.cumulative_medication_duration = {'scalar' => duration_in_days, 'units' => 'days'}
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
health-data-standards-3.4.4 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.4.3 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.4.2 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.4.1 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.4.0 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.12 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.3.0 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.11 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.10 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.8 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.7 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.6 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.5 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.4 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.3 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.2 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.1 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.2.0 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.1.1 lib/health-data-standards/import/cat1/medication_active_importer.rb
health-data-standards-3.1.0 lib/health-data-standards/import/cat1/medication_active_importer.rb