Sajid-ul-Islam/Global-Economical-Analytics
๐ EconVision โ Global Economic Intelligence Dashboard
A full-stack data science portfolio project built on real economic data: live World Bank + FRED APIs, ML forecasting, AI chat agent, and interactive multi-country analysis. Deployed on Streamlit Cloud.
Live App: global-economics.streamlit.app
Features
Pages
Architecture
econ-dashboard/
โโโ app.py # Entry point + routing
โโโ pages/
โ โโโ Dashboard.py # KPIs, timelines, anomalies, health scores
โ โโโ Compare.py # Bar charts, correlation, rankings, what-if
โ โโโ World_Map.py # Choropleth world map with risk categories
โ โโโ Data_Lab.py # Provenance, freshness, verification, export, AI agent tab
โ โโโ Macro_Trends.py # USD purchasing power + precious metals
โโโ components/
โ โโโ charts.py # All Plotly components (timeline, bar, gauge, correlation, debt classify)
โโโ utils/
โ โโโ data_fetcher.py # World Bank + FRED APIs, static debt CSV loader
โ โโโ database.py # Supabase CRUD (upsert, fetch, freshness, query log)
โ โโโ forecasting.py # Prophet + linear fallback, anomaly detection, health score
โ โโโ agent.py # Claude RAG: context builder, semantic cache, model router
โ โโโ ui.py # Sidebar (countries, indicators, year range) + CSS theme
โโโ data/
โ โโโ global_debt_2024.csv # 173-country static debt snapshot (IMF/WB 2024)
โโโ .streamlit/
โ โโโ config.toml # Dark theme config
โ โโโ secrets.toml.example # Keys template
โโโ agent.md # AI Agent architecture documentation
โโโ skill.md # Analytical skills documentation
โโโ Dockerfile # Container build
โโโ docker-compose.yml # Local container stack
โโโ requirements.txt
โโโ packages.txtData Sources
Setup
1. Create Supabase tables
Go to supabase.com โ new project โ SQL Editor and run:
CREATE TABLE IF NOT EXISTS economic_data (
id BIGSERIAL PRIMARY KEY,
country_code VARCHAR(3) NOT NULL,
country_name TEXT NOT NULL,
indicator VARCHAR(50) NOT NULL,
year INTEGER NOT NULL,
value FLOAT,
source TEXT,
fetched_at TIMESTAMPTZ DEFAULT NOW(),
verified_at TIMESTAMPTZ,
UNIQUE (country_code, indicator, year)
);
CREATE TABLE IF NOT EXISTS predictions (
id BIGSERIAL PRIMARY KEY,
country_code VARCHAR(3) NOT NULL,
indicator VARCHAR(50) NOT NULL,
year INTEGER NOT NULL,
predicted FLOAT NOT NULL,
lower_bound FLOAT,
upper_bound FLOAT,
model TEXT DEFAULT 'prophet',
created_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE (country_code, indicator, year, model)
);
CREATE TABLE IF NOT EXISTS data_freshness (
id BIGSERIAL PRIMARY KEY,
country_code VARCHAR(3) NOT NULL,
indicator VARCHAR(50) NOT NULL,
last_fetched TIMESTAMPTZ DEFAULT NOW(),
last_verified TIMESTAMPTZ,
status TEXT DEFAULT 'ok',
UNIQUE (country_code, indicator)
);
CREATE TABLE IF NOT EXISTS query_log (
id BIGSERIAL PRIMARY KEY,
query TEXT NOT NULL,
response TEXT,
created_at TIMESTAMPTZ DEFAULT NOW()
);Copy your Project URL and anon/public key from Settings โ API.
2. Local development
git clone https://github.com/Sajid-ul-Islam/econmical-dashboard.git
cd econ-dashboard
pip install -r requirements.txt
cp .streamlit/secrets.toml.example .streamlit/secrets.toml
# Fill in your keys, then:
streamlit run app.py3. Streamlit Cloud deployment
- Push to GitHub.
- Go to share.streamlit.io โ connect repo โ main file:
app.py. - Under Advanced Settings โ Secrets, paste:
[supabase]
url = "https://xxxx.supabase.co"
key = "your-anon-key"
[anthropic]
api_key = "sk-ant-..."
groq_key = "gsk_..."
openrouter_key = "sk-or-..."
huggingface_key = "hf_..."
[fred]
api_key = "your-fred-key"- Deploy.
4. Docker (optional)
docker-compose up --build
# App runs at http://localhost:8501AI Agent
The agent uses In-Context RAG โ it serialises the currently loaded DataFrame into a structured prompt and sends it with every query. No vector database required. It tries four providers in order (Claude โ Groq โ Gemini โ OpenRouter) and reports which model answered. A TF-IDF semantic cache (threshold 0.97) avoids redundant API calls for repeated questions.
See `agent.md` for full architecture details.
Analytical Skills
See `skill.md` for detailed documentation of all 9 analytical capabilities:
- ML Time-Series Forecasting (Prophet + fallback)
- Statistical Anomaly Detection (Z-score)
- Composite Economic Health Scoring (4-factor)
- Scenario Simulation / What-If Analysis
- Cross-Source Verification (drift detection)
- 3D Multivariate Animation
- Debt Risk Classification (5-tier)
- USD Purchasing Power Erosion
- Precious Metals Comparison (Gold vs Silver)
Sources: World Bank Open Data ยท FRED (Federal Reserve Bank of St. Louis) ยท IMF/WB debt estimates ยท BLS CPI data ยท Anthropic Claude
