Class: Renalware::Pathology::Requests::GlobalRuleSet::PatientRuleSetDecision

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

Constant Summary collapse

OBSERVATION_REQUIRED =
true
OBSERVATION_NOT_REQUIRED =
false

Instance Method Summary collapse

Constructor Details

#initialize(patient, rule_set, date) ⇒ PatientRuleSetDecision

Returns a new instance of PatientRuleSetDecision.



11
12
13
14
15
# File 'app/models/renalware/pathology/requests/global_rule_set/patient_rule_set_decision.rb', line 11

def initialize(patient, rule_set, date)
  @rule_set = rule_set
  @patient = patient
  @date = date
end

Instance Method Details

#callObject

NOTE: Decide if a rule_set applies to a patient



18
19
20
21
22
23
24
25
26
27
# File 'app/models/renalware/pathology/requests/global_rule_set/patient_rule_set_decision.rb', line 18

def call
  return OBSERVATION_NOT_REQUIRED if last_observation_too_recent?
  return OBSERVATION_NOT_REQUIRED if last_request_still_being_processed?

  if required_from_rules?
    OBSERVATION_REQUIRED
  else
    OBSERVATION_NOT_REQUIRED
  end
end