Class: HealthDataStandards::CQM::AggregateCount

Inherits:
Object
  • Object
show all
Defined in:
lib/health-data-standards/models/cqm/aggregate_objects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(measure_id) ⇒ AggregateCount

Returns a new instance of AggregateCount.



98
99
100
101
102
# File 'lib/health-data-standards/models/cqm/aggregate_objects.rb', line 98

def initialize(measure_id)
  @populations = []
  @measure_id = measure_id
  @population_groups = []
end

Instance Attribute Details

#measure_idObject

Returns the value of attribute measure_id.



96
97
98
# File 'lib/health-data-standards/models/cqm/aggregate_objects.rb', line 96

def measure_id
  @measure_id
end

#population_groupsObject

Returns the value of attribute population_groups.



96
97
98
# File 'lib/health-data-standards/models/cqm/aggregate_objects.rb', line 96

def population_groups
  @population_groups
end

#populationsObject

Returns the value of attribute populations.



96
97
98
# File 'lib/health-data-standards/models/cqm/aggregate_objects.rb', line 96

def populations
  @populations
end

Instance Method Details

#add_entry(cache_entry) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# 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?Boolean

Returns:

  • (Boolean)


133
134
135
# File 'lib/health-data-standards/models/cqm/aggregate_objects.rb', line 133

def is_cv?
  populations.any? {|pop| pop.type == 'MSRPOPL'}
end