AquaGen API Documentation
AquaGen API is a Flask-based water management IoT platform that collects sensor data from field devices, processes it into actionable reports and alerts, and exposes a REST API for web and mobile clients. It is designed to run cloud-native on Microsoft Azure.
Key Features
- Multi-format reports — generate reports as HTML, PDF, XLSX, or CSV from a single request
- Real-time IoT monitoring — ingests readings from flow, level, quality, energy, and borewell sensors via Storm
- Multi-channel alerts — delivers threshold and anomaly alerts over Email, SMS, Firebase Cloud Messaging, and Google Chat
- Water balance analysis — models inflow/outflow graphs and computes the Water Neutrality Index (WNI)
- Multi-tenancy — manage multiple industries and facilities from a single platform
- Azure cloud-native — built around Azure Cosmos DB, Azure Key Vault, Azure Blob Storage, and Azure Application Insights
- Enterprise security — JWT authentication with Azure AD integration, input validation, and Key Vault secret management
- Executive summary — cross-industry dashboard that aggregates and compares water consumption data across multiple facilities for management reporting
- SCADA diagram editor — configurable visual process-flow diagrams with nodes, edges, and real-time sensor data overlays
- RO efficiency tracking — monitors reverse-osmosis plant performance and logs activity with trend-based insights
- Lake Pulse — satellite and sensor-based lake health monitoring with water quality index, water availability trends, and CPCB-standard point trend analysis
- GWI — groundwater level intelligence computed from borewell sensor readings
- FWI — fresh water intelligence with step-based data collection
- Virtual / manual node entry — allows manual data entry for water, quality, level, energy, and piezometer readings where physical sensors are absent
- Rainfall data tracking — collects and reports rainwater measurements alongside surface water data
- Automated scheduled reports — admin-triggered batch report delivery via email on a scheduled basis
- Flexible authentication — supports Default, Microsoft SSO, Google SSO, OTP, and External login modes
- Role-based access control — fine-grained permission system (Super User, Admin, User, and feature-level flags such as Water Balance, Efficiency, UWI, RWI, Water Neutrality)
Use Cases
Water Management
- Monitor water consumption across multiple sources and facilities
- Track water levels in tanks, reservoirs, and borewells
- Generate compliance and operational reports
IoT Device Monitoring
- Real-time data from flow meters, level sensors, and quality analyzers
- Device health monitoring and offline detection
- Historical data analysis and trend visualization
Energy Monitoring
- Track power consumption for water pumps and treatment systems
- Correlate energy usage with water production
Water Quality
- Monitor quality parameters (pH, TDS, COD, BOD, DO, etc.)
- Generate quality compliance reports
Architecture Highlights
info
- Layered Architecture: Auth → Routes → Services → Formatters pattern for clean separation of concerns
- 10 Report Types: Daily, Monthly, Hourly, Granular, Weekly, Custom, Summary, Daily Range, Monthly Range
- Multi-format Output: HTML, PDF, XLSX, CSV generated via ReportLab, xhtml2pdf, and xlsxwriter
Technology Stack
| Component | Technology |
|---|---|
| Web Framework | Flask 2.3.3 + Flask-RESTX |
| Database | Azure Cosmos DB (SQL API) |
| Authentication | Flask-JWT-Extended + Azure AD |
| Secret Management | Azure Key Vault |
| Report Generation | ReportLab / xhtml2pdf / xlsxwriter |
| Data Processing | Pandas / NumPy / SciPy |
| Monitoring | Azure Application Insights |
| IoT Connectivity | Storm |
Documentation Sections
| Section | Description | Link |
|---|---|---|
| Getting Started | Setup, installation, and first steps | Getting Started |
| Architecture | System design, components, and data flow | Architecture Overview |
| Core Concepts | Authentication, services, formatters, reports | Authentication |
| API Reference | All endpoints with request/response examples | User API |
| Guides | Step-by-step tutorials for common tasks | Report Generation |
| Deployment | Azure setup, configuration, and security | Azure Setup |
| Advanced Topics | Water balance, external integrations, performance | External Integrations |
| Development | Contributing, testing, and extending the API | Project Structure |