lib/hqmf-parser/2.0/population_criteria.rb in health-data-standards-3.7.0 vs lib/hqmf-parser/2.0/population_criteria.rb in health-data-standards-4.0.0
- old
+ new
@@ -32,11 +32,11 @@
@preconditions = [Precondition.new(id_generator.next_id, conjunction_code, @preconditions)]
end
else
# Extract the data criteria this population references
dc = handle_observation_criteria
- @preconditions = [Precondition.new(id_generator.next_id, nil, nil, false, HQMF2::Reference.new(dc.id))]
+ @preconditions = [Precondition.new(id_generator.next_id, nil, nil, false, HQMF2::Reference.new(dc.id))] if dc
end
end
# Handles extracting elements from the entry
def setup_derived_entry_elements(id_generator)
@@ -74,10 +74,10 @@
fail 'Measure Observations criteria is missing computed expression(s) ' if exp.nil?
parts = exp.to_s.split('-')
dc = parse_parts_to_dc(parts)
@doc.add_data_criteria(dc)
# Update reference_ids with any newly referenced data criteria
- dc.children_criteria.each { |cc| @doc.add_reference_id(cc) } unless dc.children_criteria.nil?
+ dc.children_criteria.each { |cc| @doc.add_reference_id(cc) } unless dc&.children_criteria.nil?
dc
end
# generates the value given in an expression based on the number of criteria it references.
def parse_parts_to_dc(parts)