Sha256: eddc73a07150a158bc3bf045b3863f5a2223fcc1a1e8c6242962513ada819e51

Contents?: true

Size: 736 Bytes

Versions: 75

Compression:

Stored size: 736 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/ukrdc"

module Renalware
  module UKRDC
    module TreatmentTimeline
      module HD
        class ModalityCodeMap
          def code_for_profile(profile)
            hd_type = profile&.hd_type
            return default_code if hd_type.blank?

            ukrr_name = case hd_type.to_s.downcase
                        when "hd" then "Haemodialysis"
                        when "hdf_pre", "hdf_post" then "Haemodiafiltration"
                        end

            ModalityCode.find_by!(description: ukrr_name)
          end

          def default_code
            ModalityCode.find_by!(description: "Haemodialysis")
          end
        end
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.1.0 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.167 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.166 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.165 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.164 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.163 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.162 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.161 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.160 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.159 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.158 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.157 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.156 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.155 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.153 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.152 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.151 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.149 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.148 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb