Data-driven analysis of security incidents in the Sahel (Burkina Faso, Mali, Niger) over 10+ years, combining conflict data with economic indicators to uncover patterns, trends, and geopolitical insights. Interactive dashboard included.
# Sahel Security Analysis
An open-source intelligence platform analyzing armed conflict dynamics and their economic consequences in Burkina Faso, Mali, and Niger, built on ACLED data, Bayesian modeling, and a RAG-powered AI analyst.
**Live demo:** sahel-security-analysis.onrender.com
First load takes 30 to 60 seconds: the free Render instance spins down when idle.
---
*23,156 ACLED incidents rendered with Plotly WebGL. Marker size encodes fatalities,
colour encodes event type, filtering runs entirely in the browser.*
---
## What it does
- Visualizes 23,000+ conflict incidents on an interactive WebGL map with real-time client-side filtering
- Tracks monthly trends, detects anomalies (Z-score), and projects a 6-month forecast via linear regression
- Identifies geographic hotspots and most active armed groups
- Quantifies the conflict-inflation relationship through a Bayesian hierarchical model (PyMC, ArviZ)
- Exposes an AI analyst powered by a RAG pipeline: answers are constrained to context retrieved from the ACLED dataset
*Key metrics, distribution by country and by event type, monthly trend.*
*Rolling averages, fitted linear trend and a 6-month baseline projection.*
*Questions answered from context retrieved in the ACLED DataFrame with Pandas,
then passed to Llama 3.1 through Groq.*
---
## Versions
| Branch | Stack | Status |
|---|---|---|
| `main` | Flask, Plotly WebGL, RAG chatbot, Render | Live |
| `streamlit` | Streamlit, Folium | Preserved |
The project was originally built with Streamlit. It was migrated to Flask to support a production deployment with a RAG chatbot, WebGL map performance at 23k points, and full control over the frontend design.
---
## Architecture
```
flask_app/
├── routes/ # Page blueprints (overview, map, trends, hotspots, bayesian, about)
├── api/ # JSON endpoints (map points, chart data, chat)
├── chat/
│ ├── rag.py # Intent detection + Pandas retrieval + prompt builder
│ ├── …