feat: #34 citation graph + #32 wide-modal precedent edit + #13 verify
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m38s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m38s
## #34 — Daphna's internal citation graph New schema V16 (V15 was already used by proceeding_type): table ``precedent_internal_citations`` (source→cited, with cited_case_law_id nullable for citations whose target isn't in the corpus yet) + 3 indexes (source, target, unlinked). New service ``citation_extractor.py`` with regex patterns for ערר / בל"מ / עע"מ / בר"מ / עמ"נ / ע"א / בג"ץ / רע"א — accepts both ``\/`` and ``-`` separators, requires actual parenthesized district label to avoid greedy mid-paragraph captures. Resolves citations against ``case_law.case_number`` substring; default confidence 0.90 linked, 0.75 unlinked. ON CONFLICT DO NOTHING on (source, cited_case_number). 3 new MCP tools: ``extract_internal_citations``, ``list_internal_citations``, ``list_incoming_citations``. Optional flag ``include_cited_by=True`` on ``search_internal_decisions`` appends cited-by candidates as ``match_type='cited_by'`` stubs. Bulk-extracted from 40 internal_committee rows authored by דפנה תמיר: **353 distinct citations, 348 stored, 96 linked / 252 unlinked**. Top citers: 1079/24 (30), 1024/24 (19), 1009/25 (18). Top unlinked target: ע"א 3213/97 (cited 5x) — natural #35 candidates. ## #32 — Wide-modal precedent edit `precedent-edit-sheet.tsx`: ``<Sheet side="left">`` → centered ``<Dialog>`` with ``sm:max-w-4xl`` ``max-h-[90vh]`` ``overflow-y-auto``. Component API unchanged so existing callers (`/precedents/[id]/page.tsx`, `library-list-panel.tsx`) work as-is. RTL preserved. Mobile falls back to near-full-width via shadcn default. ## #13 — 403/17 verification `case_law e151fc25-...` (אהרון ברק - תכנית רחביה) already in perfect shape after Stage A work: all metadata fields populated, 351 halachot with avg_conf=0.864 (well above 0.78 threshold). No re-extraction needed; closing task as verified. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -875,6 +875,36 @@ CREATE UNIQUE INDEX IF NOT EXISTS uq_cases_number_proc
|
||||
"""
|
||||
|
||||
|
||||
# ── V16: Internal citations graph (TaskMaster #34) ────────────────
|
||||
# Auto-extracted citation graph between Daphna's (and other internal_committee)
|
||||
# decisions. When an internal decision cites another committee decision in a
|
||||
# patterned way ("ונפנה ל…", "כפי שקבעתי…", "ראה החלטתי…"), the citation
|
||||
# extractor records the link here. ``cited_case_law_id`` is populated when the
|
||||
# cited case_number resolves to a row in ``case_law``; otherwise it stays NULL
|
||||
# and shows up in ``idx_pic_unlinked`` so the chair can decide whether to
|
||||
# upload the missing decision.
|
||||
SCHEMA_V16_SQL = """
|
||||
CREATE TABLE IF NOT EXISTS precedent_internal_citations (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
source_case_law_id UUID NOT NULL REFERENCES case_law(id) ON DELETE CASCADE,
|
||||
cited_case_number TEXT NOT NULL,
|
||||
cited_case_law_id UUID REFERENCES case_law(id) ON DELETE SET NULL,
|
||||
match_context TEXT,
|
||||
match_pattern TEXT,
|
||||
confidence NUMERIC(3,2) DEFAULT 0.85,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
UNIQUE (source_case_law_id, cited_case_number)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_pic_source
|
||||
ON precedent_internal_citations(source_case_law_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_pic_target
|
||||
ON precedent_internal_citations(cited_case_law_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_pic_unlinked
|
||||
ON precedent_internal_citations(cited_case_number)
|
||||
WHERE cited_case_law_id IS NULL;
|
||||
"""
|
||||
|
||||
|
||||
async def _run_schema_migrations(pool: asyncpg.Pool) -> None:
|
||||
async with pool.acquire() as conn:
|
||||
await conn.execute(SCHEMA_SQL)
|
||||
@@ -893,7 +923,8 @@ async def _run_schema_migrations(pool: asyncpg.Pool) -> None:
|
||||
await conn.execute(SCHEMA_V13_SQL)
|
||||
await conn.execute(SCHEMA_V14_SQL)
|
||||
await conn.execute(SCHEMA_V15_SQL)
|
||||
logger.info("Database schema initialized (v1-v15)")
|
||||
await conn.execute(SCHEMA_V16_SQL)
|
||||
logger.info("Database schema initialized (v1-v16)")
|
||||
|
||||
|
||||
async def init_schema() -> None:
|
||||
|
||||
Reference in New Issue
Block a user