Spaces:
Running
Running
| """Greedy risk-reduction baseline.""" | |
| from __future__ import annotations | |
| from app.common.types import CandidateAction, PolyGuardAction | |
| from app.models.baselines.rules_only import choose_rules_only | |
| def choose_greedy(candidates: list[CandidateAction]) -> PolyGuardAction: | |
| ranked = sorted(candidates, key=lambda c: (c.estimated_safety_delta, c.burden_delta), reverse=True) | |
| if not ranked: | |
| return choose_rules_only(candidates) | |
| top = ranked[0] | |
| return PolyGuardAction( | |
| mode=top.mode, | |
| action_type=top.action_type, | |
| target_drug=top.target_drug, | |
| replacement_drug=top.replacement_drug, | |
| dose_bucket=top.dose_bucket, | |
| taper_days=top.taper_days, | |
| monitoring_plan=top.monitoring_plan, | |
| candidate_id=top.candidate_id, | |
| confidence=0.72, | |
| rationale_brief="Greedy safety/burden improvement baseline.", | |
| ) | |