Tracking retail price trends across Egypt using Python, SQL, Streamlit, and AI-generated weekly summaries
# πͺπ¬ Egypt Cost-of-Living Price Tracker
A personal data project tracking how prices of everyday items β groceries, transport, and utilities β have changed across Egyptian cities since January 2024.
Egypt has experienced significant inflation over the past two years. This project applies a simple data engineering pipeline to make those changes visible and measurable.
---
## What It Does
- **Cleans and validates** raw price data (null checks, outlier detection, type enforcement)
- **Stores** cleaned data in a local SQLite database with SQL aggregation queries
- **Visualises** trends in an interactive Streamlit dashboard (price over time, category breakdowns, city comparisons, biggest movers)
- **Generates AI summaries** using the Claude API β a plain-English stakeholder digest of recent price movements
---
## Process Flow
```mermaid
flowchart LR
A[Raw CSV\nprices.csv] --> B[pipeline.py\nClean & Validate]
B --> C[SQLite DB\nprices.db]
C --> D[Streamlit Dashboard\napp.py]
D --> E[Charts & KPIs]
D --> F[Claude API\nAI Digest]
F --> G[Stakeholder Summary]
```
---
## Project Structure
```
egypt-price-tracker/
βββ data/
β βββ prices.csv # Raw price data (manually collected)
β βββ prices.db # SQLite database (generated by pipeline)
βββ scripts/
β βββ pipeline.py # Data cleaning, validation, SQL storage
βββ dashboard/
β βββ app.py # Streamlit dashboard + AI digest
βββ requirements.txt
βββ README.md
```
---
## Quickstart
```bash
# 1. Install dependencies
pip install -r requirements.txt
# 2. Run the data pipeline (cleans CSV β builds SQLite DB)
python scripts/pipeline.py
# 3. Launch the dashboard
ANTHROPIC_API_KEY=your_key_here streamlit run dashboard/app.py
```
> The dashboard works without an API key β the AI digest button is disabled if no key is set.
---
## Sample SQL Queries
```sql
-- Average price per category
SELECT category, ROUND(AVG(price_egp), 2) AS avg_price
FROM prices
GROUP BY category
ORDER BY av β¦