Sha256: 4b968342e444a40ebe9c3318333ace7796b0a19b42913a0f783e524e62337062
Contents?: true
Size: 932 Bytes
Versions: 8
Compression:
Stored size: 932 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 qdmCategory 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
8 entries across 8 versions & 1 rubygems