Files
legal-ai/mcp-server/src/legal_mcp/models.py
Chaim d9e5ef0f46 Add full decision writing pipeline: classify, extract, brainstorm, write, QA, export
New services (11 files):
- classifier.py: auto doc-type classification + party identification (Claude Haiku)
- claims_extractor.py: claim extraction from pleadings (Claude Sonnet + regex)
- references_extractor.py: plan/case-law/legislation detection (regex)
- brainstorm.py: direction generation with 2-3 options (Claude Sonnet)
- block_writer.py: 12-block decision writer (template + Claude Sonnet/Opus)
- docx_exporter.py: DOCX export with David font, RTL, headings
- qa_validator.py: 6 QA checks with export blocking on critical failure
- learning_loop.py: draft vs final comparison + lesson extraction
- metrics.py: KPIs dashboard per case and global
- audit.py: action audit log
- cli.py: standalone CLI with 11 commands

Updated pipeline: extract → classify → chunk → embed → store → extract_references
New MCP tools: 29 total (was 16)
New DB tables: audit_log, decisions CRUD, claims CRUD
Config: Infisical support, external service allowlist

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:21:47 +00:00

104 lines
3.1 KiB
Python

"""Pydantic models for cases, documents, and related entities."""
from __future__ import annotations
import enum
from datetime import date, datetime
from uuid import UUID
from pydantic import BaseModel, Field
class CaseStatus(str, enum.Enum):
NEW = "new"
IN_PROGRESS = "in_progress"
DRAFTED = "drafted"
REVIEWED = "reviewed"
FINAL = "final"
class DocType(str, enum.Enum):
APPEAL = "appeal" # כתב ערר
RESPONSE = "response" # תשובה / כתב תשובה
PROTOCOL = "protocol" # פרוטוקול דיון
PLAN = "plan" # תכנית (תב"ע)
PERMIT = "permit" # היתר בנייה
COURT_DECISION = "court_decision" # פסק דין / החלטת בית משפט
DECISION = "decision" # החלטת ועדה
APPRAISAL = "appraisal" # שומה / חוות דעת שמאית
OBJECTION = "objection" # התנגדות
EXHIBIT = "exhibit" # נספח / מסמך תומך
REFERENCE = "reference" # מסמך עזר אחר
class SectionType(str, enum.Enum):
INTRO = "intro"
FACTS = "facts"
APPELLANT_CLAIMS = "appellant_claims"
RESPONDENT_CLAIMS = "respondent_claims"
LEGAL_ANALYSIS = "legal_analysis"
CONCLUSION = "conclusion"
RULING = "ruling"
OTHER = "other"
class ExtractionStatus(str, enum.Enum):
PENDING = "pending"
PROCESSING = "processing"
COMPLETED = "completed"
FAILED = "failed"
class CaseCreate(BaseModel):
case_number: str = Field(description="מספר תיק הערר (לדוגמה: 123-24)")
title: str = Field(description="כותרת קצרה של הערר")
appellants: list[str] = Field(default_factory=list, description="שמות העוררים")
respondents: list[str] = Field(default_factory=list, description="שמות המשיבים")
subject: str = Field(default="", description="נושא הערר")
property_address: str = Field(default="", description="כתובת הנכס")
permit_number: str = Field(default="", description="מספר היתר")
committee_type: str = Field(default="ועדה מקומית", description="סוג הוועדה")
hearing_date: date | None = Field(default=None, description="תאריך דיון")
notes: str = Field(default="", description="הערות")
class CaseInfo(BaseModel):
id: UUID
case_number: str
title: str
appellants: list[str]
respondents: list[str]
subject: str
property_address: str
permit_number: str
committee_type: str
status: CaseStatus
hearing_date: date | None
decision_date: date | None
tags: list[str]
notes: str
created_at: datetime
updated_at: datetime
class DocumentInfo(BaseModel):
id: UUID
case_id: UUID
doc_type: DocType
title: str
file_path: str
extraction_status: ExtractionStatus
page_count: int | None
created_at: datetime
class SearchResult(BaseModel):
chunk_content: str
score: float
case_number: str
document_title: str
section_type: str
page_number: int | None
document_id: UUID
case_id: UUID