Class: Renalware::PD::PETResult

Inherits:
ApplicationRecord show all
Extended by:
Enumerize
Includes:
Accountable, Renalware::PatientScope, Renalware::PatientsRansackHelper
Defined in:
app/models/renalware/pd/pet_result.rb

Constant Summary

Constants included from Renalware::PatientsRansackHelper

Renalware::PatientsRansackHelper::UUID_REGEXP

Instance Method Summary collapse

Methods included from Accountable

#first_or_create_by!, #save_by, #save_by!, #update_by

Instance Method Details

#calculated_d_pcrObject



28
29
30
31
32
33
# File 'app/models/renalware/pd/pet_result.rb', line 28

def calculated_d_pcr
  return if sample_4hr_creatinine.to_f == 0.0
  return if serum_creatinine.to_f == 0.0

  (sample_4hr_creatinine / serum_creatinine).round(2)
end

#calculated_net_ufObject



35
36
37
38
39
40
# File 'app/models/renalware/pd/pet_result.rb', line 35

def calculated_net_uf
  return if volume_in.to_i.zero?
  return if volume_out.to_i.zero?

  volume_out - volume_in
end

#derive_calculated_attributesObject



22
23
24
25
26
# File 'app/models/renalware/pd/pet_result.rb', line 22

def derive_calculated_attributes
  self.d_pcr = calculated_d_pcr
  self.net_uf = calculated_net_uf
  self.complete = d_pcr.present? && net_uf.present?
end