# Kenya Economic Knowledge Graph
A prototype knowledge-graph system for modeling economic interconnections in the Kenyan market. Tests whether graph-propagation (predicting downstream effects through entity relationships) outperforms simple baselines using historical event data.
## Project Overview
This project builds a directed knowledge graph of Kenyan economic entities (companies, regulators, government agencies, and market participants) with curated relationships. It then simulates a "news expansion agent" that adds temporary event-driven edges, runs a backtest engine against historical events, and compares graph-propagation signals against baseline approaches.
### Key Entities (20 nodes)
| Sector | Entities |
|--------|----------|
| **Telecom** | Safaricom, Airtel Kenya, Telkom Kenya |
| **Banking** | KCB, Equity Bank, Absa Kenya, Cooperative Bank, NCBA, Standard Chartered (UK) |
| **Energy** | KenGen, Kenya Power, Energy Regulatory Commission |
| **Consumer Goods** | BAT Kenya, EABL, British American Tobacco (LSE) |
| **Agriculture** | NCPB, Yara East Africa, Farmers (aggregated) |
| **Fintech** | M-Pesa |
| **Government** | Central Bank of Kenya |
### Relationship Types (21 edges)
- supplier/customer (3), competitor (6), regulator/regulated (6), parent/subsidiary (2), partner (2), investor/investee (1), distributor (1)
## Directory Structure
```
kenya-economic-graph/
├── src/
│ ├── graph_builder.py # Seed graph construction (20 nodes, 21 edges)
│ ├── data_fetcher.py # Price data fetching (yfinance + synthetic)
│ ├── expansion_agent.py # News expansion agent (7 simulated events)
│ ├── backtest.py # Backtest engine (5 historical events)
│ └── baselines.py # Baseline comparison (4 approaches)
├── nb/
│ └── exploration.ipynb # Jupyter notebook walkthrough
├── data/
│ ├── seed_graph.json # Seed graph (node-link format)
│ ├── seed_graph.gexf # Seed graph (Gephi-compatible)
│ ├── augmented_g …