Skip to content

Nitesh-debug/disaster_resource_allocation_JK

Repository files navigation

Disaster Resource Allocation System (Agentic AI)

This project has been upgraded to a cutting-edge Agentic AI System for disaster response in Jammu & Kashmir. It employs a multi-agent architecture to predict disaster risks, allocate resources optimization, and visualize data via a conversational interface and a live dashboard.

🌟 Key Features

🤖 Multi-Agent Architecture

The system is built on a custom Agent Framework with specialized agents:

  • Master Agent: The central coordinator that routes user queries to the appropriate sub-agent.
  • Resource Agent: Responsible for Machine Learning predictions, resource allocation planning, and weather analysis.
  • Analytics Agent: Handles data aggregation, statistical summaries, and interactive map visualizations.
  • Notification Agent: Manages Smart Alerts via Email and SMS (Twilio).

🌦️ Real-Time Intelligence

  • Live Weather Integration: Fetches real-time weather data for J&K districts using the OpenMeteo API.
  • Risk Prediction: Uses a Random Forest Classifier to predict risk levels (1-5) based on weather parameters (Precipitation, Wind, etc.).
  • Dynamic Resource Allocation: Automatically generates plans to deploy NDRF teams, medical staff, and food supplies to high-risk areas.

🚨 Smart Alerts System

  • Specific Threat Detection: Automatically identifies specific threats:
    • Cloud Burst (Precipitation ≥ 100mm)
    • Heavy Rain (Precipitation ≥ 50mm)
    • Severe Storm (Wind ≥ 80km/h)
  • Intelligent Deduplication: Prevents spam by ensuring only one alert is sent per district/threat-type session.
  • Multi-Channel Support: Supports Email (SMTP) and SMS (Twilio).

📊 Interactive Interface

  • Chat Assistant: Natural language interface to ask queries like "Run allocation" or "Show risk map".
  • Live Dashboard: Real-time monitoring view with Risk Maps, Alert Feeds, and Resource Tables.

🚀 Setup and Usage

1. Prerequisites

  • Python 3.10+
  • An active internet connection (for OpenMeteo API and Alerts).

2. Installation

Clone the repository and install dependencies:

git clone <repository_url>
cd <repository_folder>
pip install -r requirements.txt

3. Configuration

Create a manual_keys.txt file (or .env) in the root directory with your API credentials:

TWILIO_SID=your_sid
TWILIO_AUTH_TOKEN=your_token
TWILIO_PHONE=your_twilio_number
TO_PHONE=target_phone_number
EMAIL_USER[email protected]
EMAIL_PASSWORD=your_app_password
RECEIVER_EMAIL[email protected]

4. Initialize Data & Models

Run the training script to generate dummy models if you haven't already:

python scripts/train_dummy_models.py

5. Run the Application

Launch the Agent App with Streamlit:

streamlit run agent_app.py

🎮 How to Use

The application features two main modes reachable via the sidebar:

Mode 1: Chat Assistant

Interact using natural language commands:

  • "Run resource allocation": Triggers the full pipeline (Live Weather -> Prediction -> Allocation -> Alerts).
  • "Show risk map": Ask the Analytics Agent to render an interactive map.
  • "Send test alert": Trigger a manual test of the notification system.

Mode 2: Live Dashboard

A dedicated view for HQ monitoring:

  • Risk Map: Visualizes safe vs. high-risk districts.
  • Alert Feed: Shows the latest active alerts.
  • Resource Table: Detailed list of deployed teams and supply shortages.

Note: You must run an allocation in Chat Mode first to populate the dashboard data.


📂 Project Structure

  • agent_app.py: Main entry point (Streamlit UI).
  • agents/: Core logic for Master, Resource, Notification, and Analytics agents.
  • scripts/:
    • train_dummy_models.py: Model training script.
    • resource_allocation.py: Allocation logic.
    • test_deduplication.py: Verification script for smart alerts.
  • results/: Stores generated prediction CSVs and allocation JSONs.
  • data/: Configuration and static data files.

Authors

  • Harshit Pathak
  • Nitesh Kumar
  • Akash Kumar Chaurasiya

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •