Sha256: bd0fea49e6533ac398fa428b33a88e83239a604cfb0f9f5b6c25437ecfbb5aca

Contents?: true

Size: 1.08 KB

Versions: 22

Compression:

Stored size: 1.08 KB

Contents

module HealthDataStandards
  module CQM
    class Prefilter
      include Mongoid::Document
      # What field on the Record do we want to compare against
      field :record_field, type: String
      # greater than, less than, etc.
      field :comparison, type: String
      # Is it based on the effective_time, like 65yo during measure period
      field :effective_time_based, type: Boolean, default: false
      # If effective_time_based, what is the offset from effective_time in years
      field :effective_time_offset, type: Integer
      # Comparison to a plain old value, like gender == 'F'
      field :desired_value

      embedded_in :measure

      def build_query_hash(effective_time)
        filter_value = if self.effective_time_based
          et = Time.at(effective_time)
          et.years_ago(effective_time_offset).to_i
        else
          self.desired_value
        end

        if self.comparison == '$eq'
          {self.record_field => desired_value}
        else
          {self.record_field => {self.comparison => filter_value}}
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
health-data-standards-4.3.5 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.3.4 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.3.3 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.3.2 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.3.1 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.3.0 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.2.0 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.1.0 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.0.6 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.0.5 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.0.4 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.0.3 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.0.2 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.0.1 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-4.0.0 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-3.7.0 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-3.6.1 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-3.5.3 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-3.5.2 lib/health-data-standards/models/cqm/prefilter.rb
health-data-standards-3.5.1 lib/health-data-standards/models/cqm/prefilter.rb