Module: HealthDataStandards::Export::Helper::GC32ViewHelper
- Defined in:
- lib/health-data-standards/export/helper/gc32_view_helper.rb
Instance Method Summary collapse
- #gc32_code_display(entry, options = {}) ⇒ Object
- #gc32_effective_time(entry) ⇒ Object
- #gc32_interval(entry, tag_name, start_attribute, end_attribute) ⇒ Object
- #quantity_display(value, tag_name = "value") ⇒ Object
Instance Method Details
#gc32_code_display(entry, options = {}) ⇒ Object
5 6 7 |
# File 'lib/health-data-standards/export/helper/gc32_view_helper.rb', line 5 def gc32_code_display(entry, ={}) code_display(entry, .merge("exclude_null_flavor" => true)) end |
#gc32_effective_time(entry) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/health-data-standards/export/helper/gc32_view_helper.rb', line 9 def gc32_effective_time(entry) if entry.time "<effectiveTime value=\"#{Time.at(entry.time).xmlschema}\" />" elsif entry.start_time || entry.end_time gc32_interval(entry, "effectiveTime", :start_time, :end_time) else "<effectiveTime />" end end |
#gc32_interval(entry, tag_name, start_attribute, end_attribute) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/health-data-standards/export/helper/gc32_view_helper.rb', line 19 def gc32_interval(entry, tag_name, start_attribute, end_attribute) time = "<#{tag_name}>" time += "<start value=\"#{Time.at(entry.send(start_attribute)).xmlschema}\" />" if entry.send(start_attribute) time += "<end value=\"#{Time.at(entry.send(end_attribute)).xmlschema}\" />" if entry.send(end_attribute) time += "</#{tag_name}>" end |
#quantity_display(value, tag_name = "value") ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/health-data-standards/export/helper/gc32_view_helper.rb', line 26 def quantity_display(value, tag_name="value") return unless value if value.respond_to?(:scalar) "<#{tag_name} amount=\"#{value.scalar}\" unit=\"#{value.units}\" />" elsif value['scalar'].present? "<#{tag_name} amount=\"#{value['scalar']}\" unit=\"#{value['units']}\" />" else "<#{tag_name} amount=\"#{value['value']}\" unit=\"#{value['unit']}\" />" end end |