Class: HQMF2CQL::DataCriteria
- Inherits:
-
HQMF2::DataCriteria
- Object
- HQMF2::DataCriteria
- HQMF2CQL::DataCriteria
- Defined in:
- lib/hqmf-parser/cql/data_criteria.rb
Overview
Represents a data criteria specification
Constant Summary
Constants included from HQMF2::DataCriteriaTypeAndDefinitionExtraction
HQMF2::DataCriteriaTypeAndDefinitionExtraction::SATISFIES_ALL_TEMPLATE, HQMF2::DataCriteriaTypeAndDefinitionExtraction::SATISFIES_ANY_TEMPLATE, HQMF2::DataCriteriaTypeAndDefinitionExtraction::VARIABLE_TEMPLATE
Constants inherited from HQMF2::DataCriteria
HQMF2::DataCriteria::CRITERIA_GLOB
Instance Attribute Summary
Attributes inherited from HQMF2::DataCriteria
#children_criteria, #comments, #definition, #derivation_operator, #description, #effective_time, #entry, #field_values, #id, #is_derived_specific_occurrence_variable, #local_variable_name, #negation, #negation_code_list_id, #original_id, #property, #section, #source_data_criteria, #specific_occurrence, #specific_occurrence_const, #status, #subset_operators, #temporal_references, #type, #value, #variable
Instance Method Summary collapse
-
#make_criterion_positive ⇒ Object
In certain situations it is necessary to have a negated data criterion copied to a “positive” form.
-
#retrieve_title_and_description_for_model ⇒ Object
Generate the title and description used when producing the model.
-
#title ⇒ String
Get the title of the criteria, provides a human readable description.
Methods included from DataCriteriaPostProcessing
#extract_code_list_path_and_result_value, #post_processing
Methods included from HQMF2::DataCriteriaPostProcessing
#change_xproduct_to_intersection, #extract_code_list_path_and_result_value, #handle_derived_specific_occurrences, #handle_mapping_template, #post_processing
Methods included from DataCriteriaTypeAndDefinitionExtraction
#extract_definition_from_template_id, #extract_definition_from_template_or_type, #extract_definition_from_type, #handle_entry_type
Methods included from HQMF2::DataCriteriaTypeAndDefinitionExtraction
#definition_for_demographic, #definition_for_nil_entry, #extract_definition_from_entry_type, #extract_definition_from_template_id, #extract_definition_from_template_or_type, #extract_definition_from_type, #extract_information_for_specific_variable, #handle_entry_type, #handle_known_template_id, #handle_specific_variable_ref
Methods inherited from HQMF2::DataCriteria
#clone, #code_list_id, #extract_as_grouper, #extract_variable_grouper, #handle_derived_specific_occurrence_variable, #initialize, #to_model, #to_s
Methods included from HQMF2::Utilities
#attr_val, attr_val, #strip_tokens, #to_xml
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
This class inherits a constructor from HQMF2::DataCriteria
Instance Method Details
#make_criterion_positive ⇒ Object
In certain situations it is necessary to have a negated data criterion copied to a “positive” form.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hqmf-parser/cql/data_criteria.rb', line 36 def make_criterion_positive @negation = false # Remove negation from description # sometimes "Not Done" used: "Communication: From Provider To Patient, Not Done" # should transform to "Communication: From Provider To Patient" @description.gsub!(', Not Done', '') # sometimes just "Not" used: "Encounter, Not Performed" # should transform to "Encounter, Performed" @description.gsub!(', Not', ',') @source_data_criteria = 'Derived from ' + @source_data_criteria # Looking to remove the word 'Not'. Using lookahead and lookbehind in the regex # criterion.id = criterion.id.gsub(/(?<=[a-z])Not(?=[A-Z])/, '') + '_spoof' @id = @id.gsub(/(?<=[a-z])Not(?=[A-Z])/, '') + '_spoofed' end |
#retrieve_title_and_description_for_model ⇒ Object
Generate the title and description used when producing the model
26 27 28 29 30 31 32 |
# File 'lib/hqmf-parser/cql/data_criteria.rb', line 26 def retrieve_title_and_description_for_model # remove * Value Set from title title_match = title.match(/(.*) \w+ [Vv]alue [Ss]et/) @title = title_match[1] if title_match && title_match.length > 1 @description = "#{@description}: #{title}" end |
#title ⇒ String
Get the title of the criteria, provides a human readable description
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hqmf-parser/cql/data_criteria.rb', line 8 def title disp_value = attr_val("#{@code_list_xpath}/cda:displayName/@value") # Attempt to pull display value from the localVariableName for # MAT 5.3+ exports that appear to no longer include displayName for # code entries. # NOTE: A long term replacement for this and for other portions of the # parsing process should involve reaching out to VSAC for oid information # pulled from the CQL, and then to use that information while parsing. unless disp_value.present? # Grab the localVariableName from the XML disp_value = attr_val('./cda:localVariableName/@value') # Grab everything before the first underscore disp_value = disp_value.partition('_').first unless disp_value.nil? end @title || disp_value || @description || id # allow defined titles to take precedence end |