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.0.147 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.146 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.145 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.144 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.143 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.142 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.141 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.140 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.139 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.138 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.137 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.136 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.135 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.134 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.133 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.132 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.131 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.130 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.129 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb
renalware-core-2.0.128 app/models/renalware/ukrdc/treatment_timeline/hd/modality_code_map.rb