Initial commit: MCP server + web upload interface

Ezer Mishpati - AI legal decision drafting system with:
- MCP server (FastMCP) with document processing pipeline
- Web upload interface (FastAPI) for file upload and classification
- pgvector-based semantic search
- Hebrew legal document chunking and embedding
This commit is contained in:
2026-03-23 12:33:07 +00:00
commit 6f515dc2cb
33 changed files with 3297 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
"""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" # תשובה
DECISION = "decision" # החלטה
REFERENCE = "reference" # מסמך עזר
EXHIBIT = "exhibit" # נספח
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