Skip to content

Utkarsh-Sinha0/Infraflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

InfraFlow: Cognitive Urban Architect

Transform 6 months of civil engineering into 6 minutes of AI-powered diagnosis

๐ŸŽฏ Overview

InfraFlow is a forensic infrastructure agent that moves urban planning from capacity-based expansion to efficiency-based geometric optimization. Instead of widening roadsโ€”which induces demandโ€”InfraFlow diagnoses congestion root causes and auto-generates Uninterrupted Flow Interchanges (UFI).

โœจ Features

  • ๐Ÿ” Forensic Discovery: 24-hour "Time-Machine" traffic probing with Google Routes API
  • ๐Ÿง  Cognitive Processing: Gemini Thinking Mode for intelligent design selection
  • ๐Ÿ—๏ธ Generative Design: Auto-generated DDI, Roundabout, and optimized signal geometries
  • ๐ŸŽฎ Digital Twin: SUMO micro-simulation for validation
  • ๐Ÿ“Š Impact Visualization: Before/after comparison with LOS, travel time, and COโ‚‚ metrics

๐Ÿš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • Node.js 18+ (for local development)
  • Python 3.11+ (for local development)

Using Docker (Recommended)

# Clone the repository
git clone https://github.com/your-org/infraflow.git
cd infraflow

# Copy environment template
cp backend/.env.example backend/.env
# Edit .env with your API keys

# Start all services
docker-compose up -d

# Access the application
# Frontend: http://localhost:3000
# API Docs: http://localhost:8000/docs

Local Development

# Backend
cd backend
python -m venv venv
venv\Scripts\activate  # Windows
pip install -r requirements.txt
uvicorn main:app --reload

# Frontend (new terminal)
cd frontend
npm install
npm run dev

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      FRONTEND (React + Deck.gl)             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ MapView  โ”‚  โ”‚Inspector โ”‚  โ”‚ Thinking โ”‚  โ”‚ Impact   โ”‚   โ”‚
โ”‚  โ”‚(Pin Drop)โ”‚  โ”‚ Panel    โ”‚  โ”‚ Trace    โ”‚  โ”‚ Slider   โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      BACKEND (FastAPI)                       โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”‚
โ”‚  โ”‚/v1/forensics โ”‚  โ”‚/v1/architect โ”‚  โ”‚/v1/simulationโ”‚      โ”‚
โ”‚  โ”‚ โ€ข probe      โ”‚  โ”‚ โ€ข generate   โ”‚  โ”‚ โ€ข run        โ”‚      โ”‚
โ”‚  โ”‚ โ€ข status     โ”‚  โ”‚ โ€ข design     โ”‚  โ”‚ โ€ข results    โ”‚      โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ–ผ                 โ–ผ                 โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ PostgreSQL   โ”‚  โ”‚    Redis     โ”‚  โ”‚    SUMO      โ”‚
    โ”‚ + PostGIS    โ”‚  โ”‚   (Cache)    โ”‚  โ”‚ (Simulation) โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ก API Endpoints

Method Endpoint Description
POST /v1/forensics/probe Initiate 24-hour traffic probe
GET /v1/forensics/probe/{id}/status Check probe status
GET /v1/forensics/probe/{id}/friction-curve Get friction analysis
POST /v1/architect/generate Generate AI-powered design
GET /v1/architect/design/{id} Get design result
GET /v1/architect/thinking-trace/{id} Get Gemini reasoning
POST /v1/simulation/run Run SUMO simulation
GET /v1/simulation/sumo-results/{id} Get simulation results

๐Ÿ”ง Configuration

Copy .env.example to .env and configure:

# Required
GOOGLE_MAPS_API_KEY=your_key_here
GEMINI_API_KEY=your_key_here

# Database
DATABASE_URL=postgresql+asyncpg://infraflow:infraflow@localhost:5432/infraflow

# Optional
SUMO_HOME=/path/to/sumo
DEBUG=true

๐Ÿ“Š Design Types

Design Conflict Points Best For
Roundabout 8 (vs 32) Arterial junctions, balanced flow
DDI 18 (vs 32) Heavy left turns, highway interchanges
Signal Optimized 24 (vs 32) Constrained spaces, moderate volumes

๐Ÿงช Testing

# Backend tests
cd backend
pytest tests/ -v

# Frontend tests
cd frontend
npm test

๐Ÿ“œ License

MIT License - see LICENSE for details.


Made with ๐Ÿง  by the InfraFlow Team

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors