feat(X11): citation-corroboration Phase 1 — the signal (no approval change) #27

Merged
chaim merged 7 commits from feat/x11-corroboration-phase1 into main 2026-05-31 19:18:49 +00:00
Showing only changes of commit ca31932a5f - Show all commits

View File

@@ -1129,6 +1129,27 @@ ALTER TABLE case_law ADD COLUMN IF NOT EXISTS indexed_hash text;
"""
SCHEMA_V24_SQL = """
-- X11: citation corroboration (treatment + halacha-level link)
ALTER TABLE precedent_internal_citations
ADD COLUMN IF NOT EXISTS treatment TEXT DEFAULT '';
CREATE TABLE IF NOT EXISTS halacha_citation_corroboration (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
halacha_id UUID NOT NULL REFERENCES halachot(id) ON DELETE CASCADE,
citing_case_law_id UUID REFERENCES case_law(id) ON DELETE CASCADE,
citing_decision_id UUID REFERENCES decisions(id) ON DELETE SET NULL,
source_citation_id UUID NOT NULL,
treatment TEXT NOT NULL,
match_score NUMERIC(4,3) DEFAULT 0,
match_context TEXT DEFAULT '',
created_at TIMESTAMPTZ DEFAULT now(),
UNIQUE (halacha_id, source_citation_id)
);
CREATE INDEX IF NOT EXISTS idx_hcc_halacha ON halacha_citation_corroboration(halacha_id);
"""
async def _run_schema_migrations(pool: asyncpg.Pool) -> None:
async with pool.acquire() as conn:
await conn.execute(SCHEMA_SQL)
@@ -1155,7 +1176,8 @@ async def _run_schema_migrations(pool: asyncpg.Pool) -> None:
await conn.execute(SCHEMA_V21_SQL)
await conn.execute(SCHEMA_V22_SQL)
await conn.execute(SCHEMA_V23_SQL)
logger.info("Database schema initialized (v1-v23)")
await conn.execute(SCHEMA_V24_SQL)
logger.info("Database schema initialized (v1-v24)")
async def init_schema() -> None: