Skip to content

EnceladusLin/Global-Affairs-Simulation-Platform

License Top Language Stars Forks Issues
CI Python TypeScript React Status

🌏 IR Intelligence Platform

国际关系情报分析与推演平台

Where International Relations meets AI — Analyze. Simulate. Predict.


📖 Table of Contents


🌍 Overview

IR Intelligence Platform is an end-to-end AI-powered Geopolitical Intelligence Analysis & Simulation System. It ingests global news in real time, clusters related reports, abstracts them into structured international relations events using LLMs, applies IR theories for analysis, generates multi-directional scenario scripts with probabilistic forecasting, and continuously calibrates predictions against actual outcomes.

Think of it as an AI analyst that reads the world's news 24/7, builds structured geopolitical event graphs, simulates possible futures under different IR theoretical lenses, and learns from its mistakes through systematic calibration.

Core Philosophy

Traditional geopolitical analysis suffers from three problems:

  1. Information overload — too many news sources to track manually
  2. Cognitive bias — analysts anchor on familiar narratives
  3. No feedback loop — predictions are made but rarely systematically evaluated

This platform addresses all three by:

  1. Automated ingestion & abstraction of global news into structured event models
  2. Multi-theory, multi-directional scenario generation to counter confirmation bias
  3. Built-in calibration tracking with Brier scores, hit-rate dashboards, and automatic evaluation
🇨🇳 中文介绍

国关推演平台 是一个端到端的 AI 驱动的国际关系情报分析与推演系统。它实时采集全球新闻,聚类相关报道,使用大语言模型抽象为结构化国际关系事件,应用多种 IR 理论进行分析,生成多方向推演剧本及概率预测,并持续对预测结果进行校准评估。

想象一个 AI 分析师 全天候阅读全球新闻,构建结构化地缘政治事件图谱,在不同 IR 理论视角下推演可能的未来,并通过系统化校准从错误中学习。

核心解决的问题:信息过载、认知偏差、预测缺乏反馈闭环。


🎯 Why This Project

Problem Solution
24/7 news cycle overwhelms human analysts Automated RSS ingestion + LLM clustering & abstraction
Analysis is often single-perspective 3+ IR theories applied simultaneously to every event
"Prediction" without accountability Built-in calibration: Brier score, hit rate, error analysis
Qualitative analysis lacks structure Every event → structured data model → quantifiable scenarios
Historical knowledge is underused Historical analogy engine with 100+ case database
Black-box AI predictions Every script step is traceable: actor → motivation → evidence

✨ Features

🔄 Intelligent Ingestion & Clustering

  • Multi-source RSS feed ingestion (Reuters, AP, regional sources)
  • Semantic clustering of related news articles using LLM embeddings
  • Automatic deduplication and story grouping

🧠 Event Abstraction Engine

  • LLM-powered extraction of structured IR events from news clusters
  • Captures: actors, event type, crisis stage, strategic dimensions, rule-of-engagement triggers
  • Produces clean, structured AbstractIRGEvent data models

📊 Multi-Theory Analysis

Apply 6+ international relations theories to each event:

  • Realism — power politics, security dilemmas
  • Liberal Institutionalism — institutional constraints, norms
  • Constructivism — identity, narrative, perception
  • Geopolitics — geography, resources, strategic chokepoints
  • International Political Economy — trade interdependence
  • Power Transition Theory — hegemonic dynamics

🌿 Multi-Directional Scenario Scripting

For each event, generate scripted scenarios across three directions:

  • 🔴 Escalation — conflict intensifies
  • 🟡 Stalemate — status quo persists
  • 🟢 De-escalation — tensions resolve

Each script includes:

  • Step-by-step timelines with actor motivations
  • Trigger conditions & invalidation conditions
  • Probability distributions (low / central / high estimates)
  • Supporting & counter evidence per step
  • Confidence levels and uncertainty annotations

🔀 Branch Engine (Counterfactual Simulation)

  • Create branching "what-if" scenarios from any prediction run
  • Simulate alternative actor moves, constraint changes, or external shocks
  • Compare divergence points and new step paths

📜 Historical Analogy Engine

  • Curated database of 100+ historical IR cases (Cuban Missile Crisis, Gulf War, South China Sea disputes, etc.)
  • LLM-powered structural similarity matching
  • Historical base-rate probabilities guide current forecasts
  • Full CRUD for case library management

📈 Calibration Dashboard

  • Brier Score tracking (gold standard for probabilistic forecast accuracy)
  • Calibration Grade (A–F) with quality benchmarks
  • Step-level & script-level hit rate tracking
  • By-direction, by-theory, by-event-type, by-crisis-stage breakdowns
  • Calibration curve visualization (predicted vs. actual)
  • Automated improvement suggestions

📝 History & Evaluation

  • Complete prediction run history with expandable detail views
  • Record actual outcomes with form-based entry
  • Auto-generate evaluations comparing predictions to reality
  • Error type classification and accuracy rate computation

🌐 3D Globe Visualization

  • Interactive 3D globe showing geopolitical events geographically
  • Color-coded crisis stages and relationship types
  • Map layer switching (satellite / dark / night)

📄 Report Export

  • Generate structured PDF reports for events, scenarios, themes, and reviews
  • Chinese font support (WenQuanYi / Noto CJK)

🌍 Full i18n (Chinese + English)

  • Every user-facing string is internationalized
  • Dynamic date/number formatting based on locale

🏗 Architecture

                          ┌─────────────────────────────────────┐
                          │          React 18 + TypeScript        │
                          │         (Vite build + PWA)           │
                          │  ┌─────┐ ┌────┐ ┌───┐ ┌──────┐     │
                          │  │Globe│ │Pipe│ │Scn│ │Calib │ ...  │
                          │  └──┬──┘ └──┬─┘ └─┬─┘ └──┬───┘     │
                          └─────┼───────┼─────┼──────┼──────────┘
                                │       │     │      │
                          ┌─────┼───────┼─────┼──────┼──────────┐
                          │     ▼       ▼     ▼      ▼           │
                          │         REST API (FastAPI)            │
                          │  ┌─────────────────────────────────┐  │
                          │  │ Routers: events, scenarios,     │  │
                          │  │   pipeline, calibration,        │  │
                          │  │   analogies, reports, auth      │  │
                          │  └───────────┬─────────────────────┘  │
                          │              │                        │
                          │  ┌───────────┼─────────────────────┐  │
                          │  │ Services: (Business Logic)      │  │
                          │  │  • Ingestion (RSS + dedup)      │  │
                          │  │  • Clustering (LLM embedding)   │  │
                          │  │  • Event Abstraction (LLM)      │  │
                          │  │  • Theory Analysis (LLM)        │  │
                          │  │  • Scenario Engine (LLM)        │  │
                          │  │  • Branch Engine                │  │
                          │  │  • Analogy Engine               │  │
                          │  │  • Calibration Service          │  │
                          │  │  • PDF Export                   │  │
                          │  └───────────┬─────────────────────┘  │
                          │              │                        │
                          │  ┌───────────┼─────────────────────┐  │
                          │  │ Core:                           │  │
                          │  │  • LLM Router (Anthropic)       │  │
                          │  │  • Config Management            │  │
                          │  │  • Auth (JWT)                   │  │
                          │  │  • Rate Limiter                 │  │
                          │  └───────────┬─────────────────────┘  │
                          │              │                        │
                          │  ┌───────────▼─────────────────────┐  │
                          │  │ Database (SQLite / PostgreSQL)  │  │
                          │  │  + Alembic Migrations           │  │
                          │  └─────────────────────────────────┘  │
                          └───────────────────────────────────────┘

Data Flow

RSS Feeds → News Clusters → Abstract IR Events
                                  │
                    ┌─────────────┼─────────────┐
                    ▼             ▼             ▼
              Theory         Scenario       Historical
              Analysis       Scripts        Analogies
                    │             │             │
                    └─────────────┼─────────────┘
                                  ▼
                          Prediction Runs
                                  │
                                  ▼
                     Actual Outcome Recording
                                  │
                                  ▼
                     Calibration & Evaluation
                                  │
                                  ▼
                          PDF Report Export

🚀 Quick Start

Prerequisites

Option 1: One-Click Start

Windows:

start.bat

Linux / macOS:

chmod +x start.sh && ./start.sh

The script will automatically:

  1. Check Python & Node environments
  2. Install missing dependencies
  3. Run database migrations
  4. Start backend (port 8000) & frontend (port 5173)
  5. Open the app in your browser

Option 2: Docker

# Build and start
docker compose up --build -d

# Check status
docker compose ps

# View logs
docker compose logs -f backend

# Access the app
open http://localhost:8000

Option 3: Manual Setup

# ── Backend ──
cd backend
python -m pip install -r requirements.txt
cp ../.env.example ../.env
# Edit .env to add your ANTHROPIC_API_KEY
python -m alembic upgrade head
python -m uvicorn backend.main:app --reload --port 8000

# ── Frontend ──
cd frontend
npm ci
npm run dev

Visit http://localhost:5173 in your browser.

Note: The platform requires a valid Anthropic API key for AI features (event abstraction, theory analysis, scenario generation, etc.). Without it, the ingestion and database features still work.


📸 Screenshots

Feature Description
🌐 3D Globe Interactive globe with event markers, crisis stage coloring, relationship arcs
📡 Pipeline End-to-end analysis pipeline: ingest → cluster → abstract → theorize → simulate
🌿 Scenarios Three-column layout showing escalation, stalemate, de-escalation scripts with step details
📈 Calibration Brier score gauge, grade levels, hit-rate breakdowns by direction/theory/stage
📜 Analogies Split-panel: event analysis + historical case library with similarity scoring
📄 Reports Configurable PDF generation for event briefs, scenario reports, thematic reviews

🛠 Technology Stack

Backend

Component Technology
Framework FastAPI (Python 3.12+)
Database ORM SQLAlchemy 2.0 + Alembic
AI / LLM Anthropic Claude API (via custom LLM Router)
Auth JWT (PyJWT + passlib/bcrypt)
Rate Limiting SlowAPI
PDF Engine ReportLab 4.2 (with CJK font support)
Geocoding Geopy (Nominatim)
Monitoring Prometheus (prometheus-fastapi-instrumentator)

Frontend

Component Technology
Framework React 18 (TypeScript)
Build Tool Vite 5
Styling Tailwind CSS 3
State Zustand
Charts Recharts
3D Globe Globe.GL (Three.js)
Maps Leaflet
i18n react-i18next / i18next
Routing React Router 6
PWA vite-plugin-pwa (Workbox)

DevOps

Component Technology
Containerization Docker + Docker Compose
CI/CD GitHub Actions
Linting Ruff (Python), TypeScript Compiler
Testing Pytest + Playwright (e2e)

📚 API Reference

When the backend is running, visit:

Key Endpoints

Method Endpoint Description
POST /api/v1/auth/register User registration
POST /api/v1/auth/token JWT token login
GET /api/v1/events List abstract IR events
POST /api/v1/pipeline/run Trigger full analysis pipeline
GET /api/v1/pipeline/runs List prediction runs
GET /api/v1/scenarios/{event_id} Get scenario scripts
POST /api/v1/branches Create counterfactual branch
GET /api/v1/analogies/{event_id} Get historical analogies
POST /api/v1/history/{run_id}/outcome Record actual outcome
POST /api/v1/history/{run_id}/evaluation Generate auto-evaluation
GET /api/v1/calibration/summary Get calibration summary
POST /api/v1/reports/export Generate PDF report

📖 Documentation


🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Development environment setup
  • Code style guidelines
  • Pull request process
  • Testing requirements

Quick Contribution Setup

git clone https://github.com/your-org/ir-intel-platform.git
cd ir-intel-platform
cp .env.example .env  # Add your ANTHROPIC_API_KEY
pip install -r backend/requirements.txt
cd frontend && npm ci && cd ..
# Start both services and start hacking!

📄 License

This project is licensed under the MIT License — see the LICENSE file for details.


🙏 Acknowledgments

  • Anthropic — for the Claude API that powers the LLM reasoning
  • Three.js / Globe.GL — for the 3D globe visualization
  • FastAPI — for the excellent Python web framework
  • All open-source contributors whose libraries make this project possible

Built with ❤️ by the IR Intel Platform team
⭐ Star us on GitHub — it helps more people discover the platform!

About

An international relations intelligence and forecasting platform that integrates open-source data, event chains, actor modeling, knowledge graphs, and scenario simulation to support geopolitical risk analysis and structured strategic assessment.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors