Class: Renalware::Pathology::Requests::GlobalRule::PatientGlobalRuleDecision

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/pathology/requests/global_rule/observation_result.rb

Instance Method Summary collapse

Constructor Details

#initialize(patient, rule) ⇒ PatientGlobalRuleDecision

Returns a new instance of PatientGlobalRuleDecision.



39
40
41
42
# File 'app/models/renalware/pathology/requests/global_rule/observation_result.rb', line 39

def initialize(patient, rule)
  @patient = patient
  @rule = rule
end

Instance Method Details

#observation_required_for_patient?Boolean

Returns:

  • (Boolean)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/models/renalware/pathology/requests/global_rule/observation_result.rb', line 44

def observation_required_for_patient?
  return true if observation.nil?

  if [">", "<", ">=", "<="].include?(@rule.param_comparison_operator)
    observation.result.to_i.send(
      @rule.param_comparison_operator.to_sym,
      @rule.param_comparison_value.to_i
    )
  else
    observation.result.send(
      @rule.param_comparison_operator.to_sym,
      @rule.param_comparison_value
    )
  end
end