Skip to content

Kuldeep2822k/aqua-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

550 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌊 AQUA-AI

AI-Powered Water Quality Monitoring Platform for India

πŸ€– Real-time Environmental Intelligence | πŸ›οΈ Government Data Integration | πŸ“Š Predictive Analytics


GitHub Stars GitHub Forks GitHub Issues Build Status License: MIT Repo Size


⭐ Help Us Protect India's Water - Star This Repository!

If you find this project useful or support water security in India, please give us a ⭐ on GitHub. It helps more people discover and contribute to this mission!


πŸš€ AI-Powered Water Quality Monitoring Platform for India

Real-time insights β€’ Government data integration β€’ Predictive analytics β€’ Public health protection


🌟 Why Star This Project?

  • πŸ§ͺ Social Impact: Directly addresses a water crisis affecting 600M+ people in India.
  • πŸ€– Cutting-Edge Tech: High-tier AI/ML integration with React and Node.js.
  • πŸ›οΈ Open Data: Bridges the gap between government data and public awareness.
  • πŸ’Ό Professional Quality: Built to production standards, making it a great reference for recruiters.

🌟 Project Highlights

🎯 What Makes This Special

  • πŸ€– AI-Powered Predictions - Machine learning models forecast pollution events
  • πŸ—ΊοΈ Interactive Visualization - Real-time India water quality map
  • πŸ›οΈ Government Data Integration - Official CPCB and Ministry data sources
  • πŸ“± Full-Stack Solution - React frontend + Node.js backend + Python ML
  • 🌐 Public Impact - Serves 1.4 billion people's water safety needs

πŸ’‘ Key Features

  • βœ… Real-time monitoring across Indian water bodies
  • βœ… Risk level assessment with color-coded alerts
  • βœ… Historical trend analysis and pattern recognition
  • βœ… Pollution event forecasting using AI models
  • βœ… Public health alerts and safety recommendations
  • βœ… Mobile-responsive design for universal access

πŸ“Š Data Sources & Integration

πŸ›οΈ Official Government Data Sources


🏒 **National Water Quality Database**
🌊 River Water Quality Monitoring
πŸ”— jal.gov.in

🏦 **Water Quality Monitoring Network**
🏭 Industrial Pollution Data
πŸ”— cpcb.nic.in

πŸ“Š **Various Water Quality Datasets**
🌐 Open Government Platform
πŸ”— data.gov.in

πŸ’§ **Groundwater Quality Data**
🌊 Surface Water Monitoring
πŸ”— Research Institute

πŸ§ͺ Water Quality Parameters Monitored

Parameter πŸ“Š Indicator 🎯 Purpose ⚠️ Risk Level
BOD Biochemical Oxygen Demand 🌿 Organic pollution High
TDS Total Dissolved Solids πŸ’§ Water purity Medium
Heavy Metals Lead, Mercury, Cadmium, Arsenic ☠️ Toxic contamination Critical
pH Level Acidity/Alkalinity βš–οΈ Chemical balance Medium
Dissolved Oxygen Aquatic life indicator 🐟 Ecosystem health High
Coliform Bacterial contamination πŸ¦€ Biological safety Critical
Nitrates/Phosphates Agricultural runoff 🌾 Nutrient pollution Medium

πŸš€ Technology Stack

🎨 Modern Tech Stack Powering Water Intelligence

🌐 Frontend Excellence

πŸ“± React 18 + TypeScript for type-safe, responsive UI
πŸ—ΊοΈ Leaflet/Mapbox for interactive geographical visualization
🎨 Modern CSS3 + Responsive Design for universal access

βš™οΈ Backend Powerhouse

πŸš€ Node.js + Express.js for scalable API architecture
🐍 Python FastAPI for high-performance ML model serving
πŸ”’ JWT Authentication + Bcrypt password hashing
βœ… Input Validation + CORS + Rate Limiting security
πŸ“ Winston Logger for structured logging

πŸ—„οΈ Database & Storage

πŸ—ΊοΈ PostgreSQL + PostGIS for spatial data operations
⚑ Redis for caching and session management
πŸ“‹ SQLite for development and testing environments

πŸ€– AI/ML Pipeline

πŸ€– TensorFlow + Scikit-Learn for predictive modeling
πŸ“Š Pandas + NumPy for data processing and analysis
🎨 Matplotlib + Plotly for data visualization

🐳 DevOps & Deployment

🐳 Docker containerization for consistent deployments
🌐 AWS/Cloud hosting with auto-scaling capabilities
πŸ”„ CI/CD Pipeline with automated testing and deployment

πŸ“ Project Architecture

🌊 aqua-ai-project/
β”Š
β”œβ”€β”€ 🌐 frontend/              # React + TypeScript Application
β”‚   β”œβ”€β”€ 🎨 src/components/    # Reusable UI components
β”‚   β”œβ”€β”€ πŸ—ΊοΈ src/pages/        # Route-based page components
β”‚   β”œβ”€β”€ πŸ”§ src/hooks/        # Custom React hooks
β”‚   β”œβ”€β”€ πŸ“Š src/contexts/     # State management contexts
β”‚   └── 🌍 public/          # Static assets and PWA config
β”Š
β”œβ”€β”€ βš™οΈ backend/               # Node.js + Express API Server
β”‚   β”œβ”€β”€ πŸ›£οΈ src/routes/       # API endpoint definitions (auth)
β”‚   β”œβ”€β”€ �️ routes/           # API routes (water quality, locations, etc.)
β”‚   β”œβ”€β”€ οΏ½πŸ’Ύ src/models/       # Database models (User, etc.)
β”‚   β”œβ”€β”€ πŸ”’ src/middleware/   # Auth, validation, error handling
β”‚   β”œβ”€β”€ πŸ—„οΈ src/db/          # Database connection and queries
β”‚   └── οΏ½ src/utils/        # Logger and utilities
β”Š
β”œβ”€β”€ πŸ€– ai-models/             # Python ML/AI Pipeline
β”‚   β”œβ”€β”€ πŸ“Š models/          # Trained ML models (.pkl files)
β”‚   β”œβ”€β”€ πŸ”¬ training/        # Model training scripts
β”‚   β”œβ”€β”€ πŸ” evaluation/      # Model performance metrics
β”‚   └── πŸ“ preprocessing/   # Data cleaning and feature engineering
β”Š
β”œβ”€β”€ πŸ“¦ data-pipeline/         # Government Data Integration
β”‚   β”œβ”€β”€ πŸ“Š collectors/      # API data fetching modules
β”‚   β”œβ”€β”€ 🧹 cleaners/         # Data validation and cleaning
β”‚   β”œβ”€β”€ πŸ”„ schedulers/       # Automated data sync jobs
β”‚   └── πŸ“Š transformers/    # Data format standardization
β”Š
β”œβ”€β”€ πŸ—„οΈ database/             # Database Schema & Migrations
β”‚   β”œβ”€β”€ πŸ—οΈ migrations/       # Database version control
β”‚   β”œβ”€β”€ 🌱 seeds/            # Sample data for development
β”‚   └── πŸ“„ schema.sql        # PostgreSQL + PostGIS schema
β”Š
β”œβ”€β”€ 🐳 docker-compose.yml    # Multi-container orchestration
β”œβ”€β”€ πŸ“š docs/                 # Comprehensive documentation
β”œβ”€β”€ πŸ› οΈ .github/workflows/    # CI/CD automation
└── πŸ“ README.md             # This beautiful documentation!

πŸš€ Quick Start Guide

⚑ Lightning Fast Setup

1️⃣ Clone & Navigate

git clone https://github.com/Kuldeep2822k/aqua-ai.git
cd aqua-ai

2️⃣ Install Dependencies

# Install all dependencies at once
npm install
cd frontend && npm install && cd ..
cd backend && npm install && cd ..
pip install -r requirements.txt

2.5️⃣ Configure Environment

# Copy environment template
cp .env.example .env.development

# Edit .env.development with your settings:
# - Database connection (PostgreSQL)
# - JWT secret key
# - API keys (optional)

2.6️⃣ Setup Database

# Run database migrations
npm run db:migrate

# (Optional) Seed sample data
npm run db:seed

3️⃣ Launch Application

# Start entire stack with one command
npm run dev

4️⃣ Access Your Dashboard

🐳 Docker One-Click Deploy

# Complete stack deployment with Docker
docker-compose up -d

# πŸŽ‰ That's it! Your Aqua-AI platform is live!

πŸ“š Documentation Links

Setup Guide API Documentation Deployment Guide


🎯 Live Demo & Features

🌐 Experience India's Water Quality Intelligence

πŸ—ΊοΈ Interactive Map Dashboard



β€’ Pan & zoom across India
β€’ Click markers for detailed data
β€’ Filter by parameters & risk levels
β€’ Color-coded safety assessment


β€’ Live WQI scores
β€’ Safety threshold indicators
β€’ Historical trend analysis
β€’ Government data attribution


β€’ ML-powered forecasting
β€’ Pollution event prediction
β€’ Confidence score metrics
β€’ Hotspot identification


β€’ Threshold violation detection
β€’ Risk escalation notifications
β€’ Public health advisories
β€’ Email/SMS capabilities

🌈 Risk Level Color Coding


πŸ—οΈ System Architecture

graph TB
    subgraph "Frontend Layer"
        A[React + TypeScript]
        B[Leaflet Maps]
        C[Real-time Dashboard]
    end

    subgraph "API Gateway"
        D[Node.js + Express]
        E[Authentication]
        F[Rate Limiting]
    end

    subgraph "Data Layer"
        G[PostgreSQL + PostGIS]
        H[Redis Cache]
        I[Government APIs]
    end

    subgraph "AI/ML Pipeline"
        J[Python ML Models]
        K[TensorFlow]
        L[Prediction Engine]
    end

    A --> D
    B --> D
    C --> D
    D --> G
    D --> H
    D --> I
    G --> J
    J --> K
    K --> L
    L --> D
Loading

Architecture Diagrams

System Architecture

flowchart TB
  subgraph Frontend[Frontend Layer]
    FE1[React + TypeScript]
    FE2[Leaflet Maps]
    FE3[Real-time Dashboard]
  end

  subgraph API[API Gateway]
    API1[Node.js + Express]
    API2[Authentication]
    API3[Rate Limiting]
  end

  subgraph Data[Data Layer]
    DB1[PostgreSQL + PostGIS]
    DB2[SQLite Dev Storage]
    DB3[Government APIs]
    DB4[Redis Cache]
  end

  subgraph ML[AI/ML Pipeline]
    ML1[Python ML Models]
    ML2[Feature Engineering]
    ML3[Prediction Engine]
  end

  subgraph ETL[ETL + Data Pipeline]
    ETL1[Python ETL]
    ETL2[Validation + Cleaning]
    ETL3[Scheduler]
  end

  subgraph Obs[Observability + Alerts]
    O1[Winston Logs]
    O2[Sentry Errors]
    O3[Performance Monitoring]
    O4[Alerting]
  end

  FE1 --> API1
  FE2 --> API1
  FE3 --> API1
  API1 --> API2
  API1 --> API3
  API1 --> DB1
  API1 --> DB2
  API1 --> DB4
  DB4 --> API1
  DB3 --> ETL1 --> ETL2 --> DB1
  ETL2 --> DB2
  ETL3 --> ETL1
  DB1 --> ML1
  DB2 --> ML1
  ML1 --> ML2 --> ML3 --> DB1
  API1 --> O1
  API1 --> O2
  API1 --> O3
  ML3 --> O4
  DB1 --> O4
Loading

Data Flow Architecture

flowchart LR
  subgraph Sources[Data Sources]
    S1[CPCB APIs]
    S2[Jal Shakti Data]
    S3[Open Government Data]
    S4[Community Reports]
  end

  subgraph Ingestion[ETL + Data Pipeline]
    P1[Fetch + Normalize]
    P2[Validation + Cleaning]
    P3[Enrichment + Geocoding]
    P4[Scheduler]
  end

  subgraph Storage[Storage]
    T1[PostgreSQL + PostGIS]
    T2[SQLite Dev DB]
    T3[Redis Cache]
  end

  subgraph Analytics[Analytics + AI]
    A1[Feature Store]
    A2[Model Training]
    A3[Risk Predictions]
  end

  subgraph Alerting[Alerts]
    AL1[Threshold Engine]
    AL2[Alert Store]
    AL3[Notification Service]
  end

  subgraph Delivery[Delivery]
    D1[REST API]
    D2[Realtime Dashboard]
    D3[Map Visualization]
  end

  Sources --> P1 --> P2 --> P3 --> Storage
  P4 --> P1
  T1 --> A1 --> A2 --> A3 --> T1
  T2 --> A1
  T1 --> AL1 --> AL2 --> D1
  D1 --> AL3
  T1 --> D1 --> D2
  T1 --> D3
  D1 --> T3
  T3 --> D1
Loading

Security Architecture

flowchart TB
  subgraph Clients[Clients]
    C1[Browser App]
    C2[Admin Console]
  end

  subgraph Edge[Ingress Controls]
    E1[HTTPS + TLS]
    E2[CORS Policy]
    E3[Rate Limiting]
  end

  subgraph Auth[Auth + Access]
    A1[JWT Auth]
    A2[RBAC Roles]
    A3[Session Controls]
  end

  subgraph App[Application Security]
    S1[Input Validation]
    S2[Sanitization]
    S3[Security Headers]
    S4[HPP + XSS Protection]
  end

  subgraph DataSec[Data Security]
    D1[Least Privilege DB User]
    D2[Audit Logs]
    D3[Encrypted Secrets]
    D4[Monitoring + Logs]
    D5[Backup + Recovery]
  end

  Clients --> Edge --> Auth --> App --> DataSec
Loading

Deployment Architecture

flowchart TB
  subgraph Dev[Developer Workstations]
    D1[Frontend]
    D2[Backend]
    D3[Data Pipeline]
  end

  subgraph CI[CI/CD]
    C1[GitHub Actions]
    C2[Build + Test]
    C3[Deploy]
  end

  subgraph Hosting[Hosting]
    H1[Render Frontend]
    H2[Render Backend]
  end

  subgraph DataInfra[Data Infrastructure]
    I1[Supabase Postgres + PostGIS]
    I2[Scheduled Pipeline]
  end

  D1 --> C1
  D2 --> C1
  D3 --> C1
  C1 --> C2 --> C3
  C3 --> H1
  C3 --> H2
  H2 --> I1
  I2 --> I1
Loading

CI/CD Pipeline

flowchart LR
  P1[Push or PR] --> P2[Lint]
  P2 --> P3[Unit Tests]
  P3 --> P4[Build Frontend]
  P4 --> P5[Build Backend]
  P5 --> P6[Deploy to Render]
  P6 --> P7[Schedule Data Pipeline]
Loading

Database ER Diagram

erDiagram
  USERS {
    uuid id PK
    string email
    string password_hash
    string role
    timestamp created_at
  }

  LOCATIONS {
    uuid id PK
    string name
    string state
    point geom
  }

  WATER_QUALITY_PARAMETERS {
    uuid id PK
    string name
    string unit
    float safe_threshold
  }

  WATER_QUALITY_READINGS {
    uuid id PK
    uuid location_id FK
    uuid parameter_id FK
    float value
    timestamp recorded_at
  }

  AI_PREDICTIONS {
    uuid id PK
    uuid location_id FK
    string risk_level
    float confidence
    timestamp predicted_at
  }

  ALERTS {
    uuid id PK
    uuid location_id FK
    string alert_status
    timestamp created_at
  }

  LOCATIONS ||--o{ WATER_QUALITY_READINGS : has
  WATER_QUALITY_PARAMETERS ||--o{ WATER_QUALITY_READINGS : defines
  LOCATIONS ||--o{ AI_PREDICTIONS : generates
  LOCATIONS ||--o{ ALERTS : triggers
Loading

Runtime Sequence Diagram

sequenceDiagram
  participant User
  participant UI as Frontend UI
  participant API as API Gateway
  participant Auth as Auth Middleware
  participant Valid as Validation
  participant DB as Postgres + PostGIS
  participant Cache as Redis Cache
  participant ML as Prediction Engine
  participant Alerts as Alerting
  participant Obs as Monitoring

  User->>UI: Open dashboard
  UI->>API: GET /api/locations
  API->>Auth: Verify JWT
  Auth-->>API: OK
  API->>Valid: Validate request
  Valid-->>API: OK
  API->>Cache: Read cached locations
  alt Cache hit
    Cache-->>API: Locations
  else Cache miss
    API->>DB: Query locations
    DB-->>API: Locations
    API->>Cache: Store locations
  end
  API->>Obs: Log request metrics
  API-->>UI: Locations response

  UI->>API: GET /api/predictions/risk-map
  API->>Auth: Verify JWT
  Auth-->>API: OK
  API->>DB: Fetch latest readings
  API->>ML: Request predictions
  ML-->>API: Risk scores
  API->>Alerts: Evaluate thresholds
  Alerts-->>API: Active alerts
  API->>Obs: Log prediction latency
  API-->>UI: Risk map payload
  UI-->>User: Render map + alerts
Loading

Data Governance Architecture

flowchart LR
  subgraph Governance[Governance + Quality]
    G1[Data Catalog]
    G2[Lineage Tracker]
    G3[Quality Scoring]
    G4[Retention Policies]
    G5[PII Classification]
  end

  subgraph Sources[Data Sources]
    S1[Government APIs]
    S2[Community Inputs]
  end

  subgraph Pipeline[ETL + Storage]
    P1[Ingestion]
    P2[Validation]
    P3[Postgres + PostGIS]
    P4[Archive Storage]
  end

  Sources --> P1 --> P2 --> P3
  P1 --> G2
  P2 --> G3
  P3 --> G1
  P3 --> G4 --> P4
  P1 --> G5
Loading

Security Depth Architecture

flowchart TB
  subgraph Edge[Edge Protection]
    E1[WAF]
    E2[DDoS Mitigation]
    E3[TLS Termination]
  end

  subgraph Secrets[Secrets + Keys]
    S1[Secrets Manager]
    S2[KMS]
    S3[Key Rotation]
  end

  subgraph App[Application]
    A1[API Gateway]
    A2[Auth Service]
    A3[Rate Limiting]
  end

  Edge --> App
  Secrets --> App
  S2 --> S3
Loading

Operational Resilience Architecture

flowchart TB
  subgraph Primary[Primary Region]
    P1[Frontend]
    P2[Backend]
    P3[Primary DB]
  end

  subgraph Secondary[Secondary Region]
    S1[Standby Backend]
    S2[Read Replica]
    S3[Static Failover Site]
  end

  subgraph Recovery[Recovery]
    R1[Backups + Snapshots]
    R2[Restore Playbooks]
    R3[Failover Runbook]
  end

  P2 --> P3
  P3 --> S2
  S2 --> S1
  P1 --> S3
  P3 --> R1 --> R2
  R2 --> R3
  R3 --> S1
Loading

User Journey Diagram

flowchart LR
  U1[User] --> U2[Open Dashboard]
  U2 --> U3[Authenticate]
  U3 --> U4[View Map]
  U4 --> U5[Select Location]
  U5 --> U6[View Analytics]
  U6 --> U7[Receive Alerts]
  U7 --> U8[Download Report]
Loading

Threat Model Diagram

flowchart TB
  subgraph Threats[Attack Surface]
    T1[Injection]
    T2[XSS]
    T3[Credential Abuse]
    T4[Rate Abuse]
  end

  subgraph Controls[Controls]
    C1[Validation + Sanitization]
    C2[HPP + XSS Protection]
    C3[JWT + RBAC]
    C4[Rate Limiting + WAF]
  end

  subgraph Outcomes[Outcomes]
    O1[Rejected Requests]
    O2[Blocked Actors]
    O3[Audit Trail]
  end

  Threats --> Controls --> Outcomes
Loading

🐍 Detailed Architecture Flow

Layer Technology Purpose Scalability
🌐 Frontend React + TypeScript Interactive UI/UX CDN Distribution
βš™οΈ Backend Node.js + Express API Services Load Balancing
πŸ—„οΈ Database PostgreSQL + PostGIS Spatial Data Read Replicas
πŸ€– AI/ML Python + TensorFlow Predictions Model Serving
πŸ“Š Cache Redis Performance Clustering

πŸ† Hackathon Impact & Innovation

🌍 Addressing India's Most Critical Environmental Challenge

πŸ“Š Problem Scope

  • 🌊 600M+ People affected by water pollution
  • πŸ₯ 70% of Surface Water contaminated
  • πŸ’° β‚Ή3 Trillion economic impact annually
  • ⚠️ 2M Deaths/year from water-related diseases

πŸš€ Our Solution Impact

  • πŸ€– AI-Powered early warning system
  • πŸ›οΈ Government Data integration
  • πŸ“Š Real-time public access to water data
  • πŸ“ˆ Predictive Analytics for policy makers

πŸŽ† Innovation Highlights


πŸ’° Business Model & Monetization

πŸ’Ή Revenue Potential: $9.5M+ by Year 3

Revenue Strategy



πŸ›οΈ **State & Municipal**
$200K - $500K per contract
28 states + major cities


🏭 **Industrial Compliance**
$5K - $50K monthly
1000+ facilities target


πŸ“Š **Data Access**
$99 - $2,499 monthly
Developers & researchers

🀝 Contributing & Community

Contributors Welcome Join Discord Follow Twitter

πŸ‘©β€πŸ’» How to Contribute

  1. 🍴 Fork the repository
  2. 🌱 Create your feature branch (git checkout -b feature/AmazingFeature)
  3. ✨ Commit your changes (git commit -m 'Add some AmazingFeature')
  4. πŸš€ Push to the branch (git push origin feature/AmazingFeature)
  5. πŸŽ‰ Open a Pull Request

πŸŽ† Built with ❀️ for India's Water Security

⭐ Star this repo if it helped you!

GitHub Stars GitHub Forks GitHub Watchers


Kuldeep Kumar β€’ 2024 β€’ MIT Licensed

About

🌊 AI-Powered Water Quality Monitoring Platform for India. Real-time insights, predictive analytics, and government data integration for environmental safety.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors