Scripts for processing MBTA performance data both from LAMP and from monthly historical files
- Python 3.14 (with mise:
mise trust && mise install, pinned in.python-version) - uv - Fast Python package manager
- Install:
curl -LsSf https://astral.sh/uv/install.sh | sh - Verify:
uv --version
- Install:
-
Install dependencies:
uv sync --group dev
-
Set up pre-commit hooks:
uv run pre-commit install
-
Configure AWS credentials (required for running locally):
- Add
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYto your shell environment, OR - Configure with awscli:
aws configure
- Add
Run tests with pytest. The bus segment tests need the geo dependency group, and the PMTiles tests also need tippecanoe (they're skipped without it):
uv sync --group dev --group geo
uv run pytest mbta-performanceCheck code style with Ruff:
uv run ruff check mbta-performance
uv run ruff format mbta-performanceIf you want more verbose logging and debug info, export DEBUG as log level. However this will heavily pollute logs with s3transfer and botocore logs.
export LOG_LEVEL="DEBUG"GTFS feeds are cached locally (data/gtfs_archives/ for historic, ./feeds for LAMP backfills). To share one cache with other TransitMatters repos, point GTFS_DATA_DIR at a common directory; archives go in $GTFS_DATA_DIR/gtfs_archives and sqlite feeds in $GTFS_DATA_DIR/sqlite_feeds.
export GTFS_DATA_DIR="$HOME/transitmatters-gtfs"uv run python -m mbta-performance.chalicelib.lamp.ingestuv run python -m mbta-performance.chalicelib.lamp.backfill.mainMonthly updates for rapid transit, bus, and ferry use their own runbook, covering processing, S3 upload, verification, and the dashboard follow-ups. See mbta-performance/chalicelib/historic/README.md.
uv run python -m mbta-performance.chalicelib.historic.status