AquaPredict is a comprehensive, full-stack software system designed for sustainable water resource management. It provides powerful predictive analytics, water demand forecasting, and reservoir storage simulations. Originally built as a Streamlit prototype, AquaPredict is now a modern web application featuring a high-performance Python FastAPI backend and a dynamic, responsive React frontend.
- Time Series Forecasting: ARIMA-based water demand prediction models trained on historical data.
- Reservoir Simulation: Physical water balance modeling capturing storage dynamics under various pressure scenarios.
- Gap Analysis: Supply-demand comparison alerting to potential shortage windows and establishing risk classifications.
- Interactive Dashboards: A state-of-the-art React frontend utilizing Recharts and dynamic SVG mapping for data exploration.
- Global State Sync: Select any Indian state (e.g., Andhra Pradesh, Telangana, Maharashtra) to instantly re-calculate and re-render the entire analytical pipeline for that region.
- Framework: React 18, Vite
- Language: TypeScript
- Styling: Tailwind CSS, generic UI components (Radix UI)
- Data Fetching: React Query (
@tanstack/react-query), Axios - Data Visualization: Recharts (Area, Line, Bar charts)
- Icons: Lucide React
- Framework: FastAPI, Uvicorn
- Language: Python 3.10+
- Data Science / Modeling: Pandas, NumPy, Statsmodels (ARIMA)
- Architecture: RESTful API endpoints serving JSON payloads.
AquaPredict utilizes a monorepo architecture, housing both the Python backend and React frontend within the same repository.
AquaPredict/
├── api.py # Main FastAPI Application Entrypoint
├── data/ # Datasets (e.g., master_reservoir_dataset.csv)
├── preprocessing/ # Python: Data ingestion and cleaning modules
├── forecasting/ # Python: ARIMA demand forecasting engine & React: DemandForecast.tsx
├── simulation/ # Python: Reservoir modeling & React: ReservoirSimulation.tsx
├── analysis/ # Python: Gap analysis & React: SupplyDemandAnalysis.tsx, RainfallInflow.tsx
├── dashboard/ # React: Main UI components, layout, App.tsx, main.tsx, StateContext
├── public/ # Static assets (favicon)
├── index.html # Vite React entry HTML
├── package.json # Node.js dependencies
├── vite.config.ts # Vite build configuration
├── tailwind.config.ts # Tailwind CSS configuration
├── requirements.txt # Python dependencies
└── README.md # This file
You will need both Python and Node.js installed on your system.
Navigate to the root directory and install the required Python packages:
pip install -r requirements.txtIn the same root directory, install the Node packages:
npm installTo run the full application locally, you need to spin up both the FastAPI server and the Vite React server simultaneously in two separate terminal windows.
Run the Python API on localhost:8000:
python -m uvicorn api:fastapi_app --reloadThe API will boot, load the data preprocessors, and wait for frontend queries.
Run the React Dashboard:
npm run devVite will start the dev server, usually at http://localhost:8080/ or http://localhost:5173/.
Open the local network link provided by Vite in your browser to interact with AquaPredict!
- User Interaction: The user selects a state (e.g., "Maharashtra") from the global
StateContextdropdown in the React top bar. - React Query:
axiosintercepts the state change and fires aGETrequest tohttp://localhost:8000/api/analysis/Maharashtra. - FastAPI Processing:
- Python receives the request.
- It filters the
aquapredict_master_reservoir_dataset.csvvia theDataPreprocessor. - The data is routed through the ARIMA forecasting and Reservoir Simulation modules.
- A compiled analytical response containing KPIs and chart axes is constructed.
- Data Visualization: React receives the structured JSON from Python and smoothly re-renders the Recharts visualizations on the dashboard.
The analytical engine categorizes periods into:
- 🟢 Safe: Storage > 60% capacity
- 🟠 Moderate: Storage 30-60% capacity (Stress Zone)
- 🔴 Critical: Storage < 30% capacity (Immediate Action Needed)
Developed for evidence-based water resource management and policy planning.