class SimpleXml::Attribute

Attributes

code_list_id[R]
id[R]
title[R]

Public Class Methods

new(id, code_list_id, title) click to toggle source
# File lib/model/types.rb, line 229
def initialize(id, code_list_id, title)
  @id = id
  @code_list_id = code_list_id
  @title = title
end
translate_attribute(attribute, doc) click to toggle source
# File lib/model/types.rb, line 235
def self.translate_attribute(attribute, doc)
  mode = attribute.at_xpath('@mode').value
  case mode
  when 'Value Set'
    attribute_entry = doc.attribute_map[attribute.at_xpath('@qdmUUID').value]
    Coded.new(attribute_entry.code_list_id,attribute_entry.title)
  when 'Check if Present'
    AnyValue.new
  else
    if attribute.at_xpath('@attrDate')
      date = attribute.at_xpath('@attrDate').value
      unit = attribute.at_xpath('@unit').try(:value) # should this be the comparison granularity?
      Utilities.build_value(mode, date, unit, 'IVL_TS')
    else
      quantity = attribute.at_xpath('@comparisonValue').value
      unit = attribute.at_xpath('@unit').try(:value)
      Utilities.build_value(mode, quantity, unit)
    end
  end
end