Files
legal-ai/scripts/upload_blam_decisions.py
Chaim d359ab9884
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m40s
feat(proceeding-type): explicit ערר/בל"מ field for cases + corpus
Same case_number can exist as both a regular appeal (ערר) and an
extension-of-time request (בל"מ), and we were inferring the difference
from appeal_subtype prefixes — fragile, and case-number lookups
weren't disambiguated. Now stored as a first-class field on both
case_law (corpus) and cases (live cases), with partial unique indexes
on (case_number, proceeding_type).

- SCHEMA_V15: column + CHECK constraints + backfill from
  appeal_subtype LIKE 'extension_request_%' + partial unique indexes
  replace the old global UNIQUE(case_number).
- derive_proceeding_type() centralizes the inference rule
  (extension_request_* → בל"מ; subject regex fallback; default ערר).
- Metadata extractor prompt asks Claude to populate the new field
  explicitly; apply_to_record writes it for internal_committee rows.
- internal_decision_upload, case_create, case_update accept an
  optional proceeding_type; FastAPI request models expose it.
- Wizard + edit dialog get a sided Select; case header renders the
  resolved label (ערר / בל"מ).
- Uploaded the 2 staged בל"מ decisions on betterment levy:
  8126/24 (סופר נוח, 13 chunks), 8047/23 (הרנון, 48 chunks).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 09:17:33 +00:00

61 lines
2.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""One-shot uploader for the 2 new בל"מ decisions Chaim staged in
data/precedents/incoming/. Bypasses MCP because the running MCP server
was started before SCHEMA_V15 + proceeding_type wiring landed.
Run from /home/chaim/legal-ai with the venv:
POSTGRES_URL=... .venv/bin/python scripts/upload_blam_decisions.py
"""
import asyncio
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "mcp-server", "src"))
from legal_mcp.services import internal_decisions as svc
DECISIONS = [
{
"file_path": "/home/chaim/legal-ai/data/precedents/incoming/ARAR-24-8126.pdf",
"case_number": "8126/24",
"chair_name": "דפנה תמיר",
"district": "ירושלים",
"case_name": "הוועדה המקומית ירושלים נ' סופר נוח",
"court": "ועדת הערר לתכנון ובנייה — מחוז ירושלים",
"decision_date": "2024-07-07",
"practice_area": "betterment_levy",
"appeal_subtype": "extension_request_betterment_levy",
"proceeding_type": 'בל"מ',
"subject_tags": ["בקשה_להארכת_מועד", "היטל_השבחה"],
"summary": "",
"is_binding": False,
},
{
"file_path": "/home/chaim/legal-ai/data/precedents/incoming/ARAR-23-8047-3.docx",
"case_number": "8047/23",
"chair_name": "דפנה תמיר",
"district": "ירושלים",
"case_name": 'עזבון אליהו הרנון ז"ל נ\' הוועדה המקומית ירושלים',
"court": "ועדת הערר לתכנון ובנייה — מחוז ירושלים",
"decision_date": "2025-09-29",
"practice_area": "betterment_levy",
"appeal_subtype": "extension_request_betterment_levy",
"proceeding_type": 'בל"מ',
"subject_tags": ["בקשה_להארכת_מועד", "היטל_השבחה"],
"summary": "",
"is_binding": False,
},
]
async def main():
for d in DECISIONS:
print(f"→ uploading {d['case_number']} ({d['proceeding_type']})")
result = await svc.ingest_internal_decision(**d)
print(f" ✓ case_law_id={result.get('case_law_id')} chunks={result.get('chunks')}")
print("done.")
if __name__ == "__main__":
asyncio.run(main())