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.167 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.166 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.165 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.164 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.163 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.162 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.161 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.160 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.159 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.158 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.157 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.156 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.155 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.153 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.152 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.151 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.149 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.148 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.147 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb
renalware-core-2.0.146 app/models/renalware/ukrdc/outgoing/rendering/primary_language.rb