mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-12 14:22:21 +00:00
Tighten the Rio comments, notes and credits
Name each Rio feed in its credit instead of repeating the licence, drop the deprecation history from the bus note, list Rio among the feeds with a route-name table, and shorten the route-table header and test comments.
This commit is contained in:
1 parent
017a3bc99c
commit
b5cef8daf4
5 files changed
+17
-30
No files matched your search
@@ -1,21 +1,11 @@
|
||||
// src/data/rioRouteNames.js
|
||||
/**
|
||||
* Rio de Janeiro route ids to the line a rider would say.
|
||||
*
|
||||
* SMTR's realtime feeds publish internal route keys: the bus feed sends
|
||||
* `O0868AAA0A` for line 868 and `O0731AAN0A` for SN731, and the BRT feed
|
||||
* sends `20000501110` for line 50. The keys look decodable but are not:
|
||||
* `O0014AAA0A` is LECD135, not 14, and nineteen of the plain-looking keys in
|
||||
* the published table break the pattern. The join is the only correct route.
|
||||
*
|
||||
* Generated verbatim (`route_id` to `route_short_name`, 494 routes) from
|
||||
* `routes.txt` in SMTR's static GTFS, https://dados.mobilidade.rio/gtfs/schedule
|
||||
* (CC BY 4.0, the same publisher and terms as the realtime feeds; file dated
|
||||
* 2026-06-10, feed valid 2024-01-01 to 2026-12-31). A 2026-11-04 snapshot of
|
||||
* both realtime feeds, 282 bus and 21 BRT routes in service, found every one
|
||||
* of its route ids here. An id missing from this table falls through
|
||||
* unchanged, so a route added later degrades to its raw key rather than
|
||||
* disappearing.
|
||||
* SMTR's realtime feeds send internal keys (`O0731AAN0A` is SN731,
|
||||
* `20000501110` is BRT line 50). They look decodable but are not:
|
||||
* `O0014AAA0A` is LECD135, not 14. The table is copied from `routes.txt` in
|
||||
* SMTR's static GTFS (https://dados.mobilidade.rio/gtfs/schedule, CC BY 4.0),
|
||||
* valid to 2026-12-31. An id missing here renders as its raw key.
|
||||
*/
|
||||
export const RIO_ROUTE_NAMES = Object.freeze({
|
||||
20000101130: '10',
|
||||
|
||||
@@ -378,8 +378,8 @@ function burlingtonRouteLabel(routeId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Rio route key to the line a rider would say, for both SMTR feeds: one
|
||||
* published `routes.txt` covers the buses and the BRT (see rioRouteNames.js).
|
||||
* Rio route key to the line a rider would say. One SMTR `routes.txt` covers
|
||||
* both feeds (see rioRouteNames.js).
|
||||
* @param {string|null} routeId
|
||||
* @returns {string|null}
|
||||
*/
|
||||
@@ -755,12 +755,12 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([
|
||||
license: 'CC BY 4.0',
|
||||
licenseUrl:
|
||||
'https://www.data.rio/documents/997bc16cc4344a5cb0e48ab06cbdfd1f',
|
||||
attribution: 'SMTR / Prefeitura da Cidade do Rio de Janeiro (CC BY 4.0)',
|
||||
attribution: 'SMTR / Prefeitura da Cidade do Rio de Janeiro — buses (SPPO)',
|
||||
defaultEnabled: true,
|
||||
terms: Object.freeze({
|
||||
quote:
|
||||
'This work is licensed under a Creative Commons Attribution 4.0 International License',
|
||||
note: 'The data.rio catalog page labels the feed [beta] and states a gateway limit of 5 requests a second and 60 a minute behind a 10-second cache, which the 15-second proxy TTL stays inside. It is the named replacement for the JSON GPS endpoints SMTR deprecated on 2026-10-07 and says it will switch off by 2026-11-30. SMTR relays the concessionaires’ ITS data and repairs trips with its own matching; the page places accuracy with the suppliers. Speeds are m/s, as the spec requires: on 2026-11-05 they matched how far vehicles moved between reports, though a 2026-10-29 snapshot read as km/h. Route ids are internal keys (`O0731AAN0A` is line SN731) and are joined to the line names in SMTR’s published GTFS `routes.txt`, under the same CC BY 4.0 terms.',
|
||||
note: 'The data.rio catalog page labels the feed [beta] and states a gateway limit of 5 requests a second and 60 a minute behind a 10-second cache, which the 15-second proxy TTL stays inside. SMTR relays the concessionaires’ ITS data and repairs trips with its own matching; the page places accuracy with the suppliers. Speeds are m/s, as the spec requires: checked against vehicle movement on 2026-11-05, though a 2026-10-29 snapshot read as km/h. Line names come from SMTR’s GTFS `routes.txt`, under the same CC BY 4.0 terms.',
|
||||
}),
|
||||
defaultMode: 'bus',
|
||||
routeLabel: rioRouteLabel,
|
||||
@@ -777,12 +777,13 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([
|
||||
license: 'CC BY 4.0',
|
||||
licenseUrl:
|
||||
'https://www.data.rio/documents/8bb196cc02174d25b77437bb2f6443d4',
|
||||
attribution: 'SMTR / Prefeitura da Cidade do Rio de Janeiro (CC BY 4.0)',
|
||||
attribution:
|
||||
'SMTR / Prefeitura da Cidade do Rio de Janeiro — BRT (Mobi-Rio)',
|
||||
defaultEnabled: true,
|
||||
terms: Object.freeze({
|
||||
quote:
|
||||
'This work is licensed under a Creative Commons Attribution 4.0 International License',
|
||||
note: 'Same catalog terms, [beta] label and gateway limits as the bus feed. The fleet is operated by Mobi-Rio and tracked by SONDA, whose data SMTR relays. Speeds are m/s here too. Route ids are opaque (`20000501110` is line 50) and are joined to the same `routes.txt` as the buses.',
|
||||
note: 'Same catalog terms, [beta] label and gateway limits as the bus feed. The fleet is operated by Mobi-Rio and tracked by SONDA, whose data SMTR relays. Speeds are m/s too. Line names come from the same `routes.txt`.',
|
||||
}),
|
||||
defaultMode: 'bus',
|
||||
routeLabel: rioRouteLabel,
|
||||
|
||||
@@ -506,9 +506,7 @@ test('Rio buses and BRT cover the city from Centro to Santa Cruz, and not São P
|
||||
});
|
||||
|
||||
test('Rio route keys read as the line on the front of the bus', () => {
|
||||
// SMTR publishes internal keys. Plain keys carry the number (`O0868AAA0A`
|
||||
// is 868), variants carry a prefix (`O0731AAN0A` is SN731), and some plain
|
||||
// keys are traps: `O0014AAA0A` is LECD135, so the table is joined, not parsed.
|
||||
// Some keys look parseable and are not (`O0014AAA0A` is LECD135).
|
||||
const buses = getTransitFeed('smtr-rio-onibus');
|
||||
assert.equal(transitRouteLabel(buses, 'O0868AAA0A'), '868');
|
||||
assert.equal(transitRouteLabel(buses, 'O0731AAN0A'), 'SN731');
|
||||
@@ -518,8 +516,7 @@ test('Rio route keys read as the line on the front of the bus', () => {
|
||||
const brt = getTransitFeed('smtr-rio-brt');
|
||||
assert.equal(transitRouteLabel(brt, '20000501110'), '50');
|
||||
assert.equal(transitRouteLabel(brt, '20000EXEC1110'), 'ESP01');
|
||||
// A route added after the table was built keeps its raw key, never a blank
|
||||
// or a name borrowed from the prototype chain.
|
||||
// Unknown ids, prototype names included, keep their raw key.
|
||||
assert.equal(transitRouteLabel(buses, 'O9999AAA0A'), 'O9999AAA0A');
|
||||
assert.equal(transitRouteLabel(buses, 'constructor'), 'constructor');
|
||||
assert.equal(transitRouteLabel(brt, null), null);
|
||||
|
||||
@@ -286,8 +286,7 @@ test('the snapshot builder fills timestamps from the header it decoded', () => {
|
||||
});
|
||||
|
||||
test('Rio speeds pass through as the m/s they are published in', () => {
|
||||
// SMTR publishes m/s, as the spec requires: checked against how far
|
||||
// vehicles moved between reports on 2026-11-05.
|
||||
// Checked against vehicle movement on 2026-11-05.
|
||||
const bytes = encodeFeed({
|
||||
entities: [{ id: 'moving', lat: -22.9, lon: -43.2, speed: 10 }],
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user