A comprehensive Flask web application for managing a network of microclimate sensors, their readings, locations, and maintenance events.
This project is developed as per UE23CS351A Mini Project Guidelines and provides a complete CRUD interface for managing:
- Sensor Types
- Locations
- Sensors
- Readings
- Technicians
- Maintenance Events
- Full CRUD Operations for all entities
- Dashboard with real-time statistics
- Search & Filter capabilities for sensors
- Reports & Analytics with complex SQL queries
- Stored Procedures & Triggers for automated operations
- Responsive UI using Bootstrap 5
- RESTful API architecture
- Backend: Flask, SQLAlchemy
- Database: MySQL 8.0+
- Frontend: HTML5, Bootstrap 5, JavaScript
- Environment Management: python-dotenv
- Python 3.8 or higher
- MySQL 8.0 or higher
- pip (Python package manager)
cd /path/to/your/workspacepython3 -m venv venv
source venv/bin/activate # On macOS/Linux
# OR
venv\Scripts\activate # On Windowspip install -r requirements.txtcp .env.example .envEdit .env file with your MySQL credentials:
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=microclimate_grid
SECRET_KEY=your_secret_key
-
Login to MySQL:
mysql -u root -p
-
Create Database and Import Schema:
CREATE DATABASE microclimate_grid; exit;
-
Import the schema with sample data:
mysql -u root -p microclimate_grid < database/schema.sql
python app.pyThe application will be available at: http://localhost:5000
MicroGrid/
├── app.py # Main Flask application
├── config.py # Configuration settings
├── models.py # SQLAlchemy database models
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── .gitignore # Git ignore rules
├── README.md # This file
├── database/
│ ├── schema.sql # Complete database schema
│ └── dump.sql # Database dump with data
├── templates/
│ ├── base.html # Base template
│ ├── index.html # Dashboard
│ ├── sensor_types/ # SensorType CRUD
│ ├── locations/ # Location CRUD
│ ├── sensors/ # Sensor CRUD
│ ├── readings/ # Reading CRUD
│ ├── technicians/ # Technician CRUD
│ ├── maintenance/ # Maintenance CRUD
│ └── reports/ # Reports & Analytics
├── static/
│ ├── css/
│ │ └── style.css # Custom styles
│ └── js/
│ └── script.js # Custom JavaScript
└── screenshots/ # Application screenshots
The application uses 6 main tables:
- SensorType - Types of sensors (Temperature, Humidity, etc.)
- Location - Geographic locations with coordinates
- Sensor - Individual sensor devices
- Reading - Sensor measurements
- Technician - Maintenance personnel
- MaintenanceEvent - Maintenance activities
See database/schema.sql for complete schema including triggers and stored procedures.
- Navigate to
/to view the main dashboard - View statistics on active sensors, readings, and maintenance
- Sensor Types:
/sensor-types - Locations:
/locations - Sensors:
/sensors - Readings:
/readings - Technicians:
/technicians - Maintenance:
/maintenance
- Navigate to
/reportsfor advanced analytics - View aggregate data, joins, and complex queries
- Use search bars on list pages
- Filter sensors by type, status, and location
GetSensorReadings(sensor_id)- Fetch all readings for a sensorGetMaintenanceSummary()- Summary of maintenance events
before_sensor_update- Log status changesafter_maintenance_insert- Update maintenance timestamp
- Sensor readings by location
- Technician performance metrics
- Average readings per sensor type
- Maintenance frequency analysis
- Never commit
.envfile - Change
SECRET_KEYin production - Use strong database passwords
- Implement proper authentication for production
Complete documentation available in documentation/ folder:
- ER Diagram
- User Requirements Specification
- API Documentation
- Screenshots
- PESU University
- UE23CS351A Database Management Systems TAs
- Flask Documentation
- Bootstrap Framework
Last Updated: October 2025