fix(cases): בל"מ badge reads proceeding_type, not just appeal_subtype
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 43s

After the proceeding_type field landed, users started flipping cases
to בל"מ via the edit dialog. But the case-header badge + cases-table
filter were still gated on isBlamSubtype(appeal_subtype), so the badge
didn't appear when only the proceeding_type changed. Now the badge
shows when either proceeding_type === 'בל"מ' OR appeal_subtype is an
extension_request_* variant — the legacy path stays so existing rows
that never got a proceeding_type still render correctly.

Also regen types.ts from prod (proceeding_type now in OpenAPI schema)
and register the one-shot process_pending_blam.py script.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 09:34:23 +00:00
parent d359ab9884
commit ac3ed455cf
5 changed files with 593 additions and 5 deletions

View File

@@ -30,6 +30,7 @@
| `backfill_chunk_pages.py` | python | Backfill `page_number` ב-`document_chunks` קיימים. legacy chunker לא tracked עמודים → `page_number=NULL` חוסם boost של multimodal hybrid (text+image join על אותו עמוד). re-extracts כל PDF (re-OCR אם צריך, ~$0.0015/page), מחשב page_offsets, ומעדכן chunks. idempotent | ידני per-case (`python backfill_chunk_pages.py 8174-24 8137-24`) |
| `backfill_legal_arguments.py` | python | Backfill `legal_arguments` לתיקים עם `claims` קיימים (TaskMaster #36). מקבץ פרופוזיציות גולמיות לטיעונים משפטיים מובחנים (~6-12 לכל צד) דרך `argument_aggregator.aggregate_claims_to_arguments` (Claude CLI). תומך `--dry-run`/`--apply`/`--force`/`--case <num>...`. **חייב לרוץ מהמכונה המקומית** (לא קונטיינר) — `claude_session` דורש Claude CLI | ידני per-case (`python scripts/backfill_legal_arguments.py --apply --case 1017-03-26`) |
| `upload_blam_decisions.py` | python | חד-פעמי (2026-05-26) — העלאת 2 החלטות בל"מ ל-`case_law` (8126/24 סופר נוח, 8047/23 הרנון) דרך `ingest_internal_decision` ישיר, עוקף MCP server שטרם נטען מחדש אחרי הוספת `proceeding_type`. **לא להריץ שוב** | חד-פעמי — להעביר ל-`.archive/` בהזדמנות |
| `process_pending_blam.py` | python | חד-פעמי (2026-05-26) — הרצת metadata + halacha extraction על 2 החלטות בל"מ שעלו ב-`upload_blam_decisions.py`. עוקף MCP (אותו טעם). **לא להריץ שוב** | חד-פעמי — להעביר ל-`.archive/` בהזדמנות |
## תיקיית `.archive/` — סקריפטים שהושלמו

View File

@@ -0,0 +1,53 @@
"""One-shot: run pending metadata + halacha extraction on the 2 בל"מ
decisions uploaded today (8126/24 + 8047/23). Bypasses MCP because the
running MCP server has stale code; calls the services directly with the
updated local copy.
Run from /home/chaim/legal-ai with the venv:
POSTGRES_URL=... .venv/bin/python scripts/process_pending_blam.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 db
from legal_mcp.services import precedent_library
async def main():
# Queue metadata extraction too (ingest_internal_decision only queues
# halacha; metadata fills headnote/summary/key_quote and now also
# confirms proceeding_type via the new prompt field).
pool = await db.get_pool()
async with pool.acquire() as conn:
rows = await conn.fetch(
"SELECT id, case_number FROM case_law "
"WHERE case_number IN ('8126/24','8047/23') "
" AND source_kind = 'internal_committee'"
)
for r in rows:
await conn.execute(
"UPDATE case_law SET metadata_extraction_requested_at = NOW() "
"WHERE id = $1",
r["id"],
)
print(f"queued metadata for {r['case_number']} ({r['id']})")
print("\n→ running metadata extraction…")
meta_result = await precedent_library.process_pending_extractions(
kind="metadata", limit=10,
)
print(meta_result)
print("\n→ running halacha extraction…")
halacha_result = await precedent_library.process_pending_extractions(
kind="halacha", limit=10,
)
print(halacha_result)
if __name__ == "__main__":
asyncio.run(main())