How pratyushwinorlearn/delhi-traffic-tracker works
Delhi Rain Choke Points collects rainfall and traffic observations at configured Delhi locations, stores samples, and compares rainy and dry congestion by matched hour/day buckets to rank hotspots. The repository also includes a Streamlit multiplier dashboard and a separate Next.js live map with location history. The README describes SQLite, while the sampled storage.py implements PostgreSQL and analyze.py refers to a DB_FILE not present in that excerpt; those storage paths may reflect a repository inconsistency. The map/API and analytics features are shown separately where their wiring is evidenced.
Main entry points: page.tsx Live map UI · collector.py Collector pass · traffic.py Traffic fetcher · analyze.py Multiplier analysis
Components 17
Sample collection
- Collector pass
collector.py - Hotspot locations
config/locations.json - Traffic fetcher
traffic.py
Multiplier analysis
- Multiplier analysis
analyze.py
Web views
- Streamlit dashboard
dashboard.py - Live map UI
delhi-traffic-map/app/page.tsx - Latest traffic API
delhi-traffic-map/app/api/traffic/route.js - Location history API
delhi-traffic-map/app/api/history/route.js
Data storage
- Sample storage
storage.py - PostgreSQL samples
Other components
- Scheduled runner
- Open-Meteo
- TomTom Flow API
- Web visitor
- Leaflet assets
- TomTom map tiles
- Chart rendering
Connections 17
- Scheduled runner → Collector pass: runs
- Collector pass → Hotspot locations: loads
- Collector pass → Open-Meteo: requests weather
- Collector pass → Traffic fetcher: calls
- Traffic fetcher → TomTom Flow API: requests flow
- Collector pass → Sample storage: inserts samples
- Sample storage → PostgreSQL samples: writes
- Streamlit dashboard → Multiplier analysis: loads and computes
- Multiplier analysis → PostgreSQL samples: reads samples
- Web visitor → Live map UI: opens
- Live map UI → Latest traffic API: fetches latest
- Live map UI → Location history API: fetches history
- Latest traffic API → PostgreSQL samples: queries latest
- Location history API → PostgreSQL samples: queries history
- Live map UI → Leaflet assets: loads assets
- Live map UI → TomTom map tiles: requests tiles
- Live map UI → Chart rendering: renders history