Class: FHIR::MedicationKnowledgeKinetics

Inherits:
BackboneElement show all
Includes:
Mongoid::Document
Defined in:
app/models/fhir/medication_knowledge_kinetics.rb

Overview

fhir/medication_knowledge_kinetics.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



28
29
30
31
32
33
34
35
36
# File 'app/models/fhir/medication_knowledge_kinetics.rb', line 28

def self.transform_json(json_hash, target = MedicationKnowledgeKinetics.new)

  result = self.superclass.transform_json(json_hash, target)
  result['areaUnderCurve'] = json_hash['areaUnderCurve'].map { |var| SimpleQuantity.transform_json(var) } unless json_hash['areaUnderCurve'].nil?
  result['lethalDose50'] = json_hash['lethalDose50'].map { |var| SimpleQuantity.transform_json(var) } unless json_hash['lethalDose50'].nil?
  result['halfLifePeriod'] = Duration.transform_json(json_hash['halfLifePeriod']) unless json_hash['halfLifePeriod'].nil?

  result
end

Instance Method Details

#as_json(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/fhir/medication_knowledge_kinetics.rb', line 9

def as_json(*args)
  result = super      
  unless self.areaUnderCurve.nil?  || !self.areaUnderCurve.any? 
    result['areaUnderCurve'] = self.areaUnderCurve.map{ |x| x.as_json(*args) }
  end
  unless self.lethalDose50.nil?  || !self.lethalDose50.any? 
    result['lethalDose50'] = self.lethalDose50.map{ |x| x.as_json(*args) }
  end
  unless self.halfLifePeriod.nil? 
    result['halfLifePeriod'] = self.halfLifePeriod.as_json(*args)
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end