GraphRAG-powered knowledge graph that maps AI policies across Africa and suggests frameworks for countries without one
# African AI Policy Knowledge Graph
> *What if we could use existing African AI policies to help countries that don't have one yet?*
That's exactly what this project does.
---
## The Problem
Africa has 54 countries. Only a handful have a national AI policy — Kenya, Rwanda, Ghana, Zambia, and a few others. The rest? Nothing. No roadmap, no governance framework, no strategy.
This is a problem because AI is already here, and countries without policies are navigating it blind.
---
## What This Project Does
This project builds a **knowledge graph** from real African AI policy documents (PDFs), extracts key information from them, stores everything in a graph database, and then uses **GraphRAG** (Graph + AI) to suggest tailored AI policy frameworks for countries that don't have one.
You ask: *"What should Chad's AI policy look like?"*
The system looks at what Kenya, Rwanda, Ghana, and Zambia did, finds patterns, and generates a practical, country-specific suggestion.
---
## How It Works
```
PDF Policies (Kenya, Rwanda, Ghana, Zambia, African Union)
↓
Extract text with pdfplumber
↓
Extract entities with Groq AI (pillars, sectors, goals, risks, institutions)
↓
Store in Neo4j Knowledge Graph
↓
GraphRAG: query the graph + generate suggestions with LLM
↓
FastAPI REST API to access everything
```
---
## Project Structure
```
african-ai-kg/
├── data/
│ ├── policies/ ← Put your PDF files here
│ ├── extracted/ ← Extracted text (auto-generated)
│ └── entities/ ← Extracted entities (auto-generated)
├── src/
│ ├── extract.py ← Step 1: PDF → text
│ ├── entity_extractor.py← Step 2: text → entities (Groq AI)
│ ├── graph_loader.py ← Step 3: entities → Neo4j graph
│ └── graphrag.py ← Step 4: graph + LLM = suggestions
├── api.py ← FastAPI REST API
├── main.py ← Run the full pipeline
├── requirements.txt
└── .env.example ← Environment variables template
```
---
## Getting St …