Reproducible EEG streaming demo: simulated multi-band signals (delta/theta/alpha/beta), ring buffer with backpressure, REST + SSE API, and live canvas visualization.
pip install -r requirements.txt
uvicorn app.main:app --reloadOpen http://localhost:8000 for the UI; API at http://localhost:8000/api/.
docker build -t eeg-demo .
docker run -p 8000:8000 eeg-demo| Endpoint | Description |
|---|---|
GET /api/signals |
One EEG snapshot (timestamp + channels). |
GET /api/stream |
Server-Sent Events stream of snapshots. |
POST /api/config |
Update channels and sample rate (JSON body). |
GET /api/status |
Buffer size, capacity, dropped sample count. |
GET /api/health |
Liveness check. |
pytest tests/ -vRun from the eeg_demo directory.
- Service —
EEGService: multi-band signal generation, ring buffer (fixed capacity), drop count when full. Background asyncio task produces at sample rate. - API — FastAPI: polling (
/api/signals), SSE (/api/stream), config and status. - Frontend — Single HTML/JS canvas; EventSource for stream, fallback to polling; scrolling traces per channel.