Sha256: a22a65816bce61339121ab91460e85de9aec302a70745e0777e762f4c676f5c8

Contents?: true

Size: 1 KB

Versions: 35

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module Renalware
  module UKRDC
    module Outgoing
      module Rendering
        class PrimaryLanguage < Rendering::Base
          pattr_initialize [:patient!]

          def xml
            return unless render_primary_language?

            primary_langauge_element
          end

          private

          # Omit 'Other' language as it is not part of the ISO set, but we have it for some reason
          def render_primary_language?
            patient.language.present? && patient.language.code != "ot"
          end

          # NB NHS_DATA_DICTIONARY_LANGUAGE_CODE is ISO 639-1 plus braille and sign
          def primary_langauge_element
            create_node("PrimaryLanguage") do |lang|
              lang << create_node("CodingStandard", "NHS_DATA_DICTIONARY_LANGUAGE_CODE")
              lang << create_node("Code", patient.language&.code)
              lang << create_node("Description", patient.language)
            end
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
renalware-core-2.0.145 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.144 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.143 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.142 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.141 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.140 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.139 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.138 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.137 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.136 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.135 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.134 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.133 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.132 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.131 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb