feat(T03): OCR-Erfassung via OpenRouter Qwen2.5-VL + OCR UI with drag-and-drop
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
"""Pydantic schemas for OCR-related request and response bodies."""
|
||||
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Any, Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class OCRUploadResponse(BaseModel):
|
||||
"""Response for POST /api/v1/ocr/upload."""
|
||||
|
||||
message: str = "OCR processing queued"
|
||||
ocr_result_id: uuid.UUID
|
||||
status: str = "pending"
|
||||
|
||||
|
||||
class OCRStructuredData(BaseModel):
|
||||
"""Structured data extracted from OCR scan (ZB I/II fields)."""
|
||||
|
||||
brand: Optional[str] = None
|
||||
model: Optional[str] = None
|
||||
vin: Optional[str] = None
|
||||
first_registration: Optional[str] = None
|
||||
mileage: Optional[int] = None
|
||||
power_kw: Optional[int] = None
|
||||
fuel_type: Optional[str] = None
|
||||
|
||||
|
||||
class OCRResultResponse(BaseModel):
|
||||
"""Response for GET /api/v1/ocr/results/:id."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
vehicle_id: Optional[uuid.UUID] = None
|
||||
file_path: str
|
||||
file_name: str
|
||||
mime_type: str
|
||||
status: str
|
||||
raw_text: Optional[str] = None
|
||||
structured_data: Optional[dict[str, Any]] = None
|
||||
confidence_score: Optional[float] = None
|
||||
error_message: Optional[str] = None
|
||||
created_at: Optional[datetime] = None
|
||||
updated_at: Optional[datetime] = None
|
||||
|
||||
|
||||
class OCRResultListResponse(BaseModel):
|
||||
"""Paginated OCR results list response."""
|
||||
|
||||
items: list[OCRResultResponse]
|
||||
total: int
|
||||
page: int
|
||||
page_size: int
|
||||
|
||||
|
||||
class OCRApplyResponse(BaseModel):
|
||||
"""Response for POST /api/v1/ocr/results/:id/apply."""
|
||||
|
||||
message: str = "OCR data applied to vehicle"
|
||||
ocr_result_id: uuid.UUID
|
||||
vehicle_id: uuid.UUID
|
||||
updated_fields: list[str] = Field(default_factory=list)
|
||||
Reference in New Issue
Block a user