Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌊 Cascade — AI Powered Disaster Command Platform

Real time disaster coordination powered by multi-agent AI. Built for hackathons, deployable in crisis.

Node.js React Socket.io License: MIT


🧠 What is Cascade?

Cascade is a real time disaster response command center. When an incident is reported (flood, bridge collapse, road blockage), a pipeline of AI agents automatically:

  1. Extracts the affected location from natural language text (ExtractionAgent)
  2. Recomputes ambulance routes around blocked roads (RouteAgent → OSRM)
  3. Assesses hospital capacity impact and deploys rescue teams (ImpactAgent)
  4. Broadcasts the updated world state to all connected dashboards via WebSocket

🗂 Project Structure

Cascade/
├── client/                  # Vite + React frontend
│   └── src/
│       ├── components/      # Map, panels, alerts, simulation controls
│       ├── hooks/           # useSocket, useWorldState
│       ├── pages/           # Dashboard, ReportPage
│       └── store/           # WorldContext (global state)
├── server/                  # Express + Socket.io backend
│   ├── agents/              # ExtractionAgent, RouteAgent, ImpactAgent
│   ├── routes/              # REST API (/api/report, /api/reset, /api/health)
│   └── state/               # WorldState singleton
├── start-osrm.sh            # OSRM Docker helper
└── package.json             # Root orchestrator (concurrently)

🗺 Real Routing with OSRM (Optional)

For real route computation instead of mock waypoints:

# 1. Download your city's OSM data (example: Maharashtra, India)
wget https://download.geofabrik.de/asia/india/maharashtra-latest.osm.pbf \
     -O server/osrm-data/region.osm.pbf

# 2. Pre-process (one-time)
docker run -t -v $(pwd)/server/osrm-data:/data osrm/osrm-backend \
  osrm-extract -p /opt/car.lua /data/region.osm.pbf
docker run -t -v $(pwd)/server/osrm-data:/data osrm/osrm-backend \
  osrm-partition /data/region.osrm
docker run -t -v $(pwd)/server/osrm-data:/data osrm/osrm-backend \
  osrm-customize /data/region.osrm

# 3. Run the routing server
./start-osrm.sh

Then update server/agents/RouteAgent.js to call http://localhost:5000 instead of the mock.


🔌 API Reference

POST /api/report

Submit a natural-language incident report.

// Request
{ "message": "Bridge 17 has collapsed and is blocked", "source": "citizen" }

// Response
{
  "success": true,
  "extracted": { "type": "ROAD_BLOCKED", "entityId": "bridge-17", "confidence": "high" },
  "changes": [
    { "action": "BLOCK_ROAD", "target": "bridge-17" },
    { "action": "REROUTE", "target": "amb-1" },
    { "action": "DEPLOY_TEAM", "target": "team-1" }
  ]
}

POST /api/reset

Reset the world state to the initial seed.

GET /api/health

Server health check.


⚙️ Configuration

File What to change
client/src/utils/constants.js MAP_CENTER — set to your demo city coordinates
server/state/WorldState.js Seed data — roads, hospitals, ambulances, teams
server/agents/ExtractionAgent.js Entity name → ID mappings for your locations
server/agents/RouteAgent.js Swap mock routes for real OSRM fetch

🤖 Agent Pipeline

Citizen Report (text)
        │
        ▼
 ExtractionAgent        → identifies entity ID + event type
        │
        ├──▶ RouteAgent      → recomputes ambulance waypoints (OSRM)
        │
        └──▶ ImpactAgent     → hospital load + rescue team dispatch
                │
                ▼
         WorldState.update()
                │
                ▼
        Socket.io broadcast → all dashboards update live

🛠 Tech Stack

Layer Technology
Frontend React 18, Vite, Tailwind CSS, React-Leaflet
Backend Node.js, Express, Socket.io
Routing OSRM (Open Source Routing Machine)
Maps OpenStreetMap + Leaflet
Fonts Inter, Space Grotesk (Google Fonts)

📄 License

MIT © 2024

Releases

Packages

Contributors

Languages