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:
Kevin
2026-04-21 18:33:54 +08:00
parent d1a3d029ec
commit 04866559db
56 changed files with 7196 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Start PostgreSQL (docker-compose.dev.yml) and run the FastAPI app with hot reload.
# Start PostgreSQL from docker-compose.dev.yml and run the FastAPI app on the host.
# Usage: ./start.sh
# Optional: SKIP_DOCKER=1 to skip Compose (use external DB). Set DATABASE_URL accordingly.
# Optional: SKIP_DOCKER=1 to skip Compose and use an existing PostgreSQL instance.
set -euo pipefail
@@ -23,9 +23,13 @@ if [[ "${SKIP_DOCKER:-0}" != "1" ]]; then
sleep 1
done
else
echo "SKIP_DOCKER=1: not starting Docker Compose; using DATABASE_URL from the environment."
echo "SKIP_DOCKER=1: not starting Docker Compose; using POSTGRES_* or DATABASE_URL from the environment."
fi
export DATABASE_URL="${DATABASE_URL:-postgresql+asyncpg://postgres:postgres@localhost:5432/operation_room}"
export POSTGRES_USER="${POSTGRES_USER:-postgres}"
export POSTGRES_PASSWORD="${POSTGRES_PASSWORD:-postgres}"
export POSTGRES_DB="${POSTGRES_DB:-operation_room}"
export POSTGRES_HOST="${POSTGRES_HOST:-localhost}"
export POSTGRES_PORT="${POSTGRES_PORT:-35432}"
exec uv run uvicorn main:app --host "${HOST:-0.0.0.0}" --port "${PORT:-8000}" --reload
exec uv run uvicorn main:app --host "${HOST:-0.0.0.0}" --port "${PORT:-38080}" --reload