An open API service indexing awesome lists of open source software.

https://github.com/shehzansk/healthx

A COVID-19 containment simulator with AI-powered agents and RL-based policy planning using a digital twin of Los Angeles.
https://github.com/shehzansk/healthx

ai digital-twin flask healthcare nextjs reinforcement-learning simulation

Last synced: about 1 month ago
JSON representation

A COVID-19 containment simulator with AI-powered agents and RL-based policy planning using a digital twin of Los Angeles.

Awesome Lists containing this project

README

          

# ๐Ÿงฌ COVID Digital Twin & Containment Simulation

A digital twin of an urban environment powered by AI agents and Reinforcement Learning to simulate, analyze, and optimize pandemic containment strategies.

---

## ๐ŸŽฏ Objectives

- **Simulate Realistic Human Agents to Model Urban Dynamics**
Create human-like agents with lifelike demographics, routines, and behaviors that evolve over time, reflecting real-world social dynamics. This helps uncover patterns that drive smarter policy and resource planning during pandemics.

- **Train RL Agents for Disease Containment**
Utilize Reinforcement Learning to develop adaptive containment strategies (like dynamic lockdowns) that minimize disease spread while balancing economic and societal impacts.

---

## ๐Ÿง  Overview

This project combines **agent-based modeling** with **reinforcement learning** to build a **dynamic digital twin** of a city (modeled on Los Angeles). Each AI agent simulates real human behavior, allowing the system to evaluate and adapt containment strategies in response to pandemic scenarios.

---

## ๐Ÿ”‘ Key Features

### ๐Ÿ™๏ธ Digital Twin of a City

Simulates thousands of realistic human-like agents in a virtual city with detailed spatial geography and movement dynamics based on historical epidemic/pandemic data.

### ๐Ÿ” Chain-of-Thought Driven Routines

Agents follow daily schedules generated using large language models to mimic diverse real-world behaviors and responses under epidemic conditions.

### ๐Ÿงช RL-Based Policy Optimization

Custom OpenAI Gym environment enables RL agents to learn dynamic intervention policies (e.g., selective lockdowns) using algorithms like **Proximal Policy Optimization (PPO)**.

### ๐Ÿฅ Predictive Healthcare Insights

- Forecasts shortages in medical equipment, ICU beds, and medicine.
- Simulates the impact of travel restrictions and lockdowns on healthcare logistics.

### ๐Ÿงฉ Modular Architecture

- **Frontend:** Interactive dashboard (Next.js) with maps (Leaflet) and charts for visualization.
- **Backend:** Flask-based API hosting the simulation logic and chain-of-thought reasoning.
- **ML Module:** Scripts and environments for RL training using `stable-baselines3`.

---

## ๐Ÿงฌ How It Works

![Screenshot](./photos/architech.png)

### ๐Ÿ”น Agent-Based Simulation

Each agent is initialized with a profile and dynamic routine. They interact, move, and influence infection dynamics across city neighborhoods.

### ๐Ÿ”น Data-Driven Urban Modeling

Tracks time-series data like population density, infection rates, and economic loss. Enables realistic forecasting and planning.

### ๐Ÿ”น Reinforcement Learning for Policy Optimization

Encapsulated in a custom Gym environment. The RL agent learns when and where to apply interventions to contain disease spread optimally.

### ๐Ÿ”น Visualization & Insights

Real-time maps and dashboards show:

- Agent movements
- Infection spread
- Hospital resource predictions
- RL policy plans

---

## ๐Ÿ–ฅ๏ธ Tech Stack

![Screenshot](./photos/tech.png)

---

## ๐Ÿ“ท Gallery

![Screenshot](./photos/gallery.gif)

---

## ๐Ÿš€ Getting Started

### ๐Ÿ”ง Prerequisites

- Node.js & npm
- Python 3.8+
- MongoDB

## ๐Ÿ“ Directory Structure

```
HealthX/
โ”œโ”€โ”€ backend/ # Flask app, simulation engine, RL environment
โ””โ”€โ”€ frontend/ # Next.js frontend with interactive maps & controls
```

---

### ๐Ÿ› ๏ธ Manual Setup

1. **Backend**

```bash
cd HealthX/backend
pip install -r requirements.txt
python app.py
```

2. **Frontend**
```bash
cd HealthX/frontend
npm install
npm run dev
```

---

## ๐Ÿ“Š Sample Outputs

- ๐Ÿ“Œ **Interactive Map:** Live city simulation with infection and economic overlays.
- ๐Ÿ“ˆ **Containment Timeline:** RL-generated policy sequence (lockdowns/travel bans).
- ๐Ÿฅ **Hospital Insights:** Shortage forecasts and surplus indicators.
- ๐Ÿง  **Gemini Suggestions:** AI-generated recommendations for resource management.

---

## ๐Ÿ“Œ Note

This project is a research-oriented prototype and not intended for real-world deployment without further clinical and epidemiological validation.