Class: Renalware::PD::APD::RegimeCalculations

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/models/renalware/pd/apd/regime_calculations.rb

Constant Summary collapse

INCALCULABLE =
nil

Instance Method Summary collapse

Instance Method Details

#calculated_daily_volumeObject

The total volume of all bags for a day when they have PD.



17
18
19
20
21
22
23
24
# File 'app/models/renalware/pd/apd/regime_calculations.rb', line 17

def calculated_daily_volume
  vol = [
    calculated_overnight_volume,
    effective_last_fill_volume,
    effective_additional_manual_exchange_volume
  ].compact.inject(0, :+)
  vol == 0 ? nil : vol
end

#calculated_overnight_volumeObject

Raises:

  • (NotImplementedAError)


12
13
14
# File 'app/models/renalware/pd/apd/regime_calculations.rb', line 12

def calculated_overnight_volume
  raise NotImplementedAError
end

#volume_of_glucose_at_strength(strength) ⇒ Object



26
27
28
29
30
# File 'app/models/renalware/pd/apd/regime_calculations.rb', line 26

def volume_of_glucose_at_strength(strength)
  raise "Overnight volume must be calculated first" if overnight_volume.blank?

  GlucoseCalculator.new(regime: self, strength: strength).glucose_content
end