Sha256: 69f658d65c10621fc2a5f91e0d9fdf1970e84f5e19031bb69780d50ae848a153

Contents?: true

Size: 614 Bytes

Versions: 62

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

require "document/enum"

module Renalware
  class SmokingStatus < NestedAttribute
    SMOKING_SNOMED_MAP = {
      current: { code: 77176002, description: "Current" },
      non_smoker: { code: 8392000, description: "Non" },
      ex_smoker: { code: 8517006, description: "Ex" }
    }.freeze

    attribute :value,
              Document::Enum,
              enums: %i(non_smoker ex_smoker current)

    def snomed_code
      SMOKING_SNOMED_MAP.dig(value&.to_sym, :code)
    end

    def snomed_description
      SMOKING_SNOMED_MAP.dig(value&.to_sym, :description)
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
renalware-core-2.0.104 app/documents/renalware/smoking_status.rb
renalware-core-2.0.103 app/documents/renalware/smoking_status.rb