Class: HealthDataStandards::CQM::QueryCache

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/health-data-standards/models/cqm/query_cache.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.aggregate_measure(measure_id, effective_date, filters = nil, test_id = nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/health-data-standards/models/cqm/query_cache.rb', line 26

def self.aggregate_measure(measure_id, effective_date, filters=nil, test_id=nil)
  query_hash = {'effective_date' => effective_date, 'measure_id' => measure_id,
                'test_id' => test_id}
  if filters
    query_hash.merge!(filters)
  end
  cache_entries = self.where(query_hash)
  aggregate_count = AggregateCount.new(measure_id)
  cache_entries.each do |cache_entry|
    aggregate_count.add_entry(cache_entry)
  end
  aggregate_count
end

Instance Method Details

#is_cv?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/health-data-standards/models/cqm/query_cache.rb', line 44

def is_cv?
  population_ids.has_key?('MSRPOPL')
end

#is_stratification?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/health-data-standards/models/cqm/query_cache.rb', line 40

def is_stratification?
  population_ids.has_key?('stratification') || population_ids.has_key?('STRAT')
end