@@ -102,7 +102,9 @@ def evaluate_eligibility(self) -> eligibility.EligibilityStatus:
102102 ):
103103 # iter F rules by priority and grouping
104104 # find first exclusion - throws
105- status , group_actionable , group_exclusions = self .evaluate_rules_priority_group (rule_group )
105+ status , group_actionable , group_exclusions , rule_stop = self .evaluate_rules_priority_group (
106+ rule_group
107+ )
106108 if status .is_exclusion :
107109 cohort_results [cohort .cohort_label ] = CohortStatus (cohort , status , group_exclusions )
108110 eligibility_flag = False
@@ -120,16 +122,15 @@ def evaluate_eligibility(self) -> eligibility.EligibilityStatus:
120122 for _ , rule_group in groupby (
121123 sorted (exclusion_capable_suppression_rules , key = priority_getter ), key = priority_getter
122124 ):
123- rule_group = list (rule_group )
124125 # iter S rules by priority and grouping
125126 # find first exclusion - throws
126- status , group_actionable , group_exclusions = self . evaluate_rules_priority_group (
127- iter (rule_group )
127+ status , group_actionable , group_exclusions , rule_stop = (
128+ self . evaluate_rules_priority_group (rule_group )
128129 )
129130 if status .is_exclusion :
130131 actionable_flag = False
131132 suppression_reasons .append (group_exclusions )
132- if any ( rule . rule_stop for rule in rule_group ) :
133+ if rule_stop :
133134 break
134135 # No exclusions - actionable
135136 if actionable_flag :
@@ -164,12 +165,15 @@ def evaluate_eligibility(self) -> eligibility.EligibilityStatus:
164165
165166 def evaluate_rules_priority_group (
166167 self , iteration_rule_group : Iterator [rules .IterationRule ]
167- ) -> tuple [eligibility .Status , list [eligibility .Reason ], list [eligibility .Reason ]]:
168+ ) -> tuple [eligibility .Status , list [eligibility .Reason ], list [eligibility .Reason ], bool ]:
169+ is_rule_stop : bool = False
170+
168171 exclusion_reasons , actionable_reasons = [], []
169172
170173 best_status = eligibility .Status .not_eligible
171174
172175 for rule in iteration_rule_group :
176+ is_rule_stop = True if rule .rule_stop else is_rule_stop
173177 rule_calculator = RuleCalculator (person_data = self .person_data , rule = rule )
174178 status , reason = rule_calculator .evaluate_exclusion ()
175179 if status .is_exclusion :
@@ -179,4 +183,4 @@ def evaluate_rules_priority_group(
179183 best_status = eligibility .Status .actionable
180184 actionable_reasons .append (reason )
181185
182- return best_status , actionable_reasons , exclusion_reasons
186+ return best_status , actionable_reasons , exclusion_reasons , is_rule_stop
0 commit comments