schemas.py 1.2 KB

123456789101112131415161718192021222324252627282930
  1. from datetime import datetime
  2. from typing import Optional, Dict, List
  3. import matplotlib
  4. matplotlib.use("Agg")
  5. from fastapi import FastAPI, UploadFile, File, HTTPException, BackgroundTasks
  6. from fastapi.responses import FileResponse, StreamingResponse
  7. from pydantic import BaseModel, Field
  8. class StartSessionRequest(BaseModel):
  9. file_raw_id: str = Field(..., description="id загруженного .mat/.h5")
  10. file_json_id: str = Field(..., description="id загруженного JSON с параметрами")
  11. file_order_id: Optional[str] = Field(None, description="id JSON с порядком k-space (для nonlinear/radial)")
  12. sequence_name: str = Field(..., description="linear_decart | nonlinear_decart(tse) | linear_epi | radial_propeller")
  13. digit: str = Field(..., description="'2d' или '3d'")
  14. phase_shift: bool = Field(False, description="включать RF-spoil из JSON или обнулить")
  15. class SessionStatus(BaseModel):
  16. session_id: str
  17. status: str # queued | running | done | error
  18. progress: float
  19. message: str
  20. created_at: str
  21. updated_at: str
  22. result_files: List[str] = []
  23. error_traceback: Optional[str] = None