module Qrda::Export::Helper::FrequencyHelper

Constants

FREQUENCY_CODE_MAP

FREQUENCY_CODE_MAP extracted from Direct Reference Codes in Opioid_v5_6_eCQM.xml (CMS460v0)

Public Instance Methods

institution_not_specified_point_frequency(frequency_code_entry) click to toggle source
# File lib/qrda-export/helper/frequency_helper.rb, line 51
def institution_not_specified_point_frequency(frequency_code_entry)
  "<effectiveTime xsi:type='PIVL_TS' operator='A'>"\
  "<period value='#{frequency_code_entry[:low]}' unit='#{frequency_code_entry[:unit]}'/>"\
  "</effectiveTime>"
end
institution_not_specified_range_frequency(frequency_code_entry) click to toggle source
# File lib/qrda-export/helper/frequency_helper.rb, line 57
def institution_not_specified_range_frequency(frequency_code_entry)
  "<effectiveTime xsi:type='PIVL_TS' operator='A'>"\
  "<period xsi:type='IVL_PQ'>"\
  "<low value='#{frequency_code_entry[:low]}' unit='#{frequency_code_entry[:unit]}'/>"\
  "<high value='#{frequency_code_entry[:high]}' unit='#{frequency_code_entry[:unit]}'/>"\
  "</period>"\
  "</effectiveTime>"
end
institution_specified_point_frequency(frequency_code_entry) click to toggle source
# File lib/qrda-export/helper/frequency_helper.rb, line 66
def institution_specified_point_frequency(frequency_code_entry)
  "<effectiveTime xsi:type='PIVL_TS' institutionSpecified='true' operator='A'>"\
  "<period value='#{frequency_code_entry[:low]}' unit='#{frequency_code_entry[:unit]}'/>"\
  "</effectiveTime>"
end
institution_specified_range_frequency(frequency_code_entry) click to toggle source
# File lib/qrda-export/helper/frequency_helper.rb, line 72
def institution_specified_range_frequency(frequency_code_entry)
  "<effectiveTime xsi:type='PIVL_TS' institutionSpecified='true' operator='A'>"\
  "<period xsi:type='IVL_PQ'>"\
  "<low value='#{frequency_code_entry[:low]}' unit='#{frequency_code_entry[:unit]}'/>"\
  "<high value='#{frequency_code_entry[:high]}' unit='#{frequency_code_entry[:unit]}'/>"\
  "</period>"\
  "</effectiveTime>"
end
medication_frequency() click to toggle source
# File lib/qrda-export/helper/frequency_helper.rb, line 33
def medication_frequency
  # If the code matches one of the known Direct Reference Codes, export that time in hours. Otherwise default to "every twenty four hours" code
  frequency_code_entry = FREQUENCY_CODE_MAP[self['code']] || FREQUENCY_CODE_MAP['396125000']
  if !frequency_code_entry[:institution_specified]
    if frequency_code_entry[:high].nil?
      institution_not_specified_point_frequency(frequency_code_entry)
    else
      institution_not_specified_range_frequency(frequency_code_entry)
    end
  else
    if frequency_code_entry[:high].nil?
      institution_specified_point_frequency(frequency_code_entry)
    else
      institution_specified_range_frequency(frequency_code_entry)
    end
  end
end