Module: HQMF2CQL::DataCriteriaPostProcessing

Extended by:
HQMF2::DataCriteriaPostProcessing
Included in:
DataCriteria
Defined in:
lib/hqmf-parser/cql/data_criteria_helpers/dc_post_processing.rb

Overview

Processing on data criteria after the initial extractions have taken place

Instance Method Summary collapse

Methods included from HQMF2::DataCriteriaPostProcessing

change_xproduct_to_intersection, handle_derived_specific_occurrences, handle_mapping_template

Instance Method Details

#extract_code_list_path_and_result_valueObject

Extract the code_list_xpath and the criteria’s value from any of the template ids (if multiple exist)



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/hqmf-parser/cql/data_criteria_helpers/dc_post_processing.rb', line 23

def extract_code_list_path_and_result_value
  @template_ids.each do |t|
    # NOTE! (Adam 6/14): The following logic should absolutely be changed
    # when Bonnie CQL support goes production. The "try this then try
    # that" approach is an artifact of the template oids changing as of
    # MAT 5.3; we want to support measures exported using 5.3, but also
    # measures that were exported using previous versions of the MAT.

    # Try a lookup using the newer template oids.
    mapping = HQMF2CQL::ValueSetHelper.get_mapping_for_template(t)

    # If the new template oids didn't work, try a lookup using the older
    # template oids.
    mapping = HQMF2::ValueSetHelper.get_mapping_for_template(t)unless mapping

    handle_mapping_template(mapping)
    break if mapping # Quit if one template id with a mapping has set these values
  end
end

#post_processingObject

Handles settings values after (most) values have been setup



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/hqmf-parser/cql/data_criteria_helpers/dc_post_processing.rb', line 7

def post_processing
  extract_code_list_path_and_result_value

  # Prefix ids that start with numerical values, and strip tokens from others
  @id = strip_tokens(@id)
  @children_criteria.map! { |cc| strip_tokens(cc) }

  # append "_source" to the criteria since all the source criteria are separated from the non-source with the "_source" identifier
  # "_source" is added to the SDC ids so that we are not duplicating ids between source and non source data criteria lists
  # the derived source data criteria maintain their original ids since they are duplicated in the data criteria and source data criteria lists from the simple xml
  @source_data_criteria = "#{@id}_source" unless (@definition == 'derived' || @definition == 'satisfies_all' || @definition == 'satisfies_any')
  @source_data_criteria = strip_tokens(@source_data_criteria) unless @source_data_criteria.nil?
end