Skip to content

0xhaz/ReliefNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReliefNet

When disaster strikes, we connect.

ReliefNet is an AI-powered disaster relief coordination platform that uses 5 specialized AI agents on DigitalOcean Gradient AI to instantly match disaster victims with resources, automate fund disbursement, and eliminate NGO duplication — cutting humanitarian response time from weeks to hours.


The Problem

Every year, natural disasters affect 200+ million people worldwide. The humanitarian response is crippled by:

  • Intake bottleneck — Thousands of aid requests in multiple languages overwhelm manual triage (avg. 72 hours to process)
  • Coordination failure — NGOs duplicate efforts in accessible areas while remote villages receive nothing
  • Fund opacity — Donors can't verify where money goes; disbursement takes 3-6 weeks through traditional channels
  • Information silos — Field workers, coordinators, and governments operate on different (often outdated) data

The Solution

ReliefNet deploys a multi-agent AI system that operates across the full disaster response lifecycle:

Victim Request ──→ AI Triage ──→ NGO Matching ──→ Deployment ──→ Fund Verification
    (any language)    (18 sec)     (94% accuracy)    (real-time)    (blockchain)

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                        ReliefNet Platform                           │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│  ┌──────────┐   ┌──────────┐   ┌──────────┐   ┌─────────-─┐         │
│  │  Victim  │   │  Donor   │   │   NGO    │   │Coordinator│         │
│  │Dashboard │   │Dashboard │   │Dashboard │   │ Command   │         │
│  │          │   │          │   │          │   │  Center   │         │
│  └────┬─────┘   └────┬─────┘   └────┬─────┘   └────┬─────-┘         │
│       │              │              │              │                │
│  ┌────┴──────────────┴──────────────┴──────────────┴─────┐          │
│  │              Next.js 16 App Router (API Routes)       │          │
│  │  /api/ai/triage  /api/ai/match  /api/ai/gaps  ...     │          │
│  └────────────────────────┬──────────────────────────────┘          │
│                           │                                         │
│  ┌────────────────────────┴─────────────────────────────-─┐         │
│  │           3-Tier AI Fallback Chain                     │         │
│  │                                                        │         │
│  │  Tier 1: Gradient ADK Agents (deployed on DO)          │         │
│  │     ↓ fallback                                         │         │
│  │  Tier 2: Direct Gradient Inference (Llama 3.1 70B)     │         │
│  │     ↓ fallback                                         │         │
│  │  Tier 3: Mock Responses (always works, for demos)      │         │
│  └────────────────────────────────────────────────────────┘         │
│                                                                     │
│  ┌──────────────────────────────────────────┐                       │
│  │         Knowledge Base (RAG)             │                       │
│  │  Disaster-specific context files (.md)   │                       │
│  │  Protocols, infrastructure, NGO registry │                       │
│  └──────────────────────────────────────────┘                       │
│                                                                     │
│  ┌──────────────────────────────────────────┐                       │
│  │      Simulation Engine (Zustand)         │                       │
│  │  4 historical disasters + ReliefWeb live │                       │
│  │  Timeline events, live state mutations   │                       │
│  └──────────────────────────────────────────┘                       │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

2-Tier AI Fallback

Every AI endpoint implements a graceful degradation chain:

  1. Tier 1 — Gradient ADK Agent: Deployed Python agent on DigitalOcean with full tool access and knowledge base
  2. Tier 2 — Direct Gradient Inference: Raw llama3.3-70b-instruct call via Gradient API with specialized prompt

Data Flow Diagram (DFD)

Level 0 — Context Diagram

flowchart LR
    V(Victim) -->|aid request| R
    R -->|triage + status| V

    D(Donor) -->|donation| R
    R -->|impact message| D

    N(NGO) -->|accept / decline| R
    R -->|matched requests| N

    C(Coordinator) -->|directives| R
    R -->|predictions + sitreps| C

    R{ReliefNet} <-->|5 AI agents| G[(Gradient AI)]
    KB[(Knowledge Base)] -->|RAG context| R
    RW[(ReliefWeb)] -->|live events| R
    R -->|alerts| PUB(Public)
    R -->|reports| AN(Analytics)
