class HealthDataStandards::CQM::AggregateCount

Attributes

measure_id[RW]
population_groups[RW]
populations[RW]

Public Class Methods

new(measure_id) click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 98
def initialize(measure_id)
  @populations = []
  @measure_id = measure_id
  @population_groups = []
end

Public Instance Methods

add_entry(cache_entry) click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 104
def add_entry(cache_entry)
  entry_populations = []
  cache_entry.population_ids.each do |population_type, population_id|
    population = populations.find{|pop| pop.id == population_id}
    if population.nil? && population_type != 'stratification' && population_type != 'STRAT'
      population = Population.new
      population.type = population_type
      population.id = population_id
      populations << population
    end
    unless population_type == 'stratification' || population_type == 'STRAT'
      if cache_entry.is_stratification?
        strat_id = cache_entry.population_ids['STRAT']
        population.add_stratification(strat_id,cache_entry[population_type])
      else
        population.value = cache_entry[population_type]
        population.supplemental_data = cache_entry.supplemental_data[population_type]
      end
    end
    entry_populations << population if population
  end
   pgroup = population_groups.find{|pg| pg.populations.collect{|p| p.id}.sort == entry_populations.collect{|p| p.id}.sort }
   unless pgroup
    pg = PopulationGroup.new
    pg.populations = entry_populations
    population_groups << pg
   end
end
is_cv?() click to toggle source
# File lib/health-data-standards/models/cqm/aggregate_objects.rb, line 133
def is_cv?
  populations.any? {|pop| pop.type == 'MSRPOPL'}
end