Files
legal-ai/web-ui/src/components/precedents/practice-area.ts
Chaim 7ee90dce31
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m27s
feat: external precedent library with auto halacha extraction
Adds a third corpus of legal authority distinct from style_corpus
(Daphna's prior decisions for voice) and case_precedents (chair-attached
quotes per case). The new corpus holds chair-uploaded court rulings and
other appeals committee decisions, with binding rules (הלכות) extracted
automatically and queued for chair approval.

Pipeline (web/app.py + services/precedent_library.py):
file → extract → chunk → Voyage embed → halacha_extractor → store +
publish progress over the existing Redis SSE channel.

Schema V7 (services/db.py): extends case_law with source_kind +
extraction status fields under a CHECK constraint pinning practice_area
to the three appeals committee domains (rishuy_uvniya, betterment_levy,
compensation_197). New precedent_chunks (vector(1024)) and halachot
tables (vector(1024) over rule_statement, IVFFlat indexes, gin on
practice_areas/subject_tags). Halachot start as pending_review; only
approved/published rows are visible to search_precedent_library.

Agents: legal-writer, legal-researcher, legal-analyst, legal-ceo,
legal-qa get search_precedent_library. legal-writer prompt explains
the three-corpus distinction and CREAC use; legal-qa now verifies that
every cited halacha resolves to an approved row in the corpus.

UI: /precedents page with four tabs — library / semantic search /
pending review (J/K nav, A/R/E shortcuts, badge count) / stats.
Reuses the existing upload-sheet progress + SSE pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 08:38:18 +00:00

38 lines
1.4 KiB
TypeScript
Raw 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.
/**
* Practice-area constants for the precedent library.
*
* The chair confined the library to the three appeals committee
* domains — no national-insurance corpus. The DB enforces this
* via a CHECK constraint on case_law.practice_area.
*/
export const PRACTICE_AREAS = [
{ value: "rishuy_uvniya", label: "רישוי ובניה", short: "רישוי" },
{ value: "betterment_levy", label: "היטל השבחה", short: "השבחה" },
{ value: "compensation_197", label: "פיצויים לפי ס' 197", short: "פיצויים" },
] as const;
export const PRECEDENT_LEVELS = [
{ value: "עליון", label: "עליון" },
{ value: "מנהלי", label: "מנהלי" },
{ value: "ועדת_ערר_ארצית", label: "ועדת ערר ארצית" },
{ value: "ועדת_ערר_מחוזית", label: "ועדת ערר מחוזית" },
] as const;
export const SOURCE_TYPES = [
{ value: "court_ruling", label: "פסק דין" },
{ value: "appeals_committee", label: "החלטת ועדת ערר" },
] as const;
export function practiceAreaLabel(value: string | null | undefined): string {
if (!value) return "—";
const match = PRACTICE_AREAS.find((p) => p.value === value);
return match ? match.label : value;
}
export function practiceAreaShort(value: string | null | undefined): string {
if (!value) return "—";
const match = PRACTICE_AREAS.find((p) => p.value === value);
return match ? match.short : value;
}