File size: 1,558 Bytes
c223e92 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | """Pydantic models for ExoVetter API request/response schemas."""
from pydantic import BaseModel
from typing import Optional, List, Dict, Any
class UploadResponse(BaseModel):
"""Response returned after a successful file upload."""
job_id: str
filename: str
rows: int
columns: List[str]
preview: List[Dict[str, Any]]
message: str
class PlotData(BaseModel):
"""Chart data for the frontend visualizations."""
raw_flux: Dict[str, List[float]] # {time: [...], flux: [...]}
cleaned_flux: Dict[str, List[float]] # {time: [...], flux: [...]}
periodogram: Dict[str, List[float]] # {period: [...], power: [...]}
folded_curve: Dict[str, List[float]] # {phase: [...], flux: [...]}
classification_bars: Dict[str, Any] # {labels: [...], probs: [...], predicted: str}
class PipelineResult(BaseModel):
"""Full pipeline output for a single target."""
target_name: str
preprocessed: Dict[str, Any]
tls_result: Dict[str, float]
features: Dict[str, List[float]]
classification: Dict[str, Any]
parameters: Dict[str, Any]
plots: PlotData
class ProcessResponse(BaseModel):
"""Response from the /process endpoint."""
status: str # 'done', 'processing', 'error'
result: Optional[PipelineResult] = None
error: Optional[str] = None
progress: Optional[int] = None
class ErrorResponse(BaseModel):
"""Structured error envelope used across all endpoints."""
error: bool = True
code: str
message: str
suggestion: Optional[str] = None
|