Sha256: ed4362cb28422cda3968c07902248adfc9c3f08aac56325976554d340599dd21

Contents?: true

Size: 929 Bytes

Versions: 14

Compression:

Stored size: 929 Bytes

Contents

module QDM
  class DataElement
    def merge!(other)
      # ensure they're the same category (e.g. 'encounter')
      return unless qdmCategory == other.qdmCategory

      # ensure they're the same status (e.g. 'performed'), and that they both have a status set (or that they both don't)
      return if respond_to?(:qdmStatus) && !other.respond_to?(:qdmStatus)
      return if !respond_to?(:qdmStatus) && other.respond_to?(:qdmStatus)
      return if respond_to?(:qdmStatus) && other.respond_to?(:qdmStatus) && qdmStatus != other.qdmStatus
      
      # iterate over non-code fields
      fields.each_key do |field|
        next if field[0] == '_' || %w[dataElementCodes category qdmVersion qdmStatus].include?(field)
        
        if send(field).nil?
          send(field + '=', other.send(field))
        end
      end

      self.dataElementCodes = dataElementCodes.concat(other.dataElementCodes).uniq
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cqm-parsers-4.1.1.0 lib/ext/data_element.rb
cqm-parsers-4.1.0.2 lib/ext/data_element.rb
cqm-parsers-4.1.0.1 lib/ext/data_element.rb
cqm-parsers-4.1.0.0 lib/ext/data_element.rb
cqm-parsers-4.0.0.1 lib/ext/data_element.rb
cqm-parsers-3.2.0.2 lib/ext/data_element.rb
cqm-parsers-4.0.0.0 lib/ext/data_element.rb
cqm-parsers-3.2.0.1 lib/ext/data_element.rb
cqm-parsers-3.2.0.0 lib/ext/data_element.rb
cqm-parsers-3.1.1.0 lib/ext/data_element.rb
cqm-parsers-3.1.0.0 lib/ext/data_element.rb
cqm-parsers-3.0.0.0 lib/ext/data_element.rb
cqm-parsers-2.0.1 lib/ext/data_element.rb
cqm-parsers-2.0.0 lib/ext/data_element.rb