Back to Projects
AI/ML & Geospatial

FloodGuard

FloodGuard is an AI-powered flood intelligence platform designed to proactively monitor and assess flood risks. Instead of just displaying raw weather data, it ingests meteorological information, automatically detects threshold breaches, correlates them into evolving 'flood events,' and assigns a severity score. It also features a conversational AI assistant that can answer disaster preparedness questions using official guidelines.

Project Scope

Data Ingestion: Collects live observed conditions and 5-day forecasts (via OpenWeather) across districts, alongside mock IMD data. Event Generation (Trigger & Correlation): Trigger Engine fires when rainfall hits official IMD thresholds. Correlation Engine intelligently groups these triggers within a 6-hour window into a single event. Severity Scoring: Calculates a blended risk score (75% rule-based, 25% ML model). Interactive AI Preparedness: Provides grounded, cited answers using NDMA and IMD documents. Real-Time Dashboard: Instantly updates via Server-Sent Events (SSE) as new data lands.

Technology Stack

PythonFastAPINext.jsHistGradientBoostingChromaDBGoogle GeminiSSE

Architecture

FastAPI acts as the backend Gateway processing real-time OpenWeather data. It pushes data to the Correlation and ML Scoring engines. A separate RAG pipeline manages document embeddings in ChromaDB to power the Gemini AI. The Next.js frontend is updated instantly via Server-Sent Events (SSE).

👤 User
Citizens / Authorities / Emergency Teams
⬇Interact (view map, alerts, ask questions)
⬆Responses (data, alerts, insights)
💻 Next.js Frontend
Dashboard • Map • Alerts • AI Assistant
⬇API requests
⬆JSON responses
⚙️ FastAPI Backend
REST API • Authentication • Orchestration
⬇
⬇
⬇
⬇
🛢️ Data Ingestion Service
  • Fetch data from IMD, CWC, Weather APIs, RSS
  • Normalize, validate, deduplicate
  • Store processed data
🔔 Event Engine
  • Read data from database
  • Apply rules & correlation
  • Detect flood-related events
  • Generate alerts / notifications
📊 ML Prediction Service
  • Read historical & live data
  • Train / use models (e.g., XGBoost)
  • Predict flood risk / water levels
  • Store predictions
📄 RAG Assistant
  • Retrieve relevant documents (RAG)
  • Combine with live FloodGuard data
  • Use Gemini for final response
  • Provide answers, recommendations
⬇ Store processed data
↕ Read data
(events, thresholds)
Write events/alerts
↕ Read historical
Write predictions
PostgreSQL
Events • Time-series data • Predictions
Users • Alerts • Application data
↕ Retrieve context
(similarity search)
↕ Prompt + context
Response
ChromaDB
Document embeddings
(Vector Store)
Gemini LLM
Generates final response using context + live data
External Data Sources (Live Feeds)
⬆ Fetch latest data
(scheduled)
☁️
IMD
(Weather)
🌊
CWC
(River Data)
🌤️
Weather APIs
(Forecast)
📰
RSS / News
(Alerts)
Document Knowledge Base (RAG Pipeline)
⬆ Store embeddings
📄
Govt Documents
(NDMA, SDMA, IMD, CWC)
➔
Document Processing
  • Unstructured
  • Tesseract (OCR)
  • Llama (image → text)
➔
Chunking + Embeddings
  • Hugging Face embeddings

Results & Validation

RAG Validation: Processed 8 official PDFs into 2,677 chunks. Overcame boilerplate vector search failures by implementing hybrid retrieval (vector + keyword) and near-duplicate filtering, guaranteeing strictly grounded answers. System: Verified end-to-end on a 60-second cycle.