A comprehensive health monitoring system with real-time IoT sensor data collection, alerts, and analytics.
SHMS/
├── backend/ # Flask REST API
│ ├── app/
│ │ ├── __init__.py
│ │ ├── models.py # Database models
│ │ └── routes.py # API endpoints
│ ├── requirements.txt
│ └── run.py
├── frontend/ # React web application
│ ├── public/
│ ├── src/
│ │ ├── pages/
│ │ ├── components/
│ │ ├── api.js
│ │ └── App.js
│ └── package.json
└── iot-simulator/ # IoT simulator for testing
└── simulator.py
- User Authentication: Register, login, and manage user accounts
- Health Monitoring: Track heart rate and temperature in real-time
- Alerts: Automatic alerts when health metrics exceed defined thresholds
- Health Statistics: View daily, weekly, and monthly health trends
- Customizable Thresholds: Set personalized alert thresholds
- Health History: View complete health records
- User Profile: Manage personal health information
-
Navigate to the backend directory:
cd backend -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the Flask server:
python run.py
The API will be available at http://localhost:5000
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm start
The application will open at http://localhost:3000
-
Navigate to the simulator directory:
cd iot-simulator -
Install dependencies:
pip install requests
-
Run the simulator:
python simulator.py
The simulator will:
- Create a test user (if not exists)
- Send health data every 5 seconds
- Display statistics and alerts periodically
POST /api/auth/register- Register a new userPOST /api/auth/login- Login user
POST /api/health/add- Add health data readingGET /api/health/latest- Get latest health dataGET /api/health/history?days=7- Get health historyGET /api/health/stats?days=7- Get health statistics
GET /api/users/profile- Get user profilePUT /api/users/profile- Update user profileGET /api/users/thresholds- Get alert thresholdsPUT /api/users/thresholds- Update alert thresholds
GET /api/alerts/list- Get user alertsPUT /api/alerts/<id>/read- Mark alert as readPUT /api/alerts/read-all- Mark all alerts as read
The system uses SQLite for local development. The database file shms.db is created automatically in the backend/app directory.
Models:
- User: Stores user account information
- HealthData: Stores health readings (heart rate, temperature)
- Alert: Stores health alerts
- ThresholdSettings: Stores customizable alert thresholds
- Heart Rate: 60-100 bpm
- Temperature: 36.0-38.0°C
These can be customized per user through the Settings page.
- Start the backend server
- Start the frontend application
- Run the IoT simulator
The simulator will automatically:
- Register a test user (
testuser) - Send simulated health data
- Trigger alerts when thresholds are exceeded
You can then:
- View the data in the dashboard
- Check alerts and health statistics
- Customize thresholds in settings
- Update your profile
Backend:
- Flask - Web framework
- Flask-SQLAlchemy - ORM
- Flask-JWT-Extended - JWT authentication
- Flask-CORS - CORS handling
Frontend:
- React 18+ - UI framework
- React Router - Navigation
- Axios - HTTP client
- Chart.js - Data visualization
Database:
- SQLite - Local database
- Real IoT device integration
- Multiple device support
- Advanced analytics and predictions
- Mobile app
- Email/SMS notifications
- Data export (PDF, CSV)
- Doctor consultation integration
- Medication reminders
This project is open source and available under the MIT License.