An actor-based, real-time patient monitoring system for the ICU, designed to simulate a hospital environment. It uses Apache Kafka for streaming patient vital signals and leverages LLMs (Gemini and Groq) for intelligent alert analysis, all presented on a Flask-based real-time dashboard.
- A real-time ICU patient monitoring system.
- Streams ECG, SpO₂, ABP signals etc.
- Uses Pykka actors + Kafka for scalable processing.
- Uses LLMs (Gemini + Groq) for intelligent alert generation.
- Frontend built with Flask + Socket.IO.
- Simulates real-world hospital data environment.
- Actor-based architecture (Supervisor > PatientActor > SignalActor).
- Kafka-driven streaming of patient vitals with 500ms delay.
- LLM actors (Gemini + Groq) for analyzing medical alerts.
- WebSocket-based real-time frontend with signal charts + alerts.
- Rule-based anomaly detection (e.g., flatline, threshold breaches).
- Multi-patient management and signal isolation per patient.
git clone https://github.com/IOutis/ICU_Patient_monitoring_system.git
cd ICU_Patient_monitoring_system
python -m venv monitoring_venv
source monitoring_venv/bin/activate # On Windows: monitoring_venv\Scripts\activate
pip install -r requirements.txt- Run these files in the given order
- data_preparation/data/load_data.py
- data_preparation/data_download/tracks_data_download.py
- Kafka must be running on default ports (
localhost:9092). - Required topics must be created beforehand.
- You can use Docker or a local installation to run Kafka.
Run the following in separate terminals from the root directory:
# 1. Gemini LLM Actor
python -m monitoring_system.gemini_llm_class
# 2. Groq LLM Actor
python -m monitoring_system.groq_llm_class
# 3. Flask + Socket.IO Webserver
python -m webserver.server
# 4. Kafka Producer (streams vitals every 500ms)
python monitoring_system/pykka_producer.py
# 5. Kafka Consumer + Actor System
python -m monitoring_system.pykka_consumerThese processes are designed to run concurrently and communicate via Kafka + actor messaging.
Open in your browser:
http://localhost:5000
You'll see:
- Live patient signal graphs (ECG, SpO₂, ABP etc.)
- Real-time anomaly alerts
- Streamed via WebSocket + actor signals
- Python: Main backend language
- Pykka: Actor model framework
- Kafka: Message queue for real-time signal streaming
- Flask + Socket.IO: Real-time web frontend
- LLMs: Gemini + Groq for intelligent alert handling
- HTML/JS: Dashboard frontend templates
- A
.envfile can store:GEMINI_APIGEMINI_API_2GROQ_API_1GROQ_API_2GROQ_API_3- Kafka topic names
- You can modify signal file paths or thresholds in
pykka_producer.pyand the consumer logic.
- Add model-based anomaly detection (if labeled data is available)
- Add patient authentication/login
- Switch to a WebSocket backend with FastAPI for scalability
- Dockerize the full pipeline for easier deployment
Mohd Mushtaq
Aspiring AI Agent Engineer | Full-Stack Developer
GitHub: https://github.com/IOutis



