Differential Urban Hydrological Intelligence for Defensible Flood Attribution
π floodlens-app.vercel.app Β· β‘ Live Auth Gateway & Instant Demo Β· Β·
Β·
Β·
Β·
"Why did your street flood when the next ward didn't?"
Conventional flood maps show static water depths after disaster strikes, treating flooding as an inevitable natural consequence. FloodLens is a differential urban hydrological intelligence system that diagnoses the physical root cause of flooding. By pairing inundated catchments with resilient twin wards across elevation gradients, stormwater drain (SWD) conduits, and impervious surface fractions, FloodLens isolates structural drainage choke points from extreme cloudburst forcing.
| Environment / Route | Direct Production URL | Functional Description |
|---|---|---|
| Production Web App | https://floodlens-app.vercel.app | Complete Next.js 14 hydrological diagnosis platform (Main Branch) |
| Preview Deployment | https://frontend-ecs788bip-nikhillakra2007-9371s-projects.vercel.app | Isolated Vercel Preview for fix/technical-access-ui-ux |
| Authentication Gateway | https://floodlens-app.vercel.app/auth | Google OAuth, Indian Phone (+91) OTP, and Instant Demo Access |
| Feature Hub (Authenticated) | https://floodlens-app.vercel.app/hub | Role-tailored resident portal and engineering workspace catalog |
| Diagnostic Catchment Console | https://floodlens-app.vercel.app/investigations/new | Interactive catchment selection matrix & pipeline trigger (Verified Original Technical Destination) |
| Profile & Role Settings | https://floodlens-app.vercel.app/settings | Enforced read-only authorization role, Indian contact mobile validation, monitored ward, and notification settings |
| Differential Twin Simulator | https://floodlens-app.vercel.app/simulator | Calibrated comparative urban twin scenario workbench |
| Causal DAG & Flowchart | https://floodlens-app.vercel.app/flowchart | Interactive physical propagation network with real-time sliders |
| Subsurface Conduit Anatomy | https://floodlens-app.vercel.app/infrastructure | 3D subterranean cross-section & sediment obstruction viewer |
- Verified Technical Destination Restored: Traced Git history confirming the original "Run Ward Diagnosis" destination is
/investigations/new. The landing page CTA now cleanly routes to/auth, where Enter Technical Demo directly loads the original technical console with zero redirect loops. - Scroll-Aware Features Section Navigation: The Features section navigation bar on the landing page renders at the top in its resting state, hides smoothly on scroll-down (>8px hysteresis threshold), and reveals cleanly on scroll-up without covering page headers or layout jumps.
- Strict Role Separation (Citizen vs. Technical): Interactive cross-mode switching has been eliminated from settings, dropdown menus, and client requests. Role status is displayed as an informational read-only badge. Demo accounts are persona-locked; unauthorized route access redirects with context.
- Profile & Role Settings Lifecycle: Fully integrated
/settingsand/onboardingwith loading states, double-submission protection, Indian phone (+91) regex validation, monitored Chennai catchment selection, and honest local/remote persistence feedback. - Polished 5-Stage Hydrological Vector Diagram: Replaced rough left-side auth visuals with a peer-review-grade SVG illustrating: 1. Rainfall Forcing (390mm Michaung) β 2. Catchment Runoff (Q=CIA) β 3. Drainage Network (SWD Culvert) β 4. Hydraulic Bottleneck (+1.03m dy/dx Backwater) β 5. Flood Risk Output (Ponding) with an integrated scientific legend.
- Zero Horizontal Overflow at 100% Zoom: Refined flexbox child constraints (
min-w-0 flex-1, text wrapping, responsive tabsmin-w-[115px] sm:min-w-0, overflow-safe user menusmax-w-[calc(100vw-2rem)]) across 320px, 360px, 390px, 430px, 768px, 1024px, 1280px, and 1440px viewports. - Map Overlap & Elevation Fixes: Dedicated telemetry status bars beneath satellite cards, responsive bounding on hero badges (
max-w-[85%]), and responsive mobile-collapsed map legend to prevent marker or control collisions.
- Public Landing Page (
/): Clean, public-facing interface with prominent Sign In action directing visitors to/authwithout exposing personal credentials, user names, or avatars. - Authentication Gateway (
/auth): Compact scientific entry gateway with a custom hydrological visual and zero blocking provider warnings for demo access. - Technical Access / Instant Demo: One click on Enter Technical Demo logs in as Dr. K. Senthil Nathan (Technical Mode) and routes directly into the original technical website: the Diagnostic Catchment Console (
/investigations/new), triggering the 5-stage causal inference pipeline and the 5-Tab Investigation Lab. - Citizen Demo: Resident observer persona (Priya Ramanathan) routing to the localized community risk portal.
FloodLens serves two critical stakeholders with tailored interfaces while maintaining a single, unified analytical truth:
flowchart TD
User["Authenticated User Session"] --> ModeSwitch{"Experience Mode"}
ModeSwitch -->|"Citizen Mode (Residents & Public)"| Cit["Citizen Experience\nβ’ Plain-Language Diagnosis\nβ’ Ward Status & Risk Advisory\nβ’ Household Safety Precautions\nβ’ GCC Emergency Helpline (1913)\nβ’ Non-Intimidating Community Map"]
ModeSwitch -->|"Technical Mode (Engineers & Planners)"| Tech["Technical Engineering Workspace\nβ’ Full Hydro-Mechanics Formulary\nβ’ Manning Surcharge Calculations\nβ’ Rational Peak Runoff (Q = CIA)\nβ’ Gradually Varied Flow (GVF dy/dx)\nβ’ 5-Tab Comprehensive Investigation Lab\nβ’ Bounded Counterfactual Simulator"]
Cit -.->|"Strict Role Separation Enforced (Cross-Mode Switching Disabled)"| Tech
Engineered for municipal civil engineers, disaster response coordinators, urban planners, and hackathon evaluators who require defensible physical evidence:
-
Mathematical Formulary Strip: Exposes exact hydrodynamic calculations (
$Q_{peak} = C \cdot I \cdot A$ , Manning's gravity capacity, backwater differential grade line). -
5-Tab Comprehensive Investigation Lab:
- Simulation Lab: Bounded counterfactual parameter sliders (desilting percentage, conduit diameter enlargement, impervious reduction).
- Causal DAG & Ranking: Directed acyclic graph isolating causal weights from meteorological noise.
- Geospatial Basemap: Monitored catchment polygons, inundation hotspots, and SWD grid layers.
-
Evidence Registry: Diagrammatic audit trail categorizing
FACT(sensor/DEM observations),SUPPORTED(calibrated models), andCAUSAL HYPOTHESIS(counterfactual derivations). - Defensibility Audit: Historical validation against prior Chennai cyclonic events (2015, 2021, 2023) and regulatory gate checks.
Engineered for Chennai residents, ward council members, and community observers who need immediate clarity without intimidating equations:
- Plain-Language Causality: Clear explanations of why water accumulated (e.g. "Stormwater backed up from downstream canals into the local bowl-like elevation depression; neighbor ward stayed dry due to steeper natural slope").
- Localized Ward Risk Status: Specific to their ward (Velachery Ward 178, Anna Nagar Ward 102, T. Nagar Ward 104, Adyar Ward 103).
- Immediate Resident Actions: Actionable guidelines (elevate ground-floor appliances >30cm, avoid low-lying canal underpasses, park on designated elevated ramps).
- Verified Civil Emergency Helplines: GCC Disaster Management
1913, TNEB Power Outage & Emergency94987 94987, Police/Disaster112. - On-Demand Engineering Unlock: A single button allows residents to view underlying equations and technical simulations whenever desired.
The platform underwent a comprehensive redesign to eliminate generic SaaS aesthetics and deliver a peer-review-grade geospatial intelligence workspace:
- Restrained Technical Typography: Inter font pairing for razor-sharp headings and narrative readability; JetBrains Mono for coordinates, hydraulic parameters, and numerical telemetry.
- Elimination of Map Overlap Defects: Moved floating telemetry chips into dedicated, responsive status rows beneath map/satellite visual cards, preventing content collisions across all screen widths.
- Analytical Surface Treatments: Introduced directional elevation shadows (
0 4px 20px -2px rgba(45,35,26,0.06)), distinct failure vs. resilience indicator rails, and tinted data modules. - Mobile Responsiveness (320px β 1440px+):
- Zero unintended document horizontal scrolling.
- Contained horizontal panning for wide technical diagrams (
min-w-[1200px]). - Accessible navigation slide drawer with body scroll locking and backdrop blur.
- Mobile-optimized inputs (
text-base sm:text-sm) preventing iOS auto-zoom on focus.
- Live Deployments & Key Application Routes
- Dual Experience Architecture: Technical Mode vs. Citizen Mode
- UI/UX Redesign & Responsive Architecture
- Visual Platform Tour
- How It Works: The Twin Catchment Thesis
- System Architecture
- AWS Cloud Infrastructure & Services
- Hydrological Science & Causal Inference
- Repository Organization
- Test Suite & Verification
- Local Development Quickstart
- Automated Cloud Deployment
- Environment Configuration
- License & Scientific Data Sources
An editorial diagnostic interface pairing adjacent urban basins across Greater Chennai Corporation (GCC) to isolate structural drainage choke points from extreme cloudburst forcing.
Interactive 3D cross-section demonstrating the subterranean mechanism: identical precipitation causes Block A to flood via conduit silt buildup and catch basin backwater, while Block B discharges smoothly through unobstructed invert slope.
Interactive Directed Acyclic Graph (DAG) with real-time hydraulic parameter controls (Rainfall depth, Conduit silt %, Pipe invert slope, Canal tide stage MSL, and Impervious cover) computing runoff intake, discharge capacity, and backwater head in real time.
Complete physical propagation chain from meteorological precipitation forcing to street inundation. Clean hierarchical topology with unclustered node pills, directed momentum vectors, and strict evidence confidence tags (FACT Β· SUPPORTED Β· CAUSAL HYPOTHESIS).
To prove whether street flooding was caused by severe weather or infrastructural failure, FloodLens matches each flooded ward against an unflooded control ward with equivalent meteorological forcing:
flowchart LR
A["βοΈ Extreme Rainfall Event\n(e.g., Cyclone Michaung 420mm)"] --> B["Ward A (Flooded Catchment)\n84% Impervious Β· 55% Silt Choke"]
A --> C["Ward B (Resilient Twin Control)\n65% Impervious Β· Functional Outfall"]
B --> D["Underground Conduit Surcharge\nBackwater Pressure (+1.03m Head)"]
C --> E["Unobstructed Gravity Outfall\nSmooth Canal Discharge (1.5% Slope)"]
D --> F["π₯ Local Inundation (75cm)\nAttribution: Infrastructure Failure"]
E --> G["β
Dry Streets (0cm)\nProof: Rain Alone Was Not The Cause"]
When two adjacent catchments receive the exact same 400mm+ precipitation pulse during a cyclonic event, yet one experiences severe standing inundation while the other stays dry, meteorology cannot be the primary explanatory variable. FloodLens quantifies the exact physical discrepancy across:
- Slope & Topography: Elevation delta and natural basin fall.
- Hydraulic Conduit Capacity: Manning's flow capacity minus silt and debris accumulation.
- Surface Imperviousness: Runoff coefficient scaling due to urbanization.
- Tailwater Choke Points: High-tide canal backwater and blocked outfalls.
FloodLens combines multi-source geospatial GIS ingestion, deterministic hydrological modeling, and a cloud-native serverless architecture:
flowchart TD
subgraph Ingestion["1. Multi-Source Ingestion & Spatial Indices"]
I1["IMD Radar & Rain Gauge Network"]
I2["GCC Stormwater Conduits & Outfalls"]
I3["Copernicus DEM GLO-30 Elevation Grid"]
I4["ESA WorldCover 10m Impervious Class"]
end
subgraph AWS_Cloud["2. AWS Cloud Infrastructure"]
S1["Amazon S3\n(GeoTIFFs, Manifests, Datasets)"]
S2["Amazon ECR\n(FastAPI Docker Container)"]
S3["AWS Lambda + Web Adapter (LWA)\n(2048MB Serverless Microservice)"]
S4["AWS Lambda Function URL\n(Public HTTPS, Low Latency, CORS)"]
S5["Amazon Bedrock\n(Claude 3.5 Sonnet Causal Synthesis)"]
S6["Amazon CloudWatch\n(Execution Logs & Telemetry)"]
end
subgraph Engine["3. Hydrological Inference & Audit Core"]
E1["Twin Catchment Selection Engine"]
E2["Manning & Rational Hydraulic Calculator"]
E3["Gradually Varied Flow Backwater Model"]
E4["Defensibility Gate Check (FACT Β· SUPPORTED Β· HYPOTHESIS)"]
end
subgraph Frontend["4. Presentation Layer (Next.js 14)"]
F1["Interactive GCC Basemap & Geospatial Hotspots"]
F2["Subterranean Infrastructure 3D Cross-Section"]
F3["Real-Time Hydraulic Parameter Simulator"]
F4["High-Definition Causal DAG Visualizer"]
end
I1 & I2 & I3 & I4 --> S1
S1 --> S3
S2 --> S3
S3 <--> S5
S3 --> S6
S3 --> S4
S4 --> F1 & F2 & F3 & F4
S3 --> E1 --> E2 --> E3 --> E4
FloodLens is engineered with an enterprise-grade, cost-effective, and highly scalable AWS serverless architecture. Every component adheres to the AWS Well-Architected Framework, emphasizing security, operational excellence, and scientific reproducibility.
| AWS Service | Architectural Role | Technical Specifications & Sizing |
|---|---|---|
| Amazon Bedrock | GenAI Hydrological Reasoning & Defensibility Audit | Anthropic Claude 3.5 Sonnet (apac.anthropic.claude-3-5-sonnet-20241022-v2:0) via bedrock-runtime Converse API |
| AWS Lambda | Serverless Container Compute Engine | Python 3.12 container via AWS Lambda Web Adapter (LWA), 2048 MB RAM, 120s timeout |
| AWS Lambda Function URL | High-Performance Public HTTPS Gateway | Direct invocation endpoint with native CORS; eliminates API Gateway latency and surcharge |
| Amazon S3 | Scientific Data Lake & Manifest Store | Private encrypted bucket (AES256), bucket versioning, public access blocked, deterministic SHA-256 integrity metadata |
| Amazon ECR | Container Image Registry | Private image repository (floodlens-backend) with image scanning enabled (scanOnPush=true) |
| AWS IAM | Principle of Least Privilege Access Control | Execution role scoped strictly to S3 read/write, Bedrock Converse invocation, and CloudWatch basic logging |
| Amazon CloudWatch | Observability, Audit Logs & Metrics | Centralized structured JSON logging, execution performance tracking, and error telemetry |
| Amazon RDS (Optional) | Spatial PostGIS Engine | PostgreSQL 16 + PostGIS 3.4 for spatial indexing and topological vector queries |
| AWS CloudFormation | Infrastructure as Code (IaC) | Declarative single-command infrastructure template (infra/floodlens-stack.yaml) |
- Role: Powers the causal investigation agent that translates mathematical hydraulic outputs into courtroom-grade attribution reports.
- Model: Anthropic Claude 3.5 Sonnet (
apac.anthropic.claude-3-5-sonnet-20241022-v2:0inap-south-1Mumbai / APAC inference profile). - Execution: The agent invokes Bedrock through the Converse API (
boto3.client('bedrock-runtime')). - Defensibility Guardrails: Bedrock outputs are strictly audited by the application's sanitization pipeline:
- Validates output structure against strict schema constraints (
validate_agent_output). - Flags unsupported assertions into an explicit
unknownsregister. - Enforces three-tier evidentiary taxonomy:
FACT(measured gauge/survey data),SUPPORTED(calibrated hydrological models), andCAUSAL HYPOTHESIS(counterfactual assertions).
- Validates output structure against strict schema constraints (
- Role: Runs the containerized FastAPI backend without managing EC2 instances, ECS clusters, or load balancers.
- Integration: Leverages the official AWS Lambda Web Adapter (
public.ecr.aws/awsguru/aws-lambda-adapter:0.8.4), enabling unmodified ASGI FastAPI apps to run directly on Lambda. - Performance: Provisioned with 2048 MB memory, allocating sufficient CPU power for real-time spatial calculations and rapid sub-second warm response times.
- Role: Provides direct public HTTPS endpoints to the backend API (
https://<url-id>.lambda-url.<region>.on.aws/). - Benefits:
- Eliminates the cost, operational complexity, and 29-second payload timeouts of AWS API Gateway.
- Native CORS headers preconfigured in CloudFormation to allow seamless communication with Vercel and AWS Amplify frontends.
- Role: Houses spatial layers, digital elevation models, drainage networks, and historical flood incident logs.
- Folder Structure:
raw/: Untouched IMD rainfall logs, Copernicus DEM GLO-30 GeoTIFFs, and GCC SWD shapefiles.processed/: Standardized GeoJSON layers, normalized elevation grids, and topology graphs.manifests/: Phase 2 & 3 catchment pairing manifests and event benchmarks.derived/: Precomputed Manning discharge capacities and backwater depth profiles.
- Integrity: Every file uploaded via scripts/sync_s3.py includes a computed SHA-256 hash in its S3 Object Metadata for scientific verification.
The Lambda execution role (infra/floodlens-stack.yaml) strictly limits permissions to:
s3:GetObject,s3:PutObject,s3:ListBucketscoped exclusively to the project's data bucket.bedrock:InvokeModel,bedrock:InvokeModelWithResponseStream,bedrock:Converse.- Standard AWS Lambda basic execution logging (
logs:CreateLogGroup,logs:CreateLogStream,logs:PutLogEvents).
FloodLens is built with a seamless dual-backend runtime architecture. Developers and auditors can run the entire system 100% offline or fully connected to AWS:
| Operating Mode | Environment Variable | Storage Layer | LLM Causal Agent | Use Case |
|---|---|---|---|---|
| Local / Offline | AGENT_MODE=local |
Local directory (data/) |
Deterministic Rule-Based Causal Engine | Local dev, unit testing, offline demos, zero AWS costs |
| AWS Cloud (Production) | AGENT_MODE=bedrock |
Amazon S3 Bucket | Amazon Bedrock (Claude 3.5 Sonnet) | Production deployment, scalable public API, automated audits |
Switching modes requires only toggling AGENT_MODE in .env β zero code changes required.
FloodLens includes battle-tested, zero-friction deployment scripts for both Windows PowerShell and Linux/macOS bash:
flowchart LR
Step1["1. Verify IAM & AWS CLI\n(aws sts get-caller-identity)"] --> Step2["2. Ensure Amazon ECR Repo\n(floodlens-backend)"]
Step2 --> Step3["3. Docker Build & Push\n(FastAPI + Lambda Adapter)"]
Step3 --> Step4["4. Deploy CloudFormation\n(infra/floodlens-stack.yaml)"]
Step4 --> Step5["5. Sync Datasets to S3\n(scripts/sync_s3.py + SHA-256)"]
Step5 --> Step6["π Live HTTPS API\n(Lambda Function URL)"]
-
Linux / macOS:
# Pre-flight check without creating resources: ./deploy.sh ap-south-1 floodlens-production --dry-run # Full automated deployment: ./deploy.sh ap-south-1 floodlens-production
-
Windows PowerShell:
# Pre-flight check without creating resources: .\deploy.ps1 -Region ap-south-1 -StackName floodlens-production -DryRun # Full automated deployment: .\deploy.ps1 -Region ap-south-1 -StackName floodlens-production
FloodLens grounds all attribution in classical fluid dynamics and physical hydrology:
-
$C$ : Weighted runoff coefficient calculated from ESA WorldCover impervious fractions (paved roads:$0.85-0.90$ , bare earth/parks:$0.20-0.35$ ). -
$I$ : Rainfall intensity derived from IMD radar / rain-gauge timeseries ($mm/hr$ ). -
$A$ : Catchment contributing area ($m^2$ ).
-
$n$ : Roughness coefficient ($n = 0.015$ clean concrete,$n = 0.035$ heavily silted). -
$R_h$ : Hydraulic radius ($A / P$ ). -
$S_0$ : Conduit invert bed slope.
When tailwater elevation at canal outfalls exceeds the pipe crown, or siltation exceeds
FloodLens/
βββ backend/ # Python 3.12 FastAPI Serverless Backend
β βββ alembic/ # Database schema migrations
β βββ app/
β β βββ agent/ # Bedrock & local causal reasoning agents
β β β βββ core/ # Bedrock Converse API invocation & fallback
β β β βββ guardrails/ # Defensibility validation & output sanitization
β β β βββ prompts/ # Hydraulic audit system prompts
β β βββ api/v1/ # REST endpoints (health, twins, simulation, audit)
β β βββ core/ # Pydantic v2 application settings & configs
β β βββ models/ # SQLAlchemy & GeoAlchemy2 spatial ORM models
β β βββ schemas/ # Strict Pydantic input/output schemas
β β βββ services/
β β βββ aws/ # Amazon S3 & storage abstraction service
β β βββ geospatial/ # Rational method, Manning equation & backwater
β βββ tests/ # 97 Pytest test suites (unit, integration, contract, adversarial)
β βββ Dockerfile # Multi-stage image with AWS Lambda Web Adapter
β βββ requirements.txt # Python dependencies (FastAPI, boto3, GeoAlchemy2, Shapely)
β
βββ frontend/ # Next.js 14 App Router Presentation Layer
β βββ app/ # Routes (Landing hero, investigation, counterfactuals)
β βββ components/ # Modular React & Tailwind components
β β βββ investigation/ # Catchment comparison panels, 3D cross-section
β β βββ ui/ # Reusable visual primitives & SVG DAG nodes
β βββ lib/ # API clients, types, and hydraulic math helpers
β βββ tests/ # 71 Vitest frontend component & logic tests
β
βββ infra/ # Infrastructure as Code
β βββ floodlens-stack.yaml # AWS CloudFormation template (Lambda, S3, IAM, URL)
β
βββ scripts/ # DevOps, Ingestion & Automation Utilities
β βββ sync_s3.py # S3 dataset synchronization with SHA-256 verification
β βββ ingest_chennai.py # Chennai geospatial and SWD pipeline ingestion
β βββ seed_demo.py # Deterministic seed data for local and staging
β βββ validate_data.py # Scientific integrity check for GeoJSON & DEMs
β
βββ data/ # Scientific Datasets & Manifests (Local Fallback)
β βββ raw/ # Raw IMD rainfall logs, Copernicus DEMs, GCC SWD
β βββ processed/ # GeoJSON catchments and normalized elevation grids
β βββ manifests/ # Twin catchment pair definitions and ground truth
β
βββ docs/ # Comprehensive Scientific & System Documentation
β βββ architecture/ # High-level architecture and data flows
β βββ deployment/ # AWS deployment instructions and cloud topologies
β βββ images/ # Platform screenshots and UI visual assets
β
βββ deploy.ps1 # Windows PowerShell one-command AWS deployment pipeline
βββ deploy.sh # Linux/macOS bash one-command AWS deployment pipeline
βββ docker-compose.yml # Local PostgreSQL 16 + PostGIS 3.4 development environment
βββ Makefile # Developer shortcuts (install, test, migrate, run)
βββ README.md # Project documentation and architectural guide
FloodLens maintains an uncompromising verification posture, covering numerical hydrology formulas, API contracts, adversarial edge cases, and accessibility:
- Backend (Pytest): 97 passed tests
- Physical unit tests: Topographic similarity matching, Manning pipe capacity under siltation, backwater head propagation.
- API & Contract tests: Schema compliance, pagination, and error handling.
- Adversarial guardrail tests: Prompt injection resistance, missing data fallback, ungrounded hypothesis mitigation.
- Frontend (Vitest): 106 passed tests across 21 test suites
- Complete authentication test coverage: Compact scientific gateway layout, instant 1-click Technical Demo access (
Dr. K. Senthil Nathan), Citizen Mode toggle (Priya Ramanathan), Google OAuth initialization, Indian Mobile (+91) OTP validation, PIN auto-advance, and contextual missing-provider fallback. - Component mechanics, accessible ARIA labels, parameter slider reactivity, counterfactual recalculation.
- Complete authentication test coverage: Compact scientific gateway layout, instant 1-click Technical Demo access (
- Type Safety: 100% strict TypeScript compilation with zero errors across all static and dynamic routes.
- Flake Rate: 0.00% across consecutive CI test executions.
Run the test suites locally:
# Backend tests
pytest backend/tests -v
# Frontend tests
cd frontend && npm run test:run- Node.js 18+ & npm
- Python 3.12+ (or 3.11+)
- Docker & Docker Compose (for local PostGIS database)
- AWS CLI v2 (optional, only needed for AWS sync or deployment)
git clone https://github.com/nikhillakra2007-tech/FloodLens.git
cd FloodLens
cp .env.example backend/.envdocker compose up -d dbcd backend
python -m venv .venv
# On Linux/macOS:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate
pip install -r requirements.txt
alembic upgrade head
python ../scripts/seed_demo.py
uvicorn app.main:app --host 127.0.0.1 --port 8000 --reloadAPI docs will be available at http://127.0.0.1:8000/docs.
In a new terminal window:
cd frontend
npm install
npm run devOpen http://localhost:3000 to view the application.
Deploy the entire FloodLens cloud infrastructure in a single command using your preferred shell:
chmod +x deploy.sh
./deploy.sh ap-south-1 floodlens-production.\deploy.ps1 -Region ap-south-1 -StackName floodlens-production- Validates AWS CLI credentials and active IAM identity.
- Creates or checks the Amazon ECR repository (
floodlens-backend). - Builds the production Docker image with the AWS Lambda Web Adapter.
- Pushes the container image to Amazon ECR.
- Deploys the CloudFormation stack (infra/floodlens-stack.yaml), provisioning the S3 Bucket, IAM Role, Lambda Function, and Function URL.
- Synchronizes raw datasets, manifests, and GeoJSON files to the private S3 bucket with computed SHA-256 integrity checksums.
- Outputs the public HTTPS backend API URL and health check endpoint.
| Variable | Description | Default / Example | Required in AWS? |
|---|---|---|---|
DATABASE_URL |
PostgreSQL + PostGIS connection string | postgresql+psycopg2://postgres:postgres@localhost:5432/floodlens |
Yes (RDS endpoint) |
AWS_REGION |
Target AWS deployment region | ap-south-1 |
Yes |
AWS_ACCESS_KEY_ID |
AWS access key (optional if using IAM role) | AKIA... |
Optional (IAM Role preferred) |
AWS_SECRET_ACCESS_KEY |
AWS secret key (optional if using IAM role) | wJalr... |
Optional (IAM Role preferred) |
BEDROCK_MODEL_ID |
Amazon Bedrock Foundation Model ID | apac.anthropic.claude-3-5-sonnet-20241022-v2:0 |
Yes (when AGENT_MODE=bedrock) |
S3_BUCKET |
S3 Data Lake bucket name | floodlens-data-chennai |
Yes |
CORS_ORIGINS |
Allowed origins for web client | https://floodlens-app.vercel.app,http://localhost:3000 |
Yes |
AGENT_MODE |
Hydrological causal agent mode | local (offline) or bedrock (cloud) |
No (defaults to local) |
LOG_LEVEL |
Python logging severity level | INFO |
No |
This project is licensed under the MIT License - see the LICENSE file for details.
- Rainfall & Radar Telemetry: India Meteorological Department (IMD) Chennai Doppler Weather Radar (DWR) & Automatic Weather Station (AWS) records.
- Digital Elevation Model (DEM): Copernicus DEM GLO-30 (30-meter European Space Agency elevation grid).
- Land Cover & Impervious Fractions: ESA WorldCover 10m Land Classification dataset.
- Stormwater Drain (SWD) Network: Greater Chennai Corporation (GCC) open stormwater asset registry.