Loading

Level 1 — Disaster Response Pipeline

flowchart TD
    subgraph A[Phase 1 - Intake]
        V(Victim) -->|free text| IA[Intake Agent - Llama 3.1]
        IA -->|urgency + categories| V
        V -->|submit| P[PENDING]
    end

    subgraph B[Phase 2 - Triage]
        P -->|classified| T[TRIAGED]
        T --> MA[Matching Agent - Claude]
        S[(Sim State)] -->|NGOs + inventory| MA
        MA -->|top 3 matches| M[MATCHED]
    end

    subgraph C[Phase 3 - Deployment]
        M --> NGO(NGO Admin)
        NGO -->|accept| IP[IN_PROGRESS]
        NGO -->|assign| NF(Field Team)
        NF --> IP
        IP --> F[FULFILLED]
        F -->|update| INV[(Inventory)]
    end

    subgraph D[Phase 4 - Funding]
        DON(Donor) -->|donate| FL[(Fund Ledger)]
        DON --> CM[Comms Agent - Mistral]
        CM -->|impact msg| DON
        NGO -->|fund claim| FR[Fund Router - GPT-4o]
        FR --> CO
        CO(Coordinator) -->|approve| FL
    end

    subgraph E[Phase 5 - Coordination]
        CO --> CA[Coordinator Agent - Claude]
        CA --> PRED(Predictions)
        CA --> GAPS(Gap Analysis)
        CA --> BRIEF(Area Briefing)
        CA --> CHAT(AI Chat)
        CA --> REPT(Sitrep)
        CO --> CM2[Comms Agent - Mistral]
        CM2 --> ALERT(Multilingual Alerts)
        GOV(Gov Official) --> CO
    end

    F -.->|events| CO
    FL -.->|fund status| CO
    INV -.->|stock levels| S
Loading

Level 2 — Role Communication During Disaster Event

sequenceDiagram
    participant V as Victim
    participant IA as Intake Agent
    participant E as Sim Engine
    participant MA as Matching Agent
    participant NA as NGO Admin
    participant NF as NGO Field
    participant CA as Coord Agent
    participant CO as Coordinator
    participant D as Donor
    participant CM as Comms Agent
    participant G as Gov Official

    Note over V,G: T+0 DISASTER STRIKES
    E->>CO: Simulation begins

    Note over V,G: T+2 VICTIM REQUESTS
    V->>IA: Free text (any language)
    IA-->>V: Urgency 4, Water/Food/Shelter
    V->>E: Submit request

    Note over V,G: T+4 AI TRIAGE & MATCHING
    E->>IA: Auto-triage
    IA-->>E: TRIAGED
    E->>MA: Request + NGOs + inventory
    MA-->>E: MSF 94%, Red Cross 87%, WFP 82%
    E-->>NA: Matched request
    E-->>CO: Live Event Feed

    Note over V,G: T+8 NGO DEPLOYS
    NA->>E: Accepts request
    NA->>NF: Deploy team
    NF->>E: Deployment confirmed
    E-->>CO: Area Briefing updated

    Note over V,G: T+12 COORDINATOR MONITORS
    CO->>CA: Predictions?
    CA-->>CO: Water CRITICAL in 4h
    CO->>CA: Gap analysis?
    CA-->>CO: Zone B: no medical NGO
    CO->>CA: What is the biggest need?
    CA-->>CO: Streaming response

    Note over V,G: T+15 DONOR CONTRIBUTES
    D->>E: Donates $500
    E->>CM: Generate impact
    CM-->>D: Your $500 = water for 250 families

    Note over V,G: T+20 FUND DISBURSEMENT
    NA->>E: Fund claim $12K
    CO->>E: Approves claim
    E-->>G: Fund report updated

    Note over V,G: T+30 EMERGENCY ALERTS
    CO->>CM: Alert Zone B
    CM-->>V: EN + ID + AR alerts

    Note over V,G: T+60 FULFILLED
    NF->>E: Aid delivered
    E-->>V: Status: Fulfilled
    E-->>D: People Helped +1
    E-->>CO: Fulfillment rate up

    Note over V,G: END - AFTER ACTION
    CO->>CA: Generate sitrep
    CA-->>CO: Situation report
    CO->>CA: After-action report
    CA-->>CO: Lessons learned
Loading

Technical Data Flow — API Layer

flowchart LR
    subgraph FE[Frontend]
        F1[RequestForm]
        F2[MatchButton]
        F3[Predictions]
        F4[GapDetection]
        F5[AreaBriefing]
        F6[ChatPanel]
        F7[DonorImpact]
        F8[Alerts]
        F9[Sitrep]
        F10[Report]
        F11[Assessment]
    end

    subgraph API[Next.js API Routes]
        A1["triage"]
        A2["match"]
        A3["predict"]
        A4["gaps"]
        A5["briefing"]
        A6["chat"]
        A7["donor-impact"]
        A8["alert"]
        A9["sitrep"]
        A10["report"]
        A11["assess"]
    end

    subgraph LLM[Gradient AI Agents]
        INTAKE[Intake - Llama 3.1]
        MATCH[Matching - Claude]
        COORD[Coordinator - Claude]
        COMMS[Comms - Mistral]
    end

    F1 --> A1 --> INTAKE
    F2 --> A2 --> MATCH
    F3 --> A3 --> COORD
    F4 --> A4 --> COORD
    F5 --> A5 --> COORD
    F6 --> A6 --> COORD
    F7 --> A7 --> COMMS
    F8 --> A8 --> COMMS
    F9 --> A9 --> COORD
    F10 --> A10 --> COORD
    F11 --> A11 --> INTAKE

    KB[(Knowledge Base)] -.-> INTAKE
    KB -.-> MATCH
    KB -.-> COORD
Loading

2-Tier AI Fallback Chain

flowchart TD
    REQ[API Request] --> T1{Tier 1: ADK Agent}
    T1 -->|success| RES[Response]
    T1 -->|fail| T2{Tier 2: Gradient LLM}
    T2 -->|success| RES

    style T1 fill:#0069FF,color:#fff
    style T2 fill:#FF6B00,color:#fff
    style RES fill:#00C853,color:#fff
Loading

Role-to-Role Communication Matrix

From ↓ / To → Victim Donor NGO Field NGO Admin Coordinator Gov Official
Victim Submits request
Donor Donation event Funds visible
NGO Field Delivers aid Status update Deployment status
NGO Admin Assigns team Fund claim, inventory Reports
Coordinator Alerts (via AI) Impact reports Matched requests Gap directives Sitrep, briefing
Gov Official Policy directives Oversight feedback

AI agents mediate every cross-role interaction:

  • Victim → Coordinator: Intake Agent triages and structures the request
  • Coordinator → NGO: Matching Agent pairs request to optimal NGO
  • Donor → Victim (indirect): Communication Agent generates impact message
  • Coordinator → Public: Communication Agent generates multilingual alerts
  • NGO → Coordinator: Fund Router Agent verifies disbursement claims
  • Coordinator → All: Coordinator Agent provides predictions, gap analysis, sitreps

AI Agent System

Agent Model Purpose Input Output
Intake Llama 3.1 70B Multilingual request triage Free text (any language) Urgency 1-5, categories, structured needs
Matching Claude Sonnet NGO-to-need pairing Structured request + NGO registry Top 3 matches with confidence scores
Coordinator Claude Sonnet Operations Q&A Natural language questions Contextual answers, sitreps, gap analysis
Fund Router GPT-4o Identity verification & disbursement Claim data + verification docs Approved/rejected with audit trail
Communication Mistral Nemo Emergency alerts Alert context + population data Multilingual messages (EN/ID/AR)

AI-Powered Features

Feature API Route Description
AI Triage /api/ai/triage Auto-classify victim requests with urgency and categories
NGO Matching /api/ai/match Match requests to best-suited NGOs with confidence scores
Coordinator Chat /api/ai/chat Streaming conversational AI for operations questions
Predictions /api/ai/predict Forecast resource shortages 2-6 hours ahead
Gap Detection /api/ai/gaps Identify coordination blind spots and NGO duplications
Area Briefing /api/ai/briefing Zone-by-zone deployment snapshot with supply sufficiency
Situation Report /api/ai/sitrep Generate comprehensive situation reports
After-Action Report /api/ai/report Post-operation analysis with lessons learned
Damage Assessment /api/ai/assess Structure field reports into actionable intelligence
Donor Impact /api/ai/donor-impact Personalized donation impact messaging
Emergency Alerts /api/ai/alert Multilingual emergency alerts generation

Tech Stack

Frontend

  • Next.js 16 (App Router) + React 19 + TypeScript
  • TailwindCSS 4 + ShadcnUI (Radix primitives)
  • Zustand — simulation engine state management
  • Mapbox GL JS — interactive disaster map
  • GSAP 3 — animations (ScrollTrigger, Flip, MotionPath)
  • Lucide Icons — consistent icon system

AI & LLMs

  • DigitalOcean Gradient AI — inference platform
  • Gradient ADK (Python) — agent framework with tools and knowledge base
  • Models: Llama 3.1 70B, Claude Sonnet, GPT-4o, Mistral Nemo

Backend

  • Next.js API Routes + tRPC — type-safe API layer
  • PostgreSQL + Drizzle ORM + pgvector — database with vector search
  • NextAuth.js v5 — authentication
  • Zod — runtime validation

Infrastructure

  • DigitalOcean App Platform — hosting
  • DigitalOcean Spaces — S3-compatible object storage
  • GitHub Actions — CI/CD pipeline

Features

Role-Based Dashboards (7 roles)

Role Dashboard Key Features
Victim Request help AI-powered triage form, request tracking, live map
Donor Fund & track Donation form, AI impact messaging, fund transparency
NGO Field Field ops Incoming matched requests, inventory management
NGO Admin Organization Team deployment, resource allocation, analytics
Coordinator Command center AI predictions, gap detection, area briefing, live feed
Government Oversight Cross-agency coordination, fund tracking, analytics
Super Admin System admin Full platform access, all features

Simulation Engine

4 historical disaster scenarios with live timeline progression:

  • Aceh 2025 — Cyclone Senyar (Indonesia)
  • Turkey-Syria 2023 — Kahramanmaras Earthquake (7.8 Mw)
  • Beirut 2020 — Port Explosion (2,750 tonnes ammonium nitrate)
  • Nepal 2015 — Gorkha Earthquake (7.8 Mw)

Plus dynamic simulations generated from live ReliefWeb disaster data.

Each simulation features:

  • Configurable speed (1x, 2x, 5x, 10x)
  • Timeline events (new requests, status changes, donations)
  • Live state mutations (inventory, NGO status, fund claims)
  • Real-time event feed

Knowledge Base (RAG)

Disaster-specific context files providing agents with:

  • Local infrastructure (hospitals, roads, airports)
  • Medical protocols and Sphere humanitarian standards
  • NGO directory with capabilities and locations
  • Lessons learned from past disaster responses

Quick Start

Prerequisites

  • Node.js 20+
  • pnpm 9+
  • (Optional) Mapbox token for interactive map
  • (Optional) Gradient API key for live AI

Install & Run

# Clone
git clone https://github.com/your-org/reliefnet.git
cd reliefnet

# Install dependencies
pnpm install

# Set up environment (optional — app works without these)
cp apps/web/.env.example apps/web/.env.local
# Edit .env.local with your keys:
#   NEXT_PUBLIC_MAPBOX_TOKEN=...
#   GRADIENT_API_KEY=...

# Run development server
pnpm dev

# Build for production
pnpm build

Environment Variables

Variable Required Description
NEXT_PUBLIC_MAPBOX_TOKEN No Mapbox GL JS token (map shows placeholder without it)
GRADIENT_API_KEY No DigitalOcean Gradient AI key (falls back to mock responses)
GRADIENT_COORDINATOR_AGENT_URL No Deployed Coordinator agent endpoint
GRADIENT_INTAKE_AGENT_URL No Deployed Intake agent endpoint
GRADIENT_MATCHING_AGENT_URL No Deployed Matching agent endpoint
DATABASE_URL No PostgreSQL connection string

Note: The app is fully functional without any API keys — all AI features gracefully fall back to realistic mock responses for demo purposes.


Demo

  1. Open the app and navigate to the dashboard
  2. Select a simulation scenario (e.g., Aceh 2025) from the sidebar
  3. Switch between roles using the role dropdown to explore each perspective
  4. Navigate directly: /dashboard?role=COORDINATOR&sim=aceh-2025

Key Demo URLs

/dashboard?role=VICTIM&sim=aceh-2025          # Victim view
/dashboard?role=COORDINATOR&sim=aceh-2025     # Coordinator command center
/dashboard?role=DONOR&sim=aceh-2025           # Donor view
/dashboard?role=NGO_ADMIN&sim=aceh-2025       # NGO admin view
/dashboard/map?role=COORDINATOR&sim=aceh-2025 # Live disaster map
/dashboard/new-request?role=VICTIM&sim=aceh-2025  # AI triage form
/dashboard/analytics?role=COORDINATOR&sim=aceh-2025  # Analytics & reports
/dashboard/impact?role=COORDINATOR&sim=aceh-2025     # AI impact dashboard

Project Structure

ReliefNet/
├── apps/web/                           # Next.js 16 application
│   └── src/
│       ├── app/                        # App Router pages
│       │   ├── page.tsx                # Landing page
│       │   ├── dashboard/              # Dashboard pages (14 routes)
│       │   │   ├── page.tsx            # Role-specific overview
│       │   │   ├── layout.tsx          # Dashboard shell + header
│       │   │   ├── map/               # Interactive disaster map
│       │   │   ├── new-request/       # AI triage form
│       │   │   ├── analytics/         # Reports & predictions
│       │   │   ├── impact/            # AI impact dashboard
│       │   │   └── ...               # requests, ngos, funds, etc.
│       │   └── api/ai/               # 11 AI API routes
│       │       ├── triage/            # Intake triage
│       │       ├── match/             # NGO matching
│       │       ├── chat/              # Streaming coordinator chat
│       │       ├── predict/           # Resource forecasting
│       │       ├── gaps/              # Coordination gap detection
│       │       ├── briefing/          # Area deployment briefing
│       │       └── ...               # sitrep, report, assess, etc.
│       ├── components/
│       │   ├── ai/                    # 11 AI feature components
│       │   ├── dashboard/             # Dashboard UI (sidebar, controls, feed)
│       │   ├── map/                   # Mapbox disaster map
│       │   ├── ui/                    # ShadcnUI primitives
│       │   └── layout/               # Navbar, footer, theme toggle
│       ├── lib/
│       │   ├── ai/                    # AI client, prompts, mock responses
│       │   ├── simulations/           # 4 disaster simulations + dynamic gen
│       │   └── mock-data.ts           # Type definitions & mock data
│       ├── stores/
│       │   ├── simulation-engine.ts   # Zustand simulation state
│       │   └── ai-store.ts            # AI chat state
│       └── types/                     # TypeScript type definitions
├── agents/                             # Python Gradient ADK agents
│   ├── intake/                        # Multilingual triage agent
│   ├── matching/                      # NGO matching with pre-scoring
│   ├── coordinator/                   # Operations Q&A agent
│   ├── fund-routing/                  # Fund verification agent
│   ├── communication/                 # Alert generation agent
│   └── shared/                        # Shared utilities
├── knowledge-base/                     # RAG context files
│   ├── aceh-2025.md                   # Disaster scenarios
│   ├── turkey-syria-2023.md
│   ├── beirut-2020.md
│   ├── nepal-2015.md
│   ├── infrastructure/                # Hospitals, roads, logistics
│   ├── protocols/                     # Medical triage, Sphere standards
│   ├── medical/                       # Healthcare resources
│   ├── ngo-directory/                 # NGO capabilities
│   └── lessons/                       # Past coordination lessons
└── infra/                              # Deployment configs

License

MIT

About

AI-Powered Disaster Relief Coordination Platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors