VBB: don't shorten stop/station names 💥

This commit is contained in:
Jannis R 2021-12-29 18:16:51 +01:00
parent 5ecf03f349
commit d2bc134645
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
6 changed files with 50 additions and 54 deletions

View file

@ -1,6 +1,5 @@
'use strict' 'use strict'
const shorten = require('vbb-short-station-name')
const parseLineName = require('vbb-parse-line') const parseLineName = require('vbb-parse-line')
const parseTicket = require('vbb-parse-ticket') const parseTicket = require('vbb-parse-ticket')
const {parseHook} = require('../../lib/profile-hooks') const {parseHook} = require('../../lib/profile-hooks')
@ -77,7 +76,6 @@ const vbbProfile = {
parseLine: parseHook(_parseLine, parseLineWithMoreDetails), parseLine: parseHook(_parseLine, parseLineWithMoreDetails),
parseLocation: parseHook(_parseLocation, parseLocation), parseLocation: parseHook(_parseLocation, parseLocation),
parseStationName: (ctx, name) => shorten(name),
parseJourney: parseHook(_parseJourney, parseJourneyWithTickets), parseJourney: parseHook(_parseJourney, parseJourneyWithTickets),
parseDeparture: parseHook(_parseDeparture, parseDepartureRenameRingbahn), parseDeparture: parseHook(_parseDeparture, parseDepartureRenameRingbahn),

View file

@ -16,7 +16,6 @@ const client = createClient(vbbProfile, 'my-awesome-program')
## Customisations ## Customisations
- parses *VBB*-specific products (such as *X-Bus*) - parses *VBB*-specific products (such as *X-Bus*)
- strips parts from station names that are unnecessary in the Berlin context
- parses line names to give more information (e.g. "Is it an express bus?") - parses line names to give more information (e.g. "Is it an express bus?")
- parses *VBB*-specific tickets - parses *VBB*-specific tickets
- renames *Ringbahn* line names to contain `⟳` and `⟲` - renames *Ringbahn* line names to contain `⟳` and `⟲`

View file

@ -62,8 +62,7 @@
"qs": "^6.6.0", "qs": "^6.6.0",
"slugg": "^1.2.0", "slugg": "^1.2.0",
"vbb-parse-line": "^1.0.0", "vbb-parse-line": "^1.0.0",
"vbb-parse-ticket": "^0.2.1", "vbb-parse-ticket": "^0.2.1"
"vbb-short-station-name": "^1.0.1"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^7.0.0", "eslint": "^7.0.0",

View file

@ -359,13 +359,13 @@ tap.test('nearby', async (t) => {
validate(t, nearby, 'locations', 'nearby') validate(t, nearby, 'locations', 'nearby')
t.equal(nearby[0].id, berlinerStr) t.equal(nearby[0].id, berlinerStr)
t.equal(nearby[0].name, 'U Berliner Str.') t.equal(nearby[0].name, 'U Berliner Str. (Berlin)')
t.ok(nearby[0].distance > 0) t.ok(nearby[0].distance > 0)
t.ok(nearby[0].distance < 100) t.ok(nearby[0].distance < 100)
const res = nearby.find(s => s.id === landhausstr) const res = nearby.find(s => s.id === landhausstr)
t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`) t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`)
t.equal(nearby[1].name, 'Landhausstr.') t.equal(nearby[1].name, 'Landhausstr. (Berlin)')
t.ok(nearby[1].distance > 100) t.ok(nearby[1].distance > 100)
t.ok(nearby[1].distance < 200) t.ok(nearby[1].distance < 200)

View file

@ -7,7 +7,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -197,13 +197,13 @@ module.exports = [
platform: '3', platform: '3',
plannedPlatform: '3', plannedPlatform: '3',
prognosisType: 'calculated', prognosisType: 'calculated',
direction: 'S Erkner', direction: 'S Erkner Bhf',
origin: null, origin: null,
destination: { destination: {
type: "stop", type: "stop",
id: "900310004", id: "900310004",
stationDHID: 'de:12067:900310004', stationDHID: 'de:12067:900310004',
name: "S Erkner", name: "S Erkner Bhf",
location: { location: {
type: "location", type: "location",
id: "900310004", id: "900310004",
@ -282,7 +282,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -527,7 +527,7 @@ module.exports = [
type: "stop", type: "stop",
id: "900005207", id: "900005207",
stationDHID: 'de:11000:900005207', stationDHID: 'de:11000:900005207',
name: "Philharmonie Süd", name: "Philharmonie Süd (Berlin)",
location: { location: {
type: "location", type: "location",
id: "900005207", id: "900005207",
@ -556,7 +556,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -746,7 +746,7 @@ module.exports = [
platform: null, platform: null,
plannedPlatform: null, plannedPlatform: null,
prognosisType: 'prognosed', prognosisType: 'prognosed',
direction: 'S+U Hermannstr.', direction: 'S+U Hermannstr. (Berlin)',
provenance: null, provenance: null,
line: { line: {
type: 'line', type: 'line',
@ -802,7 +802,7 @@ module.exports = [
type: "stop", type: "stop",
id: "900079221", id: "900079221",
stationDHID: 'de:11000:900079221', stationDHID: 'de:11000:900079221',
name: "S+U Hermannstr.", name: "S+U Hermannstr. (Berlin)",
location: { location: {
type: "location", type: "location",
id: "900079221", id: "900079221",
@ -831,7 +831,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -1077,7 +1077,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900096197', id: '900096197',
stationDHID: 'de:11000:900096197', stationDHID: 'de:11000:900096197',
name: 'S+U Wittenau [U8]', name: 'S+U Wittenau (Berlin) [U8]',
location: { location: {
type: 'location', type: 'location',
id: '900096197', id: '900096197',
@ -1106,7 +1106,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -1296,7 +1296,7 @@ module.exports = [
platform: '4', platform: '4',
plannedPlatform: '4', plannedPlatform: '4',
prognosisType: 'calculated', prognosisType: 'calculated',
direction: 'S Westkreuz', direction: 'S Westkreuz (Berlin)',
provenance: null, provenance: null,
line: { line: {
type: 'line', type: 'line',
@ -1352,7 +1352,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900024102', id: '900024102',
stationDHID: 'de:11000:900024102', stationDHID: 'de:11000:900024102',
name: 'S Westkreuz', name: 'S Westkreuz (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900024102', id: '900024102',
@ -1381,7 +1381,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -1571,7 +1571,7 @@ module.exports = [
platform: '3', platform: '3',
plannedPlatform: '3', plannedPlatform: '3',
prognosisType: 'calculated', prognosisType: 'calculated',
direction: 'S Ahrensfelde', direction: 'S Ahrensfelde Bhf (Berlin)',
provenance: null, provenance: null,
line: { line: {
type: 'line', type: 'line',
@ -1627,7 +1627,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900170004', id: '900170004',
stationDHID: 'de:11000:900170004', stationDHID: 'de:11000:900170004',
name: 'S Ahrensfelde', name: 'S Ahrensfelde Bhf (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900170004', id: '900170004',
@ -1656,7 +1656,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -1931,7 +1931,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -2121,7 +2121,7 @@ module.exports = [
platform: '3', platform: '3',
plannedPlatform: '3', plannedPlatform: '3',
prognosisType: 'calculated', prognosisType: 'calculated',
direction: 'S Strausberg', direction: 'S Strausberg Bhf',
provenance: null, provenance: null,
line: { line: {
type: 'line', type: 'line',
@ -2177,7 +2177,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900320004', id: '900320004',
stationDHID: 'de:12064:900320004', stationDHID: 'de:12064:900320004',
name: 'S Strausberg', name: 'S Strausberg Bhf',
location: { location: {
type: 'location', type: 'location',
id: '900320004', id: '900320004',
@ -2206,7 +2206,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -2396,7 +2396,7 @@ module.exports = [
platform: null, platform: null,
plannedPlatform: null, plannedPlatform: null,
prognosisType: 'prognosed', prognosisType: 'prognosed',
direction: 'S+U Hermannstr.', direction: 'S+U Hermannstr. (Berlin)',
provenance: null, provenance: null,
line: { line: {
type: 'line', type: 'line',
@ -2452,7 +2452,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900079221', id: '900079221',
stationDHID: 'de:11000:900079221', stationDHID: 'de:11000:900079221',
name: 'S+U Hermannstr.', name: 'S+U Hermannstr. (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900079221', id: '900079221',
@ -2481,7 +2481,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -2671,7 +2671,7 @@ module.exports = [
platform: null, platform: null,
plannedPlatform: null, plannedPlatform: null,
prognosisType: 'prognosed', prognosisType: 'prognosed',
direction: 'U Paracelsus-Bad', direction: 'U Paracelsus-Bad (Berlin)',
provenance: null, provenance: null,
line: { line: {
type: 'line', type: 'line',
@ -2727,7 +2727,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900085104', id: '900085104',
stationDHID: 'de:11000:900085104', stationDHID: 'de:11000:900085104',
name: 'U Paracelsus-Bad', name: 'U Paracelsus-Bad (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900085104', id: '900085104',
@ -2756,7 +2756,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -3001,7 +3001,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900120004', id: '900120004',
stationDHID: 'de:11000:900120004', stationDHID: 'de:11000:900120004',
name: 'S+U Warschauer Str.', name: 'S+U Warschauer Str. (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900120004', id: '900120004',
@ -3030,7 +3030,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900100004', id: '900100004',
stationDHID: 'de:11000:900100004', stationDHID: 'de:11000:900100004',
name: 'S+U Jannowitzbrücke', name: 'S+U Jannowitzbrücke (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900100004', id: '900100004',
@ -3220,7 +3220,7 @@ module.exports = [
platform: '4', platform: '4',
plannedPlatform: '4', plannedPlatform: '4',
prognosisType: 'calculated', prognosisType: 'calculated',
direction: 'S Spandau', direction: 'S Spandau Bhf (Berlin)',
provenance: null, provenance: null,
line: { line: {
type: 'line', type: 'line',
@ -3276,7 +3276,7 @@ module.exports = [
type: 'stop', type: 'stop',
id: '900029101', id: '900029101',
stationDHID: 'de:11000:900029101', stationDHID: 'de:11000:900029101',
name: 'S Spandau', name: 'S Spandau Bhf (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900029101', id: '900029101',

View file

@ -6,7 +6,7 @@ module.exports = [{
origin: { origin: {
type: 'stop', type: 'stop',
id: '900042101', id: '900042101',
name: 'U Spichernstr.', name: 'U Spichernstr. (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900042101', id: '900042101',
@ -26,7 +26,7 @@ module.exports = [{
destination: { destination: {
type: 'stop', type: 'stop',
id: '900001201', id: '900001201',
name: 'S+U Westhafen', name: 'S+U Westhafen (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900001201', id: '900001201',
@ -74,7 +74,7 @@ module.exports = [{
express: false, express: false,
night: false, night: false,
}, },
direction: 'U Osloer Str.', direction: 'U Osloer Str. (Berlin)',
arrivalPlatform: null, arrivalPlatform: null,
plannedArrivalPlatform: null, plannedArrivalPlatform: null,
departurePlatform: null, departurePlatform: null,
@ -84,7 +84,7 @@ module.exports = [{
origin: { origin: {
type: 'stop', type: 'stop',
id: '900001201', id: '900001201',
name: 'S+U Westhafen', name: 'S+U Westhafen (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900001201', id: '900001201',
@ -104,7 +104,7 @@ module.exports = [{
destination: { destination: {
type: 'stop', type: 'stop',
id: '900007102', id: '900007102',
name: 'S+U Gesundbrunnen', name: 'S+U Gesundbrunnen Bhf (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900007102', id: '900007102',
@ -162,7 +162,7 @@ module.exports = [{
origin: { origin: {
type: 'stop', type: 'stop',
id: '900007102', id: '900007102',
name: 'S+U Gesundbrunnen', name: 'S+U Gesundbrunnen Bhf (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900007102', id: '900007102',
@ -182,7 +182,7 @@ module.exports = [{
destination: { destination: {
type: 'stop', type: 'stop',
id: '900350127', id: '900350127',
name: 'Eberswalde, Hbf', name: 'Eberswalde, Hauptbahnhof',
location: { location: {
type: 'location', type: 'location',
id: '900350127', id: '900350127',
@ -226,7 +226,7 @@ module.exports = [{
express: false, express: false,
night: false, night: false,
}, },
direction: 'Ostseebad Binz, Bhf', direction: 'Ostseebad Binz, Bahnhof',
arrivalPlatform: '3', arrivalPlatform: '3',
plannedArrivalPlatform: '3', plannedArrivalPlatform: '3',
departurePlatform: '10', departurePlatform: '10',
@ -306,7 +306,7 @@ module.exports = [{
origin: { origin: {
type: 'stop', type: 'stop',
id: '900042101', id: '900042101',
name: 'U Spichernstr.', name: 'U Spichernstr. (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900042101', id: '900042101',
@ -326,7 +326,7 @@ module.exports = [{
destination: { destination: {
type: 'stop', type: 'stop',
id: '900001201', id: '900001201',
name: 'S+U Westhafen', name: 'S+U Westhafen (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900001201', id: '900001201',
@ -374,7 +374,7 @@ module.exports = [{
express: false, express: false,
night: false, night: false,
}, },
direction: 'U Osloer Str.', direction: 'U Osloer Str. (Berlin)',
arrivalPlatform: null, arrivalPlatform: null,
plannedArrivalPlatform: null, plannedArrivalPlatform: null,
departurePlatform: null, departurePlatform: null,
@ -384,7 +384,7 @@ module.exports = [{
origin: { origin: {
type: 'stop', type: 'stop',
id: '900001201', id: '900001201',
name: 'S+U Westhafen', name: 'S+U Westhafen (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900001201', id: '900001201',
@ -404,7 +404,7 @@ module.exports = [{
destination: { destination: {
type: 'stop', type: 'stop',
id: '900007102', id: '900007102',
name: 'S+U Gesundbrunnen', name: 'S+U Gesundbrunnen Bhf (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900007102', id: '900007102',
@ -463,7 +463,7 @@ module.exports = [{
origin: { origin: {
type: 'stop', type: 'stop',
id: '900007102', id: '900007102',
name: 'S+U Gesundbrunnen', name: 'S+U Gesundbrunnen Bhf (Berlin)',
location: { location: {
type: 'location', type: 'location',
id: '900007102', id: '900007102',
@ -483,7 +483,7 @@ module.exports = [{
destination: { destination: {
type: 'stop', type: 'stop',
id: '900350127', id: '900350127',
name: 'Eberswalde, Hbf', name: 'Eberswalde, Hauptbahnhof',
location: { location: {
type: 'location', type: 'location',
id: '900350127', id: '900350127',
@ -527,7 +527,7 @@ module.exports = [{
express: true, express: true,
night: false, night: false,
}, },
direction: 'Stralsund, Hbf', direction: 'Stralsund, Hauptbahnhof',
arrivalPlatform: '3', arrivalPlatform: '3',
plannedArrivalPlatform: '3', plannedArrivalPlatform: '3',
departurePlatform: '9', departurePlatform: '9',