KenyaRAG — LlamaIndex RAG system for Kenya civic data. Natural language queries over parliament, budget, and policy documents.
# 🔍 KenyaRAG — Civic AI for Kenya
> Retrieval-augmented generation over Kenya's civic datasets. Ask questions about parliament records, county budgets, SACCO data, and constitutional rights — and get grounded, cited answers.
## What it does
KenyaRAG turns Kenya's public civic datasets into a queryable knowledge base. Built on LlamaIndex with Kenya-specific document loaders, retrievers, and citation formatting.
**Ask questions like:**
- *"Which counties had the lowest development fund absorption in FY 2022/23?"*
- *"What is the CDF allocation for Westlands constituency?"*
- *"Which MPs have voted against the Finance Bill the most times?"*
- *"What does the Constitution say about riparian land rights?"*
## Data sources
All data from our published civic dataset:
| Dataset | Source | DOI |
|---------|--------|-----|
| Parliamentary bills | Parliament of Kenya | Kaggle |
| County budgets FY22/23 | Controller of Budget | HuggingFace |
| MP records | Parliament / Mzalendo | Zenodo |
| SACCO registry | SASRA | Kaggle |
| CDF utilisation | Controller of Budget | HuggingFace |
## Architecture
```
civic_data/ ← Kenya civic CSVs (from Kaggle/HuggingFace datasets)
├── mps_seed.csv
├── county_budgets_fy2223.csv
├── bills_seed.csv
├── cdf_seed.csv
└── saccos_seed.csv
kenya_rag/
├── loaders/ ← Custom LlamaIndex document loaders per dataset
├── indices/ ← Vector + keyword index builders
├── query/ ← Query engines with Kenya-specific prompts
└── app.py ← Streamlit interface
```
Built on LlamaIndex — the leading open-source RAG framework (30k+ GitHub stars).
## Quickstart
```bash
pip install kenya-rag
# or from source:
git clone
github.com
cd kenya-rag
pip install -r requirements.txt
export OPENAI_API_KEY=your_key # or ANTHROPIC_API_KEY
streamlit run app.py
```
## Why this exists
Kenya's public data is published but not accessible. A Controller of Budget PDF exists. 350-page Hansard records exist. SASRA …