Add outcome-aware drafting, lessons system, and improved style analysis

- Add expected_outcome field to cases (rejection/partial/full/betterment_levy)
- New lessons.py module with golden ratios, templates, and drafting guidance per outcome type
- Style analyzer now uses Opus with full decision text (no truncation), with multi-pass fallback for large corpora
- Drafting tool provides outcome-specific templates, section guidance, and ratio comments
- Improved JSON extraction with bracket-matching fallback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 18:58:42 +00:00
parent 6f515dc2cb
commit 39089dcef5
6 changed files with 726 additions and 71 deletions

View File

@@ -22,6 +22,7 @@ async def case_create(
committee_type: str = "ועדה מקומית",
hearing_date: str = "",
notes: str = "",
expected_outcome: str = "",
) -> str:
"""יצירת תיק ערר חדש.
@@ -36,6 +37,7 @@ async def case_create(
committee_type: סוג הוועדה (ברירת מחדל: ועדה מקומית)
hearing_date: תאריך דיון (YYYY-MM-DD)
notes: הערות
expected_outcome: תוצאה צפויה (rejection/partial_acceptance/full_acceptance/betterment_levy)
"""
from datetime import date as date_type
@@ -54,6 +56,7 @@ async def case_create(
committee_type=committee_type,
hearing_date=h_date,
notes=notes,
expected_outcome=expected_outcome,
)
# Initialize git repo for the case
@@ -122,6 +125,7 @@ async def case_update(
hearing_date: str = "",
decision_date: str = "",
tags: list[str] | None = None,
expected_outcome: str = "",
) -> str:
"""עדכון פרטי תיק.
@@ -134,6 +138,7 @@ async def case_update(
hearing_date: תאריך דיון (YYYY-MM-DD)
decision_date: תאריך החלטה (YYYY-MM-DD)
tags: תגיות
expected_outcome: תוצאה צפויה (rejection/partial_acceptance/full_acceptance/betterment_levy)
"""
from datetime import date as date_type
@@ -156,6 +161,8 @@ async def case_update(
fields["decision_date"] = date_type.fromisoformat(decision_date)
if tags is not None:
fields["tags"] = tags
if expected_outcome:
fields["expected_outcome"] = expected_outcome
updated = await db.update_case(UUID(case["id"]), **fields)