feat: surgery pipeline API, video inference, voice confirm, and tests
- Add FastAPI routes for surgery start/end, results, pending confirmation (WAV upload), and health checks. - Implement RTSP/Hikvision capture, consumable classification, session manager, MinIO/Baidu voice resolution, and DB persistence. - Add documentation (client API, video backends, staging checklist) and sample camera/RTSP config. - Add pytest suite (API contract, session manager, voice, repositories, pipeline persistence) and httpx dev dependency. - Replace deprecated HTTP_422_UNPROCESSABLE_ENTITY with HTTP_422_UNPROCESSABLE_CONTENT. - Fix SurgeryPipeline DB reads to use an explicit transaction with autobegin disabled. Made-with: Cursor
This commit is contained in:
@@ -4,9 +4,10 @@ from sqlalchemy import text
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
||||
|
||||
from app.config import settings
|
||||
from app.db.base import Base
|
||||
|
||||
engine = create_async_engine(
|
||||
settings.database_url,
|
||||
settings.sqlalchemy_database_url,
|
||||
pool_pre_ping=True,
|
||||
)
|
||||
|
||||
@@ -27,3 +28,11 @@ async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
||||
async def check_database() -> None:
|
||||
async with engine.connect() as conn:
|
||||
await conn.execute(text("SELECT 1"))
|
||||
|
||||
|
||||
async def init_db_schema() -> None:
|
||||
"""创建缺失的表(开发/首次部署;生产可改为 Alembic 迁移)。"""
|
||||
import app.db.models # noqa: F401 - register ORM tables on Base.metadata
|
||||
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
|
||||
Reference in New Issue
Block a user