29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from fastapi import APIRouter, Depends, status
|
|
from common.deps import verify_api_key
|
|
from models.analysis import AnalysisCreate, AnalysisStartResponse, AnalysisStatusResponse
|
|
|
|
router = APIRouter(prefix="/api/analyses", tags=["analyses"], dependencies=[Depends(verify_api_key)])
|
|
|
|
|
|
@router.post("", status_code=status.HTTP_202_ACCEPTED, response_model=AnalysisStartResponse)
|
|
async def start_analysis(body: AnalysisCreate):
|
|
return AnalysisStartResponse(
|
|
analysis_run_id="22222222-2222-2222-2222-222222222222",
|
|
clinic_id=body.clinic_id or "11111111-1111-1111-1111-111111111111",
|
|
status="discovering",
|
|
estimated_seconds=90,
|
|
poll_url="/api/analyses/22222222-2222-2222-2222-222222222222/status",
|
|
)
|
|
|
|
|
|
@router.get("/{run_id}/status", response_model=AnalysisStatusResponse)
|
|
async def get_analysis_status(run_id: str):
|
|
return AnalysisStatusResponse(
|
|
analysis_run_id=run_id,
|
|
status="collecting",
|
|
progress=0.45,
|
|
current_step="채널 데이터 수집 중",
|
|
channel_errors={},
|
|
completed_at=None,
|
|
)
|