I am passing a glucose decision object with a value of 12, and have a
state object that starts out with its flag set false. The desired
behavior is that the value will be recognized as "extremeHypoglycemia"
by the first rule, and then the second rule will recommend giving a
glucose bolus.
When I pass both objects in without "true" to cause automatic
updating, then the first rule fires, the output is
false
Fired detect extreme hypoglycemia
true
and then the program stops. It does not fire the second rule.
When I add true to the insertion of these objects, then the program
recurses, and still never hits the second rule. Interestingly, the
output is
true
Fired detect extreme hypoglycemia
true
true
Fired detect extreme hypoglycemia
true
...
ETC.
rule "First rule: Detect extreme hypoglycemia"
no-loop true
when
decision : GlucoseDecision( serumGlucoseConcentration < 40 )
decisionState : GlucoseDecisionState(extremeHypoglycemia == false)
then
System.out.println("Fired detect extreme hypoglycemia");
System.out.println(decisionState.isExtremeHypoglycemia());
decisionState.setExtremeHypoglycemia(true);
decision.setRationaleText(decision.getRationaleText() +
"Extreme hypoglycemia (Current glucose is " +
decision.getSerumGlucoseConcentration() +" mg/dL).\n");
System.out.println(decisionState.isExtremeHypoglycemia());
update(decision);
end
rule "Second rule: Give glucose bolus for extreme hypoglycemia"
no-loop true
when
decision : GlucoseDecision()
decisionState : GlucoseDecisionState(extremeHypoglycemia == true )
then
System.out.println("Fired glucose bolus rule");
decisionState.setRecommendedGlucoseBolus(true);
decision.setRationaleText(decision.getRationaleText() +
"Glucose bolus recommended because of extreme hypoglycemia.\n");
end