Class: Renalware::HD::Sessions::AuditableSession
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Renalware::HD::Sessions::AuditableSession
- Defined in:
- app/models/renalware/hd/sessions/auditable_session.rb
Instance Method Summary collapse
- #blood_pressure_measurements ⇒ Object
-
#dialysis_minutes_shortfall ⇒ Object
Note the profile here might be a NullHDProfile which will always return 0 for the prescribed time - so sessions with a missing profile always report a dialysis_time_shortfall of 0.
- #dialysis_minutes_shortfall_gt_5_pct? ⇒ Boolean
- #dialysis_minutes_shortfall_percentage ⇒ Object
- #document ⇒ Object
- #dry_weight ⇒ Object
- #profile ⇒ Object
-
#ufr ⇒ Object
This is fluid removed (ml) / HD time in hours eg 3.75 / dry weight (kg) The result is in ml/hr/kg.
- #weight_loss ⇒ Object
- #weight_loss_as_percentage_of_body_weight ⇒ Object
Instance Method Details
#blood_pressure_measurements ⇒ Object
16 17 18 19 20 21 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 16 def blood_pressure_measurements [ document.observations_before.blood_pressure, document.observations_after.blood_pressure ] end |
#dialysis_minutes_shortfall ⇒ Object
Note the profile here might be a NullHDProfile which will always return 0 for the prescribed time - so sessions with a missing profile always report a dialysis_time_shortfall of 0
40 41 42 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 40 def dialysis_minutes_shortfall prescribed_time == 0 ? 0 : prescribed_time - duration end |
#dialysis_minutes_shortfall_gt_5_pct? ⇒ Boolean
50 51 52 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 50 def dialysis_minutes_shortfall_gt_5_pct? dialysis_minutes_shortfall_percentage > 5.0 end |
#dialysis_minutes_shortfall_percentage ⇒ Object
44 45 46 47 48 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 44 def dialysis_minutes_shortfall_percentage return 0.0 if dialysis_minutes_shortfall == 0 (dialysis_minutes_shortfall.to_f / prescribed_time.to_f) * 100.0 end |
#document ⇒ Object
31 32 33 34 35 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 31 def document return SessionDocument.new if dna? super || SessionDocument.new end |
#dry_weight ⇒ Object
27 28 29 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 27 def dry_weight super || NullObject.instance end |
#profile ⇒ Object
23 24 25 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 23 def profile super || NullObject.instance end |
#ufr ⇒ Object
This is fluid removed (ml) / HD time in hours eg 3.75 / dry weight (kg) The result is in ml/hr/kg. Note that fluid removed is entered in L so we need to convert to ml here.
67 68 69 70 71 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 67 def ufr return nil unless measured_dry_weight > 0 && duration > 0 && fluid_removed > 0 (fluid_removed * 1000) / duration_as_hours / measured_dry_weight end |
#weight_loss ⇒ Object
54 55 56 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 54 def weight_loss document.observations_before.weight.to_f - document.observations_after.weight.to_f end |
#weight_loss_as_percentage_of_body_weight ⇒ Object
58 59 60 61 62 |
# File 'app/models/renalware/hd/sessions/auditable_session.rb', line 58 def weight_loss_as_percentage_of_body_weight return unless measured_dry_weight > 0 (weight_loss / measured_dry_weight) * 100.0 end |