A full-stack MERN application that analyzes the relationship between live air pollution levels and disease spread using IoT sensors and federated learning.
- Modern Glassmorphism UI - Beautiful 3D glassmorphism design with smooth animations
- Real-time Data Visualization - Interactive charts showing AQI, pollutants, and health metrics
- MongoDB Backend - Scalable data storage with Express.js REST API
- IoT Integration - Support for real-time sensor data ingestion
- Responsive Design - Works seamlessly on desktop and mobile devices
Swasthya/
├── backend/ # Express.js server
│ ├── src/
│ │ ├── server.js # Main server file
│ │ ├── models/ # MongoDB models
│ │ └── routes/ # API routes
│ ├── scripts/
│ │ └── seedDatabase.js # Database seeding script
│ └── .env # Environment variables
├── frontend/ # React application
│ ├── src/
│ │ ├── pages/ # Page components
│ │ ├── App.jsx # Main app component
│ │ └── main.jsx # Entry point
│ └── package.json
└── iot/ # IoT sensor data
└── sensorData.json # Sample sensor data
- React 19
- React Router DOM
- Recharts (Data Visualization)
- Vite (Build Tool)
- Pure CSS (Glassmorphism Styling)
- Node.js
- Express.js
- MongoDB Atlas
- Mongoose ODM
- CORS
- Node.js (v20.19+ or v22.12+)
- MongoDB Atlas Account (or local MongoDB)
- Navigate to backend directory:
cd backend- Install dependencies:
npm install- Create a
.envfile in the backend directory:
cp .env.example .env- Update the
.envfile with your MongoDB connection string:
MONGODB_URI=your_mongodb_connection_string_here
PORT=5000
- Seed the database with sample IoT data:
npm run seed- Start the backend server:
npm startThe server will run on http://localhost:5000
- Navigate to frontend directory:
cd Frontend-
Dependencies are already installed
-
Start the development server:
npm run devThe frontend will run on http://localhost:5173
-
Homepage: Navigate to
http://localhost:5173- Modern glassmorphism landing page
- Features overview
- Navigation to dashboard
-
Dashboard: Click "View Dashboard" or go to
http://localhost:5173/dashboard- Real-time AQI and pollution metrics
- Interactive charts and graphs
- Health impact analysis
- Location-based data
GET /api/sensor-data- Get all sensor data (limited to 50 records)GET /api/sensor-data/latest- Get latest 10 sensor readingsGET /api/sensor-data/location/:area- Get data by location areaGET /api/sensor-data/stats- Get aggregated statisticsPOST /api/sensor-data- Add new sensor data
# Get latest sensor data
curl http://localhost:5000/api/sensor-data/latest
# Get statistics
curl http://localhost:5000/api/sensor-data/statsThe system monitors:
- AQI (Air Quality Index)
- PM10 & PM2.5 (Particulate Matter)
- NO₂ (Nitrogen Dioxide)
- SO₂ (Sulfur Dioxide)
- O₃ (Ozone)
- Temperature
- Humidity
- Wind Speed
- Respiratory Cases
- Cardiovascular Cases
- Hospital Admissions
- Health Impact Score
- Health Impact Classification
- 3D Glassmorphism: Modern glass-like UI components with backdrop blur
- Animated Background: Floating gradient spheres with smooth animations
- Responsive Layout: Mobile-first design that works on all devices
- Live Data Indicators: Real-time pulse animations
- Interactive Charts: Smooth, animated Recharts visualizations
- Color-coded AQI: Easy-to-understand health risk levels
- Add data to
iot/sensorData.jsonfollowing the existing format - Run the seed script:
cd backend && npm run seed - Refresh the dashboard to see new data
- Federated Learning Integration
- WebSocket for real-time updates
- User Authentication (Government/Hospital portals)
- AWS Deployment
- ML Model Integration
- Mobile App
- Email Alerts for High AQI
Create a .env file in the backend directory:
MONGODB_URI=your_mongodb_connection_string_here
PORT=5000
Replace your_mongodb_connection_string_here with your actual MongoDB Atlas connection string.
This is a full-stack project for air quality and health correlation analysis. Contributions are welcome!
MIT License
Built with ❤️ for better public health decisions
Note: This is an MVP (Minimum Viable Product). The federated learning, IoT sensor integration, and AWS deployment will be implemented in future phases.