reaumur777/economic_monitor
0
Economic Monitor
A comprehensive economic dashboard tracking 170+ indicators across monetary policy, inflation, labor markets, credit conditions, equity markets, commodities, and currencies.
Architecture
Setup
1. Supabase
- Create a new Supabase project called "Economic Monitor"
- Go to SQL Editor and run the contents of
supabase_setup.sql - Create a user in Authentication → Users for dashboard login
- Copy your Project URL and service role key from Settings → API
2. Environment Variables
For local fetch scripts, create a .env file (never commit this):
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-service-role-key
FRED_API_KEY=your-fred-api-keyOr set in your shell:
export SUPABASE_URL=https://your-project.supabase.co
export SUPABASE_KEY=your-service-role-key
export FRED_API_KEY=your-fred-api-keyFor Hugging Face Spaces, set these in your Space Settings → Secrets:
SUPABASE_URLSUPABASE_KEY← use the anon key here (read-only, RLS protected)
3. Initial Data Fetch
# Install dependencies
pip install -r requirements.txt
# Fetch all data (takes ~5-10 minutes on first run)
python main_supabase.py fetch
# Fetch specific source
python main_supabase.py fetch --source fred
python main_supabase.py fetch --source yahoo
# Fetch only high-priority tiers
python main_supabase.py fetch --tiers 1 2
# Check status
python main_supabase.py status4. Daily Fetch (Morning Routine)
Run each morning to keep data current:
python main_supabase.py fetchOr add to crontab (runs at 7am):
0 7 * * * cd /path/to/economic_monitor && python main_supabase.py fetch5. Deploy to Hugging Face Spaces
- Push this repo to GitHub
- Create a new HF Space:
- SDK: Streamlit
- Link your GitHub repo
- Add secrets in Space settings (SUPABASEURL, SUPABASEKEY)
- HF Spaces will auto-deploy on every push to main
Dashboard Tabs
File Structure
economic_monitor/
├── app.py # Streamlit dashboard (HF Spaces entry point)
├── main_supabase.py # CLI for local data fetching
├── database_supabase.py # Supabase database manager
├── processors.py # Data transforms & analytics (unchanged)
├── fred.py # FRED API collector (unchanged)
├── yahoo.py # Yahoo Finance collector (unchanged)
├── supabase_setup.sql # Run once in Supabase SQL Editor
├── requirements.txt # Python dependencies
├── config/
│ ├── indicators.yaml # All 170+ indicator definitions
│ └── api_keys.yaml # Local API keys (not committed)
└── README.mdNotes
- The service role key is for local fetch scripts only (has write access)
- The anon key is for HF Spaces (read-only, protected by RLS)
- Supabase Row Level Security ensures only authenticated users can view data
- Data is cached for 5 minutes in the dashboard (
@st.cache_data(ttl=300)) - First fetch of full history since 2000 takes ~5-10 minutes
