Welcome to NeuroHeart! This is an intelligent system combining IoT (Internet of Things) and AI (Artificial Intelligence) to monitor cardiovascular health and predict stroke risks in real-time.
The system consists of 3 main components working together:
- IoT Device (Hardware): Measures heart rate and oxygen saturation (SpO2) from the patient and sends data to the Server.
- Server & AI (The Brain): Receives data, runs the AI model (XGBoost) to analyze risk factors.
- Client (Web & Zalo): Displays results and sends emergency alerts to relatives/doctors.
Before starting, ensure your computer has the following tools:
- Python (version 3.8+): The main programming language.
- Download: python.org
- VS Code: Code editor.
- Git: Version control tool (to download the project).
- Mosquitto MQTT: Middleware to receive messages from sensors.
- Python Libraries (included in
requirements.txt):Flask: Runs the web server.pandas,numpy: Data processing.xgboost,scikit-learn: Runs the AI model.paho-mqtt: MQTT connection.
How to run the project on your personal computer.
Open Terminal (or CMD/PowerShell) and run:
git clone https://github.com/Wangtran106/NeuroHeart_Project.git
cd NeuroHeart_ProjectA virtual environment keeps libraries organized.
# Windows
python -m venv venv
venv\Scripts\activate
# Mac/Linux/Ubuntu
python3 -m venv venv
source venv/bin/activate(After running, you should see (venv) at the start of your Terminal line)
Run the following command to automatically install all required libraries:
pip install -r requirements.txtCreate a file named .env (with the dot at the beginning) and fill in the following parameters:
# MQTT Configuration (Use Localhost if running locally)
MQTT_BROKER=127.0.0.1
MQTT_PORT=1883
MQTT_USERNAME=wangtran
MQTT_PASSWORD=1006
# Web Configuration
FRONTEND_API_URL=http://127.0.0.1:5000
SECRET_KEY=your-secret-keypython app.pyIf you see Running on http://127.0.0.1:5000, it is successful! Open your browser and visit that address.
To put the project online for public access.
- Zalo Bot: Code located in
zalo_module.py. GetZALO_BOT_TOKENand add it to.env. - Sensor (ESP32): Hardware code (Arduino) needs to be flashed separately.
Author: Tran Dinh Quang Contact: trandinhquang011@gmail.com