How ahzengyang/mbta-weather-delay works
This repository collects MBTA delay, station, ridership, and weather data, stores processed data in Google Cloud Storage, and exposes API endpoints alongside a Streamlit dashboard. The principal analytical workflow is to acquire and normalize each source, join the hourly records by station and time, then explore delay/weather relationships with station and time filters. The README describes the intended dashboard capabilities; the Streamlit entry point is only 0.1 KB, so its implementation is not visible. Some API wiring is also omitted from the excerpts, and those connections are left out or marked unverified.
Main entry points: weather_openmeteo.py Weather fetch · combine_sources.py Hourly source join · mbta_weather_api.py Data API · gse_clean.py Hourly ridership
Components 18
Data collection
- LAMP delays
fastapi/fastapi_functions/source1_mbta_lamp_delay.py - GTFS stations
fastapi/fastapi_functions/station_data.py - ArcGIS ridership
fastapi/fastapi_functions/gse_fetch.py - Weather fetch
fastapi/fastapi_functions/weather_openmeteo.py
Processing
- Station metadata
fastapi/fastapi_functions/station_data.py - Hourly ridership
fastapi/fastapi_functions/gse_clean.py - Station IDs
fastapi/fastapi_functions/stations.py - Ridership pipeline
fastapi/fastapi_functions/run_pipeline.py - Delay panel
fastapi/fastapi_functions/source1_mbta_lamp_delay.py - Hourly source join
fastapi/combine_sources.py
API and storage
- Shared configuration
fastapi/fastapi_functions/user_definition.py - GCS storage
fastapi/fastapi_functions/gcs.py - Station upload
fastapi/mbta_weather_api.py - Data API
fastapi/mbta_weather_api.py
Analysis and exploration
- Dashboard
streamlit/main.py
Other components
- MBTA data
- Open-Meteo
- Analyst
Connections 21
- MBTA data → LAMP delays: publishes delays
README.md - MBTA data → GTFS stations: publishes GTFS
README.md - ArcGIS ridership → Hourly ridership: provides entries
fastapi/fastapi_functions/gse_fetch.py - Open-Meteo → Weather fetch: provides weather
fastapi/fastapi_functions/weather_openmeteo.py - GTFS stations → Station metadata: downloads feed
fastapi/mbta_weather_api.py - Station metadata → Data API: builds station table
fastapi/mbta_weather_api.py - Station IDs → Hourly ridership: filters stations
fastapi/fastapi_functions/gse_clean.py - Ridership pipeline → Hourly ridership: cleans hourly entries
fastapi/fastapi_functions/run_pipeline.py - Ridership pipeline → GCS storage: uploads CSV
fastapi/fastapi_functions/run_pipeline.py - LAMP delays → Delay panel: derives hourly panel
fastapi/fastapi_functions/source1_mbta_lamp_delay.py - Weather fetch → GCS storage: stores processed weather
fastapi/fastapi_functions/weather_openmeteo.py - Shared configuration → Weather fetch: configures fetch
fastapi/fastapi_functions/weather_openmeteo.py - Delay panel → Hourly source join: supplies delay data
fastapi/combine_sources.py - Station metadata → Hourly source join: supplies station data
fastapi/combine_sources.py - Hourly ridership → Hourly source join: supplies ridership
fastapi/combine_sources.py - Weather fetch → Hourly source join: supplies weather
fastapi/combine_sources.py - Data API → Weather fetch: fetches weather
fastapi/mbta_weather_api.py - Data API → GCS storage: uploads station data
fastapi/mbta_weather_api.py - Analyst → Dashboard: explores results
README.md - Dashboard → Data API: requests data
- Hourly source join → GCS storage: stores combined data