| """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]] |
| cleaned_flux: Dict[str, List[float]] |
| periodogram: Dict[str, List[float]] |
| folded_curve: Dict[str, List[float]] |
| classification_bars: Dict[str, Any] |
|
|
|
|
| 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 |
| 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 |
|
|