feat(transit): let a feed name its own modes, and call TTC trams streetcars

A Toronto 501 and a Helsinki 1010 are both the `tram` mode. Only one of
them is called a tram by the people who ride it, and the detection label
is documented as "what a person standing at the stop would call it".

So the mode stays shared — same silhouette, same speed limits — and a
registry entry may carry `modeWords` naming the modes it runs. Everything
without an override falls through to the shared table, so this renames one
word for one operator and nothing else.

Threading the feed to the detection metric needed a resolver in queries.js,
since the cached-contact path has only the entry. It answers from live feeds
first, so a feed disabled mid-session stops supplying vocabulary.
This commit is contained in:
Cliff Flood committed 2026-10-15 20:18:15 -04:00
1 parent c5f7fe285b
commit 9fc4a5ac04
4 files changed
+125 -9

No files matched your search

+6
View File
@@ -304,6 +304,12 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([
note: 'The City publishes this endpoint from the TTC BusTime NVAS catalogue entry, whose own licence field reads \"License not specified\"; the quote above is the portal-wide Open Government Licence \u2013 Toronto the City applies to its open data, so the credit carries the licence name the way the Metro Transit entry carries its public-domain note. BusTime is the surface system: buses and streetcars report real positions, the subway reports none, so Lines 1/2/4 are simply absent rather than inferred. The endpoint sends no ETag or Last-Modified, so conditional requests fall through to the proxy snapshot TTL.',
}),
defaultMode: 'bus',
// Toronto rides streetcars. The vehicles are the shared `tram` mode and
// share its silhouette and speed limits; only the word a reader sees
// changes, because "tram" is not what anyone at Queen and Spadina says.
modeWords: Object.freeze({
tram: Object.freeze({ word: 'Streetcar', abbr: 'STREETCAR' }),
}),
routeMode: ttcRouteMode,
}),
]);