Expand critical action plan substance
Browse files- src/action_plan_generator.py +33 -2
src/action_plan_generator.py
CHANGED
|
@@ -220,7 +220,7 @@ Critical Risk:
|
|
| 220 |
- Family-school coordination.
|
| 221 |
- Weekly progress reviews.
|
| 222 |
- Use concrete routines, named staff actions, and measurable weekly targets.
|
| 223 |
-
-
|
| 224 |
|
| 225 |
ACTION RULES
|
| 226 |
Actions must:
|
|
@@ -313,7 +313,8 @@ OUTPUT RULES
|
|
| 313 |
- The Week sections must contain action sentences, not intervention names.
|
| 314 |
- Do not use "Action:" labels.
|
| 315 |
- Use a maximum of 1 action per week for Low Risk.
|
| 316 |
-
- Use a maximum of 2 actions per week for Moderate
|
|
|
|
| 317 |
- Avoid repeating the same monitoring sentence across multiple weeks.
|
| 318 |
- Use retrieved intervention details to make actions specific and personalized.
|
| 319 |
- Do not start an action with the intervention name.
|
|
@@ -746,6 +747,29 @@ def _fallback_action(overall_risk: str, week_number: int) -> str:
|
|
| 746 |
return moderate_actions.get(week_number, moderate_actions[4])
|
| 747 |
|
| 748 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 749 |
def _select_week_actions(
|
| 750 |
actions: list[str],
|
| 751 |
overall_risk: str,
|
|
@@ -802,6 +826,13 @@ def _select_week_actions(
|
|
| 802 |
if _is_monitoring_action(fallback):
|
| 803 |
seen_monitoring_actions.add(re.sub(r"\s+", " ", fallback.lower()))
|
| 804 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 805 |
return selected[:max_actions]
|
| 806 |
|
| 807 |
|
|
|
|
| 220 |
- Family-school coordination.
|
| 221 |
- Weekly progress reviews.
|
| 222 |
- Use concrete routines, named staff actions, and measurable weekly targets.
|
| 223 |
+
- Exactly 2 substantive actions per week.
|
| 224 |
|
| 225 |
ACTION RULES
|
| 226 |
Actions must:
|
|
|
|
| 313 |
- The Week sections must contain action sentences, not intervention names.
|
| 314 |
- Do not use "Action:" labels.
|
| 315 |
- Use a maximum of 1 action per week for Low Risk.
|
| 316 |
+
- Use a maximum of 2 actions per week for Moderate and High Risk.
|
| 317 |
+
- Use exactly 2 substantive actions per week for Critical Risk.
|
| 318 |
- Avoid repeating the same monitoring sentence across multiple weeks.
|
| 319 |
- Use retrieved intervention details to make actions specific and personalized.
|
| 320 |
- Do not start an action with the intervention name.
|
|
|
|
| 747 |
return moderate_actions.get(week_number, moderate_actions[4])
|
| 748 |
|
| 749 |
|
| 750 |
+
def _supplemental_critical_action(week_number: int) -> str:
|
| 751 |
+
"""Return a second concrete action for Critical-risk weeks."""
|
| 752 |
+
actions = {
|
| 753 |
+
1: (
|
| 754 |
+
"Assign a staff member to check attendance, homework completion, "
|
| 755 |
+
"and classroom participation by Friday and record one barrier to address."
|
| 756 |
+
),
|
| 757 |
+
2: (
|
| 758 |
+
"Begin a weekly tutoring or lunch support routine focused on one "
|
| 759 |
+
"priority skill and one missing-assignment goal."
|
| 760 |
+
),
|
| 761 |
+
3: (
|
| 762 |
+
"Use midweek progress data to revise the attendance or homework "
|
| 763 |
+
"goal and confirm the next family update."
|
| 764 |
+
),
|
| 765 |
+
4: (
|
| 766 |
+
"Hold a 15-minute review with the support team to decide which "
|
| 767 |
+
"actions continue, change, or intensify next month."
|
| 768 |
+
),
|
| 769 |
+
}
|
| 770 |
+
return actions.get(week_number, actions[4])
|
| 771 |
+
|
| 772 |
+
|
| 773 |
def _select_week_actions(
|
| 774 |
actions: list[str],
|
| 775 |
overall_risk: str,
|
|
|
|
| 826 |
if _is_monitoring_action(fallback):
|
| 827 |
seen_monitoring_actions.add(re.sub(r"\s+", " ", fallback.lower()))
|
| 828 |
|
| 829 |
+
if overall_risk == "Critical" and len(selected) < max_actions:
|
| 830 |
+
supplemental = _supplemental_critical_action(week_number)
|
| 831 |
+
normalized = re.sub(r"\s+", " ", supplemental.lower())
|
| 832 |
+
if normalized not in seen_actions:
|
| 833 |
+
selected.append(supplemental)
|
| 834 |
+
seen_actions.add(normalized)
|
| 835 |
+
|
| 836 |
return selected[:max_actions]
|
| 837 |
|
| 838 |
|