feat(digests): case-contextual digest radar — surface unlinked digests as chair leads (X12)
A digest pointing at a ruling we don't hold yet ("unlinked") was captured globally
(missing_precedents inbox) but never surfaced IN THE CONTEXT of the case being
decided — so a relevant ruling known only via a digest could fall through the cracks
at the moment it matters. Adds the case-contextual radar:
- db.search_digests_semantic: new `linked_only` filter (False = unlinked-only target set).
- digest_library.case_digest_radar(case_number): builds the case topic from title +
appeal_subtype + the analyst's claims, embeds once, matches against UNLINKED digests,
and returns leads enriched with the underlying ruling's gap status + suggested action
(new_lead / gap_open / fetched / available_link).
- MCP tool `digest_radar` + endpoint GET /api/cases/{n}/digest-radar (for the agent and
the future case-page lead).
INV-DIG1 preserved: radar only — every lead points at the underlying RULING (fetch /
upload / link), never cites the digest. Read-only.
Validated on 8124-09-24 (היטל השבחה): 5 on-topic unlinked digests, scores 0.64–0.72.
The visible case-page panel is a separate UI change → goes through the design gate.
Invariants: G2 (reuses the one digest semantic-search + gap/citation resolvers),
INV-DIG1 (no digest citation), INV-DIG3 (gap surfacing). No schema change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
11
web/app.py
11
web/app.py
@@ -6444,6 +6444,17 @@ class DigestLinkRequest(BaseModel):
|
||||
case_law_id: str
|
||||
|
||||
|
||||
@app.get("/api/cases/{case_number}/digest-radar")
|
||||
async def api_case_digest_radar(case_number: str, limit: int = 5, min_score: float = 0.45):
|
||||
"""Case-contextual digest radar (X12) — UNLINKED digests whose topic is close to
|
||||
this case (rulings we don't hold yet). Powers the case-page "📡 רדאר יומונים" lead
|
||||
so a relevant ruling known only via a digest doesn't fall through the cracks while
|
||||
the case is decided. INV-DIG1: points at the underlying ruling, never cites the
|
||||
digest."""
|
||||
return await digest_service.case_digest_radar(
|
||||
case_number, limit=max(1, min(int(limit), 20)), min_score=float(min_score))
|
||||
|
||||
|
||||
@app.post("/api/digests/upload")
|
||||
async def digest_upload(
|
||||
file: UploadFile = File(...),
|
||||
|
||||
Reference in New Issue
Block a user