Generate TransitMatters travel-time benchmarks for rapid transit#85
Open
devinmatte wants to merge 2 commits intomainfrom
Open
Generate TransitMatters travel-time benchmarks for rapid transit#85devinmatte wants to merge 2 commits intomainfrom
devinmatte wants to merge 2 commits intomainfrom
Conversation
Adds a new chalicelib/benchmarks module that builds TM-defined travel-time
benchmarks from the existing SlowZones archive (per-day p50 travel times and
dwells, back to 2016-01-15). A directed graph built from adjacent stop-pair
filenames is walked via DFS from each stop, summing per-day p50 move + dwell
series along each path. Intermediate dwells are included; origin dwell is not
(matches how t-performance-dash measures travel time: departure at origin to
arrival at destination).
The TM benchmark per pair is the median of the aligned per-day sums, ceil'd to
30s. Pairs with fewer than 365 aligned service-days are skipped. Output is one
small JSON per rapid-transit line at
s3://tm-mbta-performance/Benchmarks-tm/traveltimes/{Color}.json.
Scheduled monthly (historical p50 barely moves week-to-week). Can also be run
locally with AWS creds: `uv run python -m chalicelib.benchmarks.tm_benchmarks`.
6 tasks
devinmatte
commented
Apr 19, 2026
Local run across all 5 rapid-transit lines finishes in ~1m 45s with modest memory. 900s / 4096MB was overprovisioned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chalicelib/benchmarks/tm_benchmarks.py— computes TM-defined travel-time benchmarks per (from, to) stop pair for all rapid-transit lines, writing tos3://tm-mbta-performance/Benchmarks-tm/traveltimes/{Color}.json.SlowZones/*read +Benchmarks-tm/*write.How it works
For each rapid-transit line:
move(current→next) + dwell(current). Origin's dwell is skipped (the dashboard measures travel time from origin departure to destination arrival, which excludes origin dwell but includes every intermediate dwell).Running locally
Reads the SlowZones archive and writes the output JSONs directly. Cheaper than invoking the Lambda; intended for ad-hoc refreshes.
Cost impact
Negligible. Monthly lambda run over ~175 small CSVs per line, ~5–10 minutes total. One new IAM role, one new cron, five small JSON objects written to the existing bucket.
Test plan