This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
breakpilot-pwa/geo-service/models/aoi.py
Benjamin Admin 21a844cb8a fix: Restore all files lost during destructive rebase
A previous `git pull --rebase origin main` dropped 177 local commits,
losing 3400+ files across admin-v2, backend, studio-v2, website,
klausur-service, and many other services. The partial restore attempt
(660295e2) only recovered some files.

This commit restores all missing files from pre-rebase ref 98933f5e
while preserving post-rebase additions (night-scheduler, night-mode UI,
NightModeWidget dashboard integration).

Restored features include:
- AI Module Sidebar (FAB), OCR Labeling, OCR Compare
- GPU Dashboard, RAG Pipeline, Magic Help
- Klausur-Korrektur (8 files), Abitur-Archiv (5+ files)
- Companion, Zeugnisse-Crawler, Screen Flow
- Full backend, studio-v2, website, klausur-service
- All compliance SDKs, agent-core, voice-service
- CI/CD configs, documentation, scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:51:32 +01:00

163 lines
5.5 KiB
Python

"""
AOI (Area of Interest) Models
Pydantic models for AOI requests and responses
"""
from enum import Enum
from typing import Optional
from datetime import datetime
from pydantic import BaseModel, Field
class AOIStatus(str, Enum):
"""Status of an AOI processing job."""
QUEUED = "queued"
PROCESSING = "processing"
COMPLETED = "completed"
FAILED = "failed"
class AOIQuality(str, Enum):
"""Quality level for AOI bundle generation."""
LOW = "low"
MEDIUM = "medium"
HIGH = "high"
class AOITheme(str, Enum):
"""Learning theme for AOI."""
TOPOGRAPHIE = "topographie"
LANDNUTZUNG = "landnutzung"
ORIENTIERUNG = "orientierung"
GEOLOGIE = "geologie"
HYDROLOGIE = "hydrologie"
VEGETATION = "vegetation"
class GeoJSONPolygon(BaseModel):
"""GeoJSON Polygon geometry."""
type: str = Field("Polygon", const=True)
coordinates: list[list[list[float]]] = Field(
...,
description="Polygon coordinates as [[[lon, lat], ...]]",
)
class AOIRequest(BaseModel):
"""Request model for creating an AOI."""
polygon: dict = Field(
...,
description="GeoJSON Polygon geometry",
example={
"type": "Polygon",
"coordinates": [[[9.19, 47.71], [9.20, 47.71], [9.20, 47.70], [9.19, 47.70], [9.19, 47.71]]]
},
)
theme: str = Field(
"topographie",
description="Learning theme for the AOI",
)
quality: str = Field(
"medium",
pattern="^(low|medium|high)$",
description="Bundle quality level",
)
class Config:
json_schema_extra = {
"example": {
"polygon": {
"type": "Polygon",
"coordinates": [[[9.1875, 47.7055], [9.1975, 47.7055], [9.1975, 47.7115], [9.1875, 47.7115], [9.1875, 47.7055]]]
},
"theme": "topographie",
"quality": "medium",
}
}
class AOIResponse(BaseModel):
"""Response model for AOI operations."""
aoi_id: str = Field(..., description="Unique AOI identifier")
status: AOIStatus = Field(..., description="Current processing status")
area_km2: float = Field(0, description="Area in square kilometers")
estimated_size_mb: float = Field(0, description="Estimated bundle size in MB")
message: Optional[str] = Field(None, description="Status message")
download_url: Optional[str] = Field(None, description="Bundle download URL")
manifest_url: Optional[str] = Field(None, description="Manifest URL")
created_at: Optional[str] = Field(None, description="Creation timestamp")
completed_at: Optional[str] = Field(None, description="Completion timestamp")
class Config:
json_schema_extra = {
"example": {
"aoi_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"area_km2": 0.45,
"estimated_size_mb": 25.5,
"message": "AOI processing complete",
"download_url": "/api/v1/aoi/550e8400-e29b-41d4-a716-446655440000/bundle.zip",
"manifest_url": "/api/v1/aoi/550e8400-e29b-41d4-a716-446655440000/manifest.json",
}
}
class AOIBounds(BaseModel):
"""Geographic bounding box."""
west: float = Field(..., description="Western longitude")
south: float = Field(..., description="Southern latitude")
east: float = Field(..., description="Eastern longitude")
north: float = Field(..., description="Northern latitude")
class AOICenter(BaseModel):
"""Geographic center point."""
longitude: float
latitude: float
class AOIManifest(BaseModel):
"""Unity bundle manifest for an AOI."""
version: str = Field("1.0.0", description="Manifest version")
aoi_id: str = Field(..., description="AOI identifier")
created_at: str = Field(..., description="Creation timestamp")
bounds: AOIBounds = Field(..., description="Geographic bounds")
center: AOICenter = Field(..., description="Geographic center")
area_km2: float = Field(..., description="Area in km²")
theme: str = Field(..., description="Learning theme")
quality: str = Field(..., description="Quality level")
assets: dict = Field(..., description="Asset file references")
unity: dict = Field(..., description="Unity-specific configuration")
class Config:
json_schema_extra = {
"example": {
"version": "1.0.0",
"aoi_id": "550e8400-e29b-41d4-a716-446655440000",
"created_at": "2024-01-15T12:00:00Z",
"bounds": {
"west": 9.1875,
"south": 47.7055,
"east": 9.1975,
"north": 47.7115,
},
"center": {
"longitude": 9.1925,
"latitude": 47.7085,
},
"area_km2": 0.45,
"theme": "topographie",
"quality": "medium",
"assets": {
"terrain": {"file": "terrain.heightmap.png", "config": "terrain.json"},
"osm_features": {"file": "osm_features.json"},
"learning_positions": {"file": "learning_positions.json"},
"attribution": {"file": "attribution.json"},
},
"unity": {
"coordinate_system": "Unity (Y-up, left-handed)",
"scale": 1.0,
"terrain_resolution": 256,
},
}
}