@@ -116,26 +116,7 @@ def evaluate_eligibility(self) -> eligibility.EligibilityStatus:
116116 iteration_results : dict [str , IterationResult ] = {}
117117
118118 for active_iteration in [cc .current_iteration for cc in campaign_group ]:
119- cohort_results : dict [str , CohortGroupResult ] = {}
120-
121- filter_rules , suppression_rules = self .get_rules_by_type (active_iteration )
122-
123- for cohort in sorted (active_iteration .iteration_cohorts , key = attrgetter ("priority" )):
124- # Base Eligibility - check
125- if cohort .cohort_label in self .person_cohorts or cohort .is_magic_cohort :
126- # Eligibility - check
127- if self .is_eligible_by_filter_rules (cohort , cohort_results , filter_rules ):
128- # Actionability - evaluation
129- self .evaluate_suppression_rules (cohort , cohort_results , suppression_rules )
130-
131- # Not base eligible
132- elif cohort .cohort_label is not None :
133- cohort_results [cohort .cohort_label ] = CohortGroupResult (
134- (cohort .cohort_group ),
135- Status .not_eligible ,
136- [],
137- cohort .negative_description ,
138- )
119+ cohort_results : dict [str , CohortGroupResult ] = self .get_cohort_results (active_iteration )
139120
140121 # Determine Result between cohorts - get the best
141122 status , best_cohorts = self .get_the_best_cohort_memberships (cohort_results )
@@ -153,6 +134,27 @@ def evaluate_eligibility(self) -> eligibility.EligibilityStatus:
153134 final_result = self .build_condition_results (condition_results )
154135 return eligibility .EligibilityStatus (conditions = final_result )
155136
137+ def get_cohort_results (self , active_iteration : rules .Iteration ) -> dict [str , CohortGroupResult ]:
138+ cohort_results : dict [str , CohortGroupResult ] = {}
139+ filter_rules , suppression_rules = self .get_rules_by_type (active_iteration )
140+ for cohort in sorted (active_iteration .iteration_cohorts , key = attrgetter ("priority" )):
141+ # Base Eligibility - check
142+ if cohort .cohort_label in self .person_cohorts or cohort .is_magic_cohort :
143+ # Eligibility - check
144+ if self .is_eligible_by_filter_rules (cohort , cohort_results , filter_rules ):
145+ # Actionability - evaluation
146+ self .evaluate_suppression_rules (cohort , cohort_results , suppression_rules )
147+
148+ # Not base eligible
149+ elif cohort .cohort_label is not None :
150+ cohort_results [cohort .cohort_label ] = CohortGroupResult (
151+ (cohort .cohort_group ),
152+ Status .not_eligible ,
153+ [],
154+ cohort .negative_description ,
155+ )
156+ return cohort_results
157+
156158 @staticmethod
157159 def build_condition_results (
158160 condition_results : dict [ConditionName , IterationResult ],
0 commit comments