Class: HealthDataStandards::CQM::Bundle

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.latest_bundle_idObject



24
25
26
# File 'lib/health-data-standards/models/cqm/bundle.rb', line 24

def self.latest_bundle_id
  desc(:exported).first.try(:_id)
end

Instance Method Details

#deleteObject



40
41
42
43
44
45
# File 'lib/health-data-standards/models/cqm/bundle.rb', line 40

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

#measuresObject



28
29
30
# File 'lib/health-data-standards/models/cqm/bundle.rb', line 28

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

#recordsObject



32
33
34
# File 'lib/health-data-standards/models/cqm/bundle.rb', line 32

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

#value_setsObject



36
37
38
# File 'lib/health-data-standards/models/cqm/bundle.rb', line 36

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