Sha256: ad4791b35c851abc159d08098bc94e4dbdad25aab266ba16e4d9e17b8efa35b7

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

module HealthDataStandards
  module CQM
    class QueryCache
      include Mongoid::Document
      include Mongoid::Timestamps
      store_in collection: 'query_cache'

      field :calculation_date, type: Time 
      field :status, type: Hash
      field :measure_id, type: String
      field :sub_id, type: String
      field :population_ids, type: Hash
      field :effective_date, type: Integer
      field :IPP, type: Integer
      field :DENOM, type: Integer
      field :NUMER, type: Integer
      field :antinumerator, type: Integer
      field :DENEX, type: Integer
      field :DENEXCEP, type: Integer
      field :MSRPOPL, type: Integer
      field :OBSERV, type: Float
      field :supplemental_data, type: Hash

      def self.aggregate_measure(measure_id, effective_date, filter=nil, test_id=nil)
        cache_entries = self.where(effective_date: effective_date, measure_id: measure_id, test_id: test_id, filter: filter)
        aggregate_count = AggregateCount.new(measure_id)
        cache_entries.each do |cache_entry|
          aggregate_count.add_entry(cache_entry)
        end
        aggregate_count
      end

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

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

      
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
health-data-standards-3.4.3 lib/health-data-standards/models/cqm/query_cache.rb
health-data-standards-3.4.2 lib/health-data-standards/models/cqm/query_cache.rb
health-data-standards-3.4.1 lib/health-data-standards/models/cqm/query_cache.rb
health-data-standards-3.4.0 lib/health-data-standards/models/cqm/query_cache.rb