Sha256: 0abcbcb4533130dc12ec736f4b45548e43aae236ea73e361a0a535ff2dccc554

Contents?: true

Size: 1007 Bytes

Versions: 18

Compression:

Stored size: 1007 Bytes

Contents

module HealthDataStandards
  module CQM

    class Bundle
      include Mongoid::Document
      store_in collection: 'bundles'
      field :title, type: String
      field :version, type: String
      field :license, type: String
      field :extensions, type: Array
      field :effective_date
      field :measure_period_start
      field :records, type: Array
      field :active, type: Boolean

      validates_presence_of :version

      def self.active
        self.where({active: true})
      end

      def measures
      	 HealthDataStandards::CQM::Measure.where({bundle_id: self.id}).order_by([["id", :asc],["sub_id",:asc]])
      end

      def records
      	Record.where(bundle_id: self._id, test_id: nil).order_by([["last", :asc]])
      end


      def value_sets
        HealthDataStandards::SVS::ValueSet.in(bundle_id: self.id)
      end

      def delete
        self.measures.destroy
        self.records.destroy
        self.value_sets.destroy
        super
      end


	   end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
health-data-standards-3.2.12 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.11 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.10 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.8 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.7 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.6 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.5 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.4 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.3 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.2 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.1 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.2.0 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.1.1 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.1.0 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.0.6 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.0.5 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.0.4 lib/health-data-standards/models/cqm/bundle.rb
health-data-standards-3.0.3 lib/health-data-standards/models/cqm/bundle.rb