How pro158127/gastro-ai works
Gastro-AI is a clinical-image analysis application with JWT login, asynchronous analysis, and live result updates. A doctor signs in, uploads an image with patient-document details, and receives a processing record; a Celery task performs the scaffold’s stub inference, creates a Grad-CAM placeholder, requests an LLM explanation, persists the result, and publishes completion for the dashboard to retrieve and display. The README also documents polling as an alternative to WebSockets. AI integrations are currently stubs; unsampled modules are represented only where documented, so some links rely on README evidence.
Main entry points: tasks.py Analysis task · analisis_service.py Analysis service · main.py FastAPI entry · Dashboard.tsx Analysis dashboard
Components 21
Web client
- App routing
frontend/src/App.tsx - Login page
frontend/src/pages/Login.tsx - Analysis dashboard
frontend/src/pages/Dashboard.tsx - HTTP API client
frontend/src/services/api.ts - WebSocket client
frontend/src/services/websocket.ts
API and identity
- FastAPI entry
backend/app/main.py - Authentication routes
backend/app/routers/auth.py - JWT security
backend/app/security.py - Analysis routes
backend/app/routers/analisis.py - WebSocket routes
backend/app/routers/ws.py
Analysis processing
- Analysis service
backend/app/services/analisis_service.py - Analysis task
backend/app/tasks.py - Celery worker
backend/app/worker.py
Persistence and messaging
- PostgreSQL
- Redis
- MinIO object store
- ORM models
backend/app/models/analisis.py
AI and object storage
- LLM adapter
backend/app/adapters/llm_adapter.py - MinIO adapter
backend/app/adapters/minio_adapter.py
Other components
- Doctor / Admin
- Nginx gateway
nginx.conf
Connections 31
- Doctor / Admin → Nginx gateway: uses web
README.md - Nginx gateway → App routing: serves SPA
README.md - Nginx gateway → FastAPI entry: proxies API
README.md - Nginx gateway → WebSocket routes: proxies WebSocket
README.md - App routing → Login page: renders
frontend/src/App.tsx - App routing → Analysis dashboard: renders
frontend/src/App.tsx - Login page → HTTP API client: calls
frontend/src/pages/Login.tsx - Analysis dashboard → HTTP API client: calls
frontend/src/pages/Dashboard.tsx - Analysis dashboard → WebSocket client: subscribes
frontend/src/pages/Dashboard.tsx - HTTP API client → FastAPI entry: sends HTTP
README.md - WebSocket client → WebSocket routes: connects
README.md - FastAPI entry → Authentication routes: mounts routes
backend/app/main.py - FastAPI entry → Analysis routes: mounts routes
backend/app/main.py - FastAPI entry → WebSocket routes: mounts routes
backend/app/main.py - Authentication routes → PostgreSQL: queries users
backend/app/routers/auth.py - Authentication routes → JWT security: verifies and signs
backend/app/routers/auth.py - Analysis routes → Analysis service: delegates
backend/app/routers/analisis.py - Analysis service → MinIO adapter: stores image
backend/app/services/analisis_service.py - Analysis service → PostgreSQL: creates and reads
backend/app/services/analisis_service.py - Analysis service → Analysis task: enqueues
backend/app/services/analisis_service.py - Analysis service → ORM models: uses model
backend/app/services/analisis_service.py - Analysis task → Celery worker: uses app
backend/app/tasks.py - Analysis task → MinIO adapter: stores Grad-CAM
backend/app/tasks.py - Analysis task → LLM adapter: requests explanation
backend/app/tasks.py - Analysis task → PostgreSQL: updates result
backend/app/tasks.py - Analysis task → Redis: publishes event
backend/app/tasks.py - WebSocket routes → Redis: forwards events
README.md - MinIO adapter → MinIO object store: reads and writes
backend/app/adapters/minio_adapter.py - Analysis routes → PostgreSQL: uses session
backend/app/routers/analisis.py - Analysis routes → ORM models: uses model
backend/app/routers/analisis.py - Analysis dashboard → HTTP API client: polls status
README.md