Class: HealthDataStandards::CQM::AggregateCount
- Inherits:
-
Object
- Object
- HealthDataStandards::CQM::AggregateCount
- Defined in:
- lib/health-data-standards/models/cqm/aggregate_objects.rb
Instance Attribute Summary collapse
-
#measure_id ⇒ Object
Returns the value of attribute measure_id.
-
#population_groups ⇒ Object
Returns the value of attribute population_groups.
-
#populations ⇒ Object
Returns the value of attribute populations.
Instance Method Summary collapse
- #add_entry(cache_entry) ⇒ Object
-
#initialize(measure_id) ⇒ AggregateCount
constructor
A new instance of AggregateCount.
- #is_cv? ⇒ Boolean
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_id ⇒ Object
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_groups ⇒ Object
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 |
#populations ⇒ Object
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
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 |