Add governance and TEA preview REST endpoints

Use the models router for curves and training inputs, the EEG router for summary, and a separate preview router. Keep the preview result typed with the existing persistence model and declare multipart binary schemas for generated Blob parameters.
This commit is contained in:
2026-11-29 19:44:45 -06:00
parent 9e5aa20092
commit 80b3d23b75
6 changed files with 274 additions and 7 deletions
+9
View File
@@ -1,6 +1,8 @@
"""TEA's EEGs for model governance: every study with its analysis verdict, and one study's
metrics with their age curves' scores."""
from typing import Any
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel
@@ -36,6 +38,8 @@ class Analysis(BaseModel):
level: str | None
age_months: float | None
metrics: list[Metric]
checks: list[dict[str, Any]]
regions: list[dict[str, Any]]
class AnalyzeRequest(BaseModel):
@@ -55,6 +59,11 @@ def analyze_eegs(request: AnalyzeRequest, client=Depends(dagster)) -> dict[str,
return submit(client, "tea_eeg", "tea_analyze_studies", config, domain="tea")
@router.get("/summary")
def eeg_summary() -> dict[str, int]:
return eeg.summary()
@router.get("/{eeg_id}")
def study(eeg_id: str) -> Analysis:
if (found := eeg.study(eeg_id)) is None: