Class: CQM::Observation

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document
Defined in:
app/models/cqm/population_set.rb

Overview

Observation info

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.transform_json(json_hash, target = Observation.new) ⇒ Object



118
119
120
121
122
123
124
125
# File 'app/models/cqm/population_set.rb', line 118

def self.transform_json(json_hash, target = Observation.new)
  result = target
  result['observation_function'] = CQM::StatementReference.transform_json(json_hash['observation_function']) unless json_hash['observation_function'].nil?
  result['observation_parameter'] = CQM::StatementReference.transform_json(json_hash['observation_parameter']) unless json_hash['observation_parameter'].nil?
  result['aggregation_type'] = json_hash['aggregation_type'] unless json_hash['aggregation_type'].nil?

  result
end

Instance Method Details

#as_json(*args) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'app/models/cqm/population_set.rb', line 103

def as_json(*args)
  result = Hash.new
  unless self.observation_function.nil?
    result['observation_function'] = self.observation_function.as_json(args)
  end
  unless self.observation_parameter.nil?
    result['observation_parameter'] = self.observation_parameter.as_json(args)
  end
  unless self.aggregation_type.nil?
    result['aggregation_type'] = self.aggregation_type
  end

  result
end