module Qrda module Export module Helper module Cat1ViewHelper def negation_ind self[:negationRationale].nil? ? "" : "negationInd=\"true\"" end def negated self[:negationRationale].nil? ? false : true end def multiple_codes? self[:dataElementCodes].size > 1 end def display_author_dispenser_id? self['qdmCategory'] == 'medication' && self['qdmStatus'] == 'dispensed' end def display_author_prescriber_id? self['qdmCategory'] == 'medication' && self['qdmStatus'] == 'order' end def id_or_null_flavor return "" if self['namingSystem'] && self['value'] "" end def code_system_oid(data_element_code) data_element_code['codeSystemOid'] || HQMF::Util::CodeSystemHelper.oid_for_code_system(data_element_code['codeSystem']) end def code_and_codesystem if self['codeSystem'] == 'NA_VALUESET' "nullFlavor=\"NA\" sdtc:valueSet=\"#{self['code']}\"" else "code=\"#{self['code']}\" codeSystem=\"#{code_system_oid(self)}\" codeSystemName=\"#{self['codeSystem']}\"" end end def primary_code_and_codesystem "code=\"#{self[:dataElementCodes][0]['code']}\" codeSystem=\"#{code_system_oid(self[:dataElementCodes][0])}\" codeSystemName=\"#{self[:dataElementCodes][0]['codeSystem']}\"" end def translation_codes_and_codesystem_list translation_list = "" self[:dataElementCodes].each_with_index do |_dec, index| next if index.zero? translation_list += "" end translation_list end def result_value return "" 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'].nil? "" end result_string end def result_value_as_string(result) return "" unless result return "" if result['code'] return "" if result['unit'] end def authordatetime_or_dispenserid? self['authorDatetime'] || self['dispenserId'] end end end end end