module HealthDataStandards::CQM::PopulationSelectors

Public Instance Methods

denominator() click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 8
def denominator
  populations.find {|pop| pop.type == 'DENOM'}
end
denominator_exceptions() click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 12
def denominator_exceptions
  populations.find {|pop| pop.type == 'DENEXCEP'}
end
denominator_exclusions() click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 16
def denominator_exclusions
  populations.find {|pop| pop.type == 'DENEX'}
end
method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 33
def method_missing(method, *args, &block)
  match_data = method.to_s.match(/^(.+)_count$/)
  if match_data
    population = self.send(match_data[1])
    if population
      population.value
    else
      0
    end
  else
    super
  end
end
multiple_population_types?() click to toggle source

Returns true if there is more than one IPP or DENOM, etc.

# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 48
def multiple_population_types?
  population_groups = populations.group_by {|pop| pop.type}
  population_groups.values.any? { |pops| pops.size > 1 }
end
numerator() click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 4
def numerator
  populations.find {|pop| pop.type == 'NUMER'}
end
population_count(population_type, population_id) click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 20
def population_count(population_type, population_id)
  population = populations.find {|pop| pop.type == population_type && pop.id == population_id}
  if population
    population.value
  else
    0
  end
end
population_id(population_type) click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 29
def population_id(population_type)
  populations.find {|pop| pop.type == population_type}.id
end