# File lib/qrda-export/helper/cat1_view_helper.rb, line 39 def primary_code_and_codesystem oid = self[:dataElementCodes][0]['system'] || self[:dataElementCodes][0]['codeSystem'] "code=\"#{self[:dataElementCodes][0]['code']}\" codeSystem=\"#{oid}\" codeSystemName=\"#{HQMF::Util::CodeSystemHelper.code_system_for(oid)}\"" end
module Qrda::Export::Helper::Cat1ViewHelper
Public Instance Methods
code_and_codesystem()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 30 def code_and_codesystem oid = self['system'] || self['codeSystem'] if oid == '1.2.3.4.5.6.7.8.9.10' "nullFlavor=\"NA\" sdtc:valueSet=\"#{self['code']}\"" else "code=\"#{self['code']}\" codeSystem=\"#{oid}\" codeSystemName=\"#{HQMF::Util::CodeSystemHelper.code_system_for(oid)}\"" end end
dose_quantity_value()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 58 def dose_quantity_value return "<doseQuantity value=\"#{value_as_float}\" unit=\"#{self['unit']}\"/>" if self['unit'] "<doseQuantity value=\"#{value_as_float}\" />" end
id_or_null_flavor()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 25 def id_or_null_flavor return "<id root=\"#{self['namingSystem']}\" extension=\"#{self['value']}\"/>" if self['namingSystem'] && self['value'] "<id nullFlavor=\"NA\"/>" end
multiple_codes?()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 13 def multiple_codes? self[:dataElementCodes].size > 1 end
negated()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 9 def negated self[:negationRationale].nil? ? false : true end
negation_ind()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 5 def negation_ind self[:negationRationale].nil? ? "" : "negationInd=\"true\"" end
primary_code_and_codesystem()
click to toggle source
result_value()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 63 def result_value return "<value xsi:type=\"CD\" nullFlavor=\"UNK\"/>" unless self['result'] result_string = if self['result'].is_a? Array result_value_as_string(self['result'][0]) elsif self['result'].is_a? Hash result_value_as_string(self['result']) elsif self['result'].is_a? String "<value xsi:type=\"ST\">#{self['result']}</value>" elsif !self['result'].nil? "<value xsi:type=\"PQ\" value=\"#{self['result']}\" unit=\"1\"/>" end result_string end
result_value_as_string(result)
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 78 def result_value_as_string(result) return "<value xsi:type=\"CD\" nullFlavor=\"UNK\"/>" unless result oid = result['system'] || result['codeSystem'] return "<value xsi:type=\"CD\" code=\"#{result['code']}\" codeSystem=\"#{oid}\" codeSystemName=\"#{HQMF::Util::CodeSystemHelper.code_system_for(oid)}\"/>" if result['code'] return "<value xsi:type=\"PQ\" value=\"#{result['value']}\" unit=\"#{result['unit']}\"/>" if result['unit'] end
translation_codes_and_codesystem_list()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 44 def translation_codes_and_codesystem_list translation_list = "" self[:dataElementCodes].each_with_index do |_dec, index| next if index.zero? oid = self[:dataElementCodes][index]['system'] || self[:dataElementCodes][index]['codeSystem'] translation_list += "<translation code=\"#{self[:dataElementCodes][index]['code']}\" codeSystem=\"#{oid}\" codeSystemName=\"#{HQMF::Util::CodeSystemHelper.code_system_for(oid)}\"/>" end translation_list end
value_as_float()
click to toggle source
# File lib/qrda-export/helper/cat1_view_helper.rb, line 54 def value_as_float self['value'].to_f end