Module: Qrda::Export::Helper::Cat1ViewHelper
- Included in:
- Qrda1R5
- Defined in:
- lib/qrda-export/helper/cat1_view_helper.rb
Instance Method Summary collapse
- #authordatetime_or_dispenserid? ⇒ Boolean
- #code_and_codesystem ⇒ Object
- #display_author_dispenser_id? ⇒ Boolean
- #display_author_prescriber_id? ⇒ Boolean
- #dose_quantity_value ⇒ Object
- #id_or_null_flavor ⇒ Object
- #multiple_codes? ⇒ Boolean
- #negated ⇒ Object
- #negation_ind ⇒ Object
- #primary_code_and_codesystem ⇒ Object
- #result_value ⇒ Object
- #result_value_as_string(result) ⇒ Object
- #translation_codes_and_codesystem_list ⇒ Object
- #value_as_float ⇒ Object
Instance Method Details
#authordatetime_or_dispenserid? ⇒ Boolean
85 86 87 |
# File 'lib/qrda-export/helper/cat1_view_helper.rb', line 85 def self['authorDatetime'] || self['dispenserId'] end |
#code_and_codesystem ⇒ Object
30 31 32 33 34 35 36 37 |
# 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 |
#display_author_dispenser_id? ⇒ Boolean
17 18 19 |
# File 'lib/qrda-export/helper/cat1_view_helper.rb', line 17 def self['qdmCategory'] == 'medication' && self['qdmStatus'] == 'dispensed' end |
#display_author_prescriber_id? ⇒ Boolean
21 22 23 |
# File 'lib/qrda-export/helper/cat1_view_helper.rb', line 21 def self['qdmCategory'] == 'medication' && self['qdmStatus'] == 'order' end |
#dose_quantity_value ⇒ Object
58 59 60 61 |
# 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 ⇒ Object
25 26 27 28 |
# 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? ⇒ Boolean
13 14 15 |
# File 'lib/qrda-export/helper/cat1_view_helper.rb', line 13 def multiple_codes? self[:dataElementCodes].size > 1 end |
#negated ⇒ Object
9 10 11 |
# File 'lib/qrda-export/helper/cat1_view_helper.rb', line 9 def negated self[:negationRationale].nil? ? false : true end |
#negation_ind ⇒ Object
5 6 7 |
# File 'lib/qrda-export/helper/cat1_view_helper.rb', line 5 def negation_ind self[:negationRationale].nil? ? "" : "negationInd=\"true\"" end |
#primary_code_and_codesystem ⇒ Object
39 40 41 42 |
# 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 |
#result_value ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# 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) ⇒ Object
78 79 80 81 82 83 |
# 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 ⇒ Object
44 45 46 47 48 49 50 51 52 |
# 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 ⇒ Object
54 55 56 |
# File 'lib/qrda-export/helper/cat1_view_helper.rb', line 54 def value_as_float self['value'].to_f end |