# africa-urea-tracker
Automated pipeline that fetches urea (HS 310210) import and export data for all African countries using the UN Comtrade API, then analyzes results with Claude AI.
## What it does
1. **Fetches** urea trade data (imports + exports) for 54 African countries across 15 years (2010–2024)
2. **Saves** raw data as CSV and JSON in the `data/` folder
3. **Analyzes** the data using Claude API to produce an insights report
4. **Commits** everything back to this repo automatically
Runs on-demand via GitHub Actions (you trigger it manually).
## Quick setup (5 minutes)
### 1. Create a new GitHub repo
Go to
github.com and create a **public** repo (free Actions minutes for public repos).
### 2. Clone and copy files
```bash
git clone
github.com
cd africa-urea-tracker
```
Copy the following files from this template into your repo:
```
.github/workflows/fetch_urea_data.yml
scripts/fetch_urea_data.py
scripts/analyze_with_claude.py
data/.gitkeep
README.md
```
### 3. Add your API keys as GitHub Secrets
Go to your repo → **Settings** → **Secrets and variables** → **Actions** → **New repository secret**
Add these secrets:
| Secret Name | Required | Where to get it |
|---|---|---|
| `ANTHROPIC_API_KEY` | Yes | console.anthropic.com → API Keys |
| `COMTRADE_API_KEY` | No (optional) | comtradedeveloper.un.org — free tier gives higher rate limits |
### 4. Push and trigger
```bash
git add .
git commit -m "Initial setup"
git push
```
Then go to **Actions** tab → **Fetch African Urea Trade Data** → **Run workflow** to test it.
## How it works
### Data source
The UN Comtrade database (same source WITS uses) provides HS6-level trade data including:
- **Trade value** in USD
- **Quantity** in Kg (where reported by the country)
- **Trade flow** (Import/Export)
Product code `310210` = Urea (whether or not in aqueous solution).
### Rate limits
- UN Comtrade free API: ~1 request/second, 100 requests/hour
- Full …