add remarks()

This commit is contained in:
Jannis R 2020-03-09 20:54:43 +01:00 committed by Jannis Redmann
parent 3e6d6d9917
commit ed48971fb1
10 changed files with 921 additions and 0 deletions

View file

@ -11,6 +11,7 @@
- [`nearby(location, [opt])`](nearby.md) show stations & POIs around
- [`radar(north, west, south, east, [opt])`](radar.md) find all vehicles currently in a certain area
- [`reachableFrom(address, [opt])`](reachable-from.md)  get all stations reachable from an address within `n` minutes
- [`remarks([opt])`](remarks.md) get all remarks
- [`serverInfo([opt])`](server-info.md) fetch meta information from HAFAS
## Migrating from an old `hafas-client` version

142
docs/remarks.md Normal file
View file

@ -0,0 +1,142 @@
# `remarks([opt])`
**Fetches all remarks known to the HAFAS endpoint**, e.g. warnings about disruptions, planned construction work, and general notices about the operating situation.
With `opt`, you can override the default options, which look like this:
```js
{
results: 100, // maximum number of remarks
// filter by time
from: Date.now(),
to: null,
products: null, // filter by affected products
language: 'en', // depends on the profile
}
```
## Example
As an example, we're going to use the [SVV profile](../p/svv):
```js
const createClient = require('hafas-client')
const svvProfile = require('hafas-client/p/svv')
const client = createClient(svvProfile, 'my-awesome-program')
console.log(await client.remarks())
```
```js
[
{
id: 'HIM_FREETEXT_110342',
type: 'warning',
summary: 'Bus will be running at different times',
text: 'Due to operational changes, this bus will be running at different times. We apologise for any inconvenience this may cause.',
priority: 50,
company: 'KGÖVV',
validFrom: '2020-07-04T00:00:00+02:00',
validUntil: '2020-08-09T23:59:00+02:00',
modified: '2020-07-01T14:39:12+02:00',
products: {
'bahn-s-bahn': true,
'u-bahn': true,
strassenbahn: true,
fernbus: true,
regionalbus: true,
stadtbus: true,
'seilbahn-zahnradbahn': true,
schiff: true,
},
categories: [1],
icon: {type: 'HIM1', title: null},
},
// …
{
id: 'HIM_FREETEXT_110235',
type: 'warning',
summary: 'Linie 7 - Umleitungen',
text: 'Aufgrund einer Baustelle gibt es bei der Linie 7 umfangreiche Umleitungen.',
priority: 100,
company: 'VOR',
validFrom: '2020-07-13T00:00:00+02:00',
validUntil: '2020-08-31T23:59:00+02:00',
modified: '2020-06-30T12:37:38+02:00',
affectedLines: [{
type: 'line',
id: '7',
name: '7',
public: true,
}],
products: {
'bahn-s-bahn': true,
'u-bahn': true,
strassenbahn: true,
fernbus: true,
regionalbus: true,
stadtbus: true,
'seilbahn-zahnradbahn': false,
schiff: true,
},
categories: [1],
icon: {type: 'HIM1', title: null},
},
// …
{
id: 'HIM_FREETEXT_106619',
type: 'warning',
summary: 'Stop Bad Hall Bahnhofstraße can not be approached',
text: 'The stop at Bad Hall Bahnhofstraße can not be approached during 21.04.-24.07.2020. Please use alternatively the stop at Bad Hall Busterminal (Abzw Bahnhofstraße).',
priority: 100,
company: 'OÖVG',
validFrom: '2020-04-21T00:00:00+02:00',
validUntil: '2020-07-24T23:59:00+02:00',
modified: '2020-07-08T12:52:13+02:00',
affectedLines: [{
type: 'line',
id: '452',
name: '452',
public: true,
}],
products: {
'bahn-s-bahn': false,
'u-bahn': false,
strassenbahn: false,
fernbus: false,
regionalbus: true,
stadtbus: false,
'seilbahn-zahnradbahn': false,
schiff: false
},
categories: [1],
icon: {type: 'HIM1', title: null},
},
// …
{
id: 'HIM_FREETEXT_106671',
type: 'warning',
summary: 'Neue Haltestellennamen',
text: 'Im Zuge der Neuordnung der Regionalbusverkehre werden mit 6.7.2020 neue Fahrpläne und Liniennummern wirksam und dadurch können sich mitunter die Haltestellennamen verändern.',
priority: 100,
company: 'VOR',
validFrom: '2020-04-21T00:00:00+02:00',
validUntil: '2020-09-30T23:59:00+02:00',
modified: '2020-04-21T13:20:41+02:00',
products: {
'bahn-s-bahn': true,
'u-bahn': true,
strassenbahn: true,
fernbus: true,
regionalbus: true,
stadtbus: true,
'seilbahn-zahnradbahn': false,
schiff: true,
},
categories: [4],
icon: {type: 'HIM4', title: null},
},
// …
]
```

34
format/remarks-req.js Normal file
View file

@ -0,0 +1,34 @@
'use strict'
const formatRemarksReq = (ctx) => {
const {profile, opt} = ctx
const himFltrL = []
// todo: https://github.com/marudor/BahnhofsAbfahrten/blob/95fef0217d01344642dd423457473fe9b8b6056e/src/types/HAFAS/index.ts#L76-L91
if (opt.products) {
himFltrL.push(profile.formatProductsFilter(ctx, opt.products))
}
const req = {
getPolyline: !!opt.polylines,
himFltrL,
}
// todo: stLoc, dirLoc
// todo: comp, dept, onlyHimId, onlyToday
// todo: dailyB, dailyE
// see https://github.com/marudor/BahnhofsAbfahrten/blob/46a74957d68edc15713112df44e1a25150f5a178/src/types/HAFAS/HimSearch.ts#L3-L18
if (opt.results !== null) req.maxNum = opt.results
if (opt.from !== null) {
req.dateB = profile.formatDate(profile, opt.from)
req.timeB = profile.formatTime(profile, opt.from)
}
if (opt.to !== null) {
req.dateE = profile.formatDate(profile, opt.to)
req.timeE = profile.formatTime(profile, opt.to)
}
return {meth: 'HimSearch', req}
}
module.exports = formatRemarksReq

View file

@ -22,6 +22,12 @@ const validateLocation = (loc, name = 'location') => {
}
}
const validateWhen = (when, name = 'when') => {
if (Number.isNaN(+when)) {
throw new TypeError(name + ' is invalid')
}
}
const createClient = (profile, userAgent, opt = {}) => {
profile = Object.assign({}, defaultProfile, profile)
validateProfile(profile)
@ -468,6 +474,34 @@ const createClient = (profile, userAgent, opt = {}) => {
})
}
const remarks = async (opt = {}) => {
opt = {
results: 100, // maximum number of remarks
// filter by time
from: Date.now(),
to: null,
products: null, // filter by affected products
...opt
}
if (opt.from !== null) {
opt.from = new Date(opt.from)
validateWhen(opt.from, 'opt.from')
}
if (opt.to !== null) {
opt.to = new Date(opt.to)
validateWhen(opt.to, 'opt.to')
}
const req = profile.formatRemarksReq({profile, opt})
const {
res, common,
} = await profile.request({profile, opt}, userAgent, req)
const ctx = {profile, opt, common, res}
return res.msgL.map(w => profile.parseWarning(ctx, w))
}
const serverInfo = async (opt = {}) => {
const {res, common} = await profile.request({profile, opt}, userAgent, {
meth: 'ServerInfo',
@ -494,6 +528,7 @@ const createClient = (profile, userAgent, opt = {}) => {
locations,
stop,
nearby,
remarks,
serverInfo,
}
if (profile.trip) client.trip = trip

View file

@ -10,6 +10,7 @@ const formatTripReq = require('../format/trip-req')
const formatRadarReq = require('../format/radar-req')
const formatReachableFromReq = require('../format/reachable-from-req')
const formatRefreshJourneyReq = require('../format/refresh-journey-req')
const formatRemarksReq = require('../format/remarks-req')
const parseDateTime = require('../parse/date-time')
const parsePlatform = require('../parse/platform')
@ -62,6 +63,7 @@ const defaultProfile = {
formatRadarReq,
formatReachableFromReq,
formatRefreshJourneyReq,
formatRemarksReq,
transformJourneysQuery: id,
parseDateTime,

332
test/fixtures/vsn-remarks.js vendored Normal file
View file

@ -0,0 +1,332 @@
'use strict'
module.exports = [
{
id: 'HIM_FREETEXT_14164',
type: 'warning',
summary: 'Hinweis zum Flughafenbus X15',
text: 'Der Flughafenbus X15 ist eine Linie der Regionalverkehr Münsterland GmbH (RVM). Es gilt der Westfalentarif. Infos gibt es online unter www.rvm-online.de sowie telefonisch unter der Rufnummer 0180 650 40 30.',
icon: { type: 'HIM0', title: null },
priority: 6,
company: 'VOS',
products: {
nationalExpress: true,
national: true,
regionalExpress: true,
regional: true,
suburban: true,
bus: true,
ferry: true,
subway: true,
tram: true,
anrufSammelTaxi: true
},
categories: [ 0 ],
edges: [
{
icoCrd: { x: 7875575, y: 52201492 },
icon: null,
fromLoc: null,
toLoc: null
}
],
events: [
{
fromLoc: null,
toLoc: null,
start: '2020-02-03T11:11:00+01:00',
end: '2020-12-13T00:00:00+01:00',
sections: []
}
],
affectedLines: [
{
type: 'line',
id: 'bus-x15',
fahrtNr: null,
name: 'Bus X15',
public: true
}
],
validFrom: '2020-02-03T11:11:00+01:00',
validUntil: '2020-12-13T00:00:00+01:00',
modified: '2020-02-03T11:24:29+01:00'
},
{
id: 'HIM_FREETEXT_9156',
type: 'warning',
summary: 'Sperrung Weserbrücke Lauenförde-Beverungen',
text: 'Aufgrund der Sperrung können die Haltestellen in Beverungen nicht bedient werden.\n' +
'<a href="http://www.vsninfo.de/de/verkehrsbehinderungen/landkreis-holzminden/554-556-sperrung-weserbruecke-lauenfoerde-beverungen" target="_blank" rel="noopener">Lauenförde-Beverungen</a>\n' +
'<a href="http://weserems.hafas.de/pdf/1558512346653_HOL_556_beide_FPL_Baustelle%20Beverungen.pdf" target="_blank" rel="noopener">Baustellenfahrplan Linie 556</a>',
icon: { type: 'HIM0', title: null },
priority: 6,
company: 'VSN',
products: {
nationalExpress: true,
national: true,
regionalExpress: true,
regional: true,
suburban: true,
bus: true,
ferry: true,
subway: true,
tram: true,
anrufSammelTaxi: true
},
categories: [ 0 ],
edges: [
{
icoCrd: { x: 9395422, y: 51748714 },
icon: null,
fromLoc: null,
toLoc: null
}
],
events: [
{
fromLoc: null,
toLoc: null,
start: '2019-12-15T00:00:00+01:00',
end: '2020-12-12T23:59:00+01:00',
sections: []
}
],
affectedLines: [
{
type: 'line',
id: 'bus-554',
fahrtNr: null,
name: 'Bus 554',
public: true
},
{
type: 'line',
id: 'bus-556',
fahrtNr: null,
name: 'Bus 556',
public: true
}
],
validFrom: '2019-12-15T00:00:00+01:00',
validUntil: '2020-12-12T23:59:00+01:00',
modified: '2019-12-09T13:55:14+01:00'
},
{
id: 'HIM_FREETEXT_9155',
type: 'warning',
summary: 'Sperrung Weserbrücke Lauenförde-Beverungen',
text: 'Aufgrund der Sperrung können die Haltestellen in Beverungen nicht bedient werden.\n' +
'<a href="http://www.vsninfo.de/de/verkehrsbehinderungen/landkreis-holzminden/554-556-sperrung-weserbruecke-lauenfoerde-beverungen" target="_blank" rel="noopener">Lauenförde-Beverungen</a>\n' +
'<a href="http://weserems.hafas.de/pdf/1558512267592_HOL_554_beide_FPL_Baustelle%20Beverungen.pdf" target="_blank" rel="noopener">Baustellenfahrplan Linie 554</a>',
icon: { type: 'HIM0', title: null },
priority: 6,
company: 'VSN',
products: {
nationalExpress: true,
national: true,
regionalExpress: true,
regional: true,
suburban: true,
bus: true,
ferry: true,
subway: true,
tram: true,
anrufSammelTaxi: true
},
categories: [ 0 ],
edges: [
{
icoCrd: { x: 9435051, y: 51783147 },
icon: null,
fromLoc: null,
toLoc: null
}
],
events: [
{
fromLoc: null,
toLoc: null,
start: '2019-12-15T00:00:00+01:00',
end: '2020-12-12T23:59:00+01:00',
sections: []
}
],
affectedLines: [
{
type: 'line',
id: 'bus-509',
fahrtNr: null,
name: 'Bus 509',
public: true
},
{
type: 'line',
id: 'bus-554',
fahrtNr: null,
name: 'Bus 554',
public: true
},
{
type: 'line',
id: 'bus-556',
fahrtNr: null,
name: 'Bus 556',
public: true
}
],
validFrom: '2019-12-15T00:00:00+01:00',
validUntil: '2020-12-12T23:59:00+01:00',
modified: '2019-12-09T13:55:45+01:00'
},
{
id: 'HIM_FREETEXT_14527',
type: 'warning',
summary: 'Verlegung einer Stromleitung in der Lindenstraße (Umleitung verschoben)',
text: 'Betrifft die Linien 91, 92, 94, N7\n' +
'\n' +
'Beginn der Umleitung verschoben auf voraussichtlich 16. März bis Juni 2020\n' +
'\n' +
'Die Bauarbeiten sollten ursprünglich bereits am 2. März beginnen. Ab diesem Datum wurde auch die Umleitung der Buslinien geplant. Bitte beachten Sie, dass die Fahrpläne an den Haltestellen sowie die Fahrplanauskunft im Internet ab 2. März den Bauplan anzeigen, obwohl die Busse bis zum Beginn der Bauarbeiten noch in der regulären Linienführung fahren.\n' +
'\n' +
'Umleitung ab Baubeginn:\n' +
'Die Linien 91, 92, 94 und N7 werden in Richtung Vegesack zwischen (H) Bf Blumenthal und (H) Bremer Vulkan über die Straßen Zur Westpier und Am Werfttor umgeleitet.\n' +
'\n' +
'Haltestellenänderungen in Richtung Vegesack:\n' +
'(H) Wätjens Park &gt; verlegt vor die Kreuzung Lüssumer Str./Zur Westpier\n' +
'(H) Margaretenallee &gt; entfällt \n',
icon: { type: 'HIM0', title: null },
priority: 6,
company: 'BSAG',
products: {
nationalExpress: false,
national: false,
regionalExpress: false,
regional: false,
suburban: false,
bus: true,
ferry: false,
subway: false,
tram: false,
anrufSammelTaxi: false
},
categories: [ 0 ],
events: [
{
fromLoc: null,
toLoc: null,
start: '2020-02-21T11:31:00+01:00',
end: '2020-06-30T23:59:00+02:00',
sections: []
}
],
affectedLines: [
{
type: 'line',
id: 'bus-91',
fahrtNr: null,
name: 'Bus 91',
public: true
},
{
type: 'line',
id: 'bus-92',
fahrtNr: null,
name: 'Bus 92',
public: true
},
{
type: 'line',
id: 'bus-94',
fahrtNr: null,
name: 'Bus 94',
public: true
},
{
type: 'line',
id: 'bus-n7',
fahrtNr: null,
name: 'Bus N7',
public: true
}
],
validFrom: '2020-02-21T11:31:00+01:00',
validUntil: '2020-06-30T23:59:00+02:00',
modified: '2020-02-21T11:34:47+01:00'
},
{
id: 'HIM_FREETEXT_14525',
type: 'warning',
summary: 'Verlegung einer Stromleitung in der Lindenstraße',
text: 'Betrifft die Linien 91, 92, 94, N7\n' +
'\n' +
'Beginn der Umleitung verschoben auf voraussichtlich 16. März bis Juni 2020\n' +
'\n' +
'Die Bauarbeiten sollten ursprünglich bereits am 2. März beginnen. Ab diesem Datum wurde auch die Umleitung der Buslinien geplant. Bitte beachten Sie, dass die Fahrpläne an den Haltestellen sowie die Fahrplanauskunft im Internet ab 2. März den Bauplan anzeigen, obwohl die Busse bis zum Beginn der Bauarbeiten noch in der regulären Linienführung fahren.\n' +
'\n' +
'Umleitung ab Baubeginn:\n' +
'Die Linien 91, 92, 94 und N7 werden in Richtung Vegesack zwischen (H) Bf Blumenthal und (H) Bremer Vulkan über die Straßen Zur Westpier und Am Werfttor umgeleitet.\n' +
'\n' +
'Haltestellenänderungen in Richtung Vegesack:\n' +
'(H) Wätjens Park &gt; verlegt vor die Kreuzung Lüssumer Str./Zur Westpier\n' +
'(H) Margaretenallee &gt; entfällt \n',
icon: { type: 'HIM0', title: null },
priority: 6,
company: 'BSAG',
products: {
nationalExpress: false,
national: false,
regionalExpress: false,
regional: false,
suburban: false,
bus: true,
ferry: false,
subway: false,
tram: false,
anrufSammelTaxi: false
},
categories: [ 0 ],
events: [
{
fromLoc: null,
toLoc: null,
start: '2020-02-21T11:01:00+01:00',
end: '2020-06-30T23:59:00+02:00',
sections: []
}
],
affectedLines: [
{
type: 'line',
id: 'bus-91',
fahrtNr: null,
name: 'Bus 91',
public: true
},
{
type: 'line',
id: 'bus-92',
fahrtNr: null,
name: 'Bus 92',
public: true
},
{
type: 'line',
id: 'bus-94',
fahrtNr: null,
name: 'Bus 94',
public: true
},
{
type: 'line',
id: 'bus-n7',
fahrtNr: null,
name: 'Bus N7',
public: true
}
],
validFrom: '2020-02-21T11:01:00+01:00',
validUntil: '2020-06-30T23:59:00+02:00',
modified: '2020-02-21T13:31:05+01:00'
}
]

346
test/fixtures/vsn-remarks.json vendored Normal file
View file

@ -0,0 +1,346 @@
{
"common": {
"locL": [
{
"lid": "A=1@O=Bremen Vereinsstraße@X=8606263@Y=53176363@U=80@L=9014254@",
"type": "S",
"name": "Bremen Vereinsstraße",
"icoX": 1,
"extId": "9014254",
"state": "F",
"crd": {
"x": 8606263,
"y": 53176363,
"layerX": 0,
"crdSysX": 0
},
"meta": true,
"pCls": 32,
"isMainMast": true
}
],
"prodL": [
{
"pid": "L::5::Bus::B1477578485::VOSRVM_X15::*",
"name": "Bus X15"
},
{
"pid": "L::5::Bus::B2667014228::de:VBN-VSN:554::*",
"name": "Bus 554"
},
{
"pid": "L::5::Bus::B2667014228::de:VBN-VSN:556::*",
"name": "Bus 556"
},
{
"pid": "L::5::Bus::B2667014228::de:VBN-VSN:509::*",
"name": "Bus 509"
},
{
"pid": "L::5::Bus::B3542973073::de:VBN:91::*",
"name": "Bus 91"
},
{
"pid": "L::5::Bus::B3542973073::de:VBN:92::*",
"name": "Bus 92"
},
{
"pid": "L::5::Bus::B3542973073::de:VBN:94::*",
"name": "Bus 94"
},
{
"pid": "L::5::Bus::B3542973073::de:VBN:N7::*",
"name": "Bus N7"
}
],
"polyL": [],
"layerL": [
{
"id": "standard",
"name": "standard",
"index": 0,
"annoCnt": 0
}
],
"crdSysL": [
{
"id": "standard",
"index": 0,
"type": "WGS84"
}
],
"opL": [],
"remL": [],
"icoL": [
{
"res": "HIM0"
},
{
"res": "prod_bus",
"fg": {
"r": 255,
"g": 255,
"b": 255
},
"bg": {
"r": 0,
"g": 92,
"b": 169
}
}
],
"himMsgEdgeL": [
{
"icoCrd": {
"x": 7875575,
"y": 52201492
}
},
{
"icoCrd": {
"x": 9395422,
"y": 51748714
}
},
{
"icoCrd": {
"x": 9435051,
"y": 51783147
}
}
],
"himMsgEventL": [
{
"fDate": "20200203",
"fTime": "111100",
"tDate": "20201213",
"tTime": "000000"
},
{
"fDate": "20191215",
"fTime": "000000",
"tDate": "20201212",
"tTime": "235900"
},
{
"fDate": "20200221",
"fTime": "113100",
"tDate": "20200630",
"tTime": "235900"
},
{
"fDate": "20200221",
"fTime": "110100",
"tDate": "20200630",
"tTime": "235900"
}
],
"himMsgCatL": [
{
"id": 0
}
]
},
"msgL": [
{
"hid": "HIM_FREETEXT_14164",
"act": true,
"head": "Hinweis zum Flughafenbus X15",
"lead": "Der Flughafenbus X15 ist eine Linie der Regionalverkehr Münsterland GmbH (RVM). Es gilt der Westfalentarif. Infos gibt es online unter www.rvm-online.de sowie telefonisch unter der Rufnummer 0180 650 40 30.",
"text": "Der Flughafenbus X15 ist eine Linie der Regionalverkehr Münsterland GmbH (RVM). Es gilt der Westfalentarif. Infos gibt es online unter www.rvm-online.de sowie telefonisch unter der Rufnummer 0180 650 40 30.",
"icoX": 0,
"prio": 6,
"prod": 16383,
"affProdRefL": [
0
],
"lModDate": "20200203",
"lModTime": "112429",
"sDate": "20200203",
"sTime": "111100",
"eDate": "20201213",
"eTime": "000000",
"sDaily": "000000",
"eDaily": "235900",
"comp": "VOS",
"catRefL": [
0
],
"pubChL": [
{
"name": "timetable",
"fDate": "20200203",
"fTime": "111100",
"tDate": "20201231",
"tTime": "235900"
}
],
"edgeRefL": [
0
],
"eventRefL": [
0
]
},
{
"hid": "HIM_FREETEXT_9156",
"act": true,
"head": "Sperrung Weserbrücke Lauenförde-Beverungen",
"text": "Aufgrund der Sperrung können die Haltestellen in Beverungen nicht bedient werden.<br><a href=\"http://www.vsninfo.de/de/verkehrsbehinderungen/landkreis-holzminden/554-556-sperrung-weserbruecke-lauenfoerde-beverungen\" target=\"_blank\" rel=\"noopener\">Lauenförde-Beverungen</a><br><a href=\"http://weserems.hafas.de/pdf/1558512346653_HOL_556_beide_FPL_Baustelle%20Beverungen.pdf\" target=\"_blank\" rel=\"noopener\">Baustellenfahrplan Linie 556</a>",
"icoX": 0,
"prio": 6,
"prod": 16383,
"affProdRefL": [
1,
2
],
"lModDate": "20191209",
"lModTime": "135514",
"sDate": "20191215",
"sTime": "000000",
"eDate": "20201212",
"eTime": "235900",
"sDaily": "000000",
"eDaily": "235900",
"comp": "VSN",
"catRefL": [
0
],
"pubChL": [
{
"name": "timetable",
"fDate": "20190522",
"fTime": "100100",
"tDate": "20201212",
"tTime": "235900"
}
],
"edgeRefL": [
1
],
"eventRefL": [
1
]
},
{
"hid": "HIM_FREETEXT_9155",
"act": true,
"head": "Sperrung Weserbrücke Lauenförde-Beverungen",
"text": "Aufgrund der Sperrung können die Haltestellen in Beverungen nicht bedient werden.<br><a href=\"http://www.vsninfo.de/de/verkehrsbehinderungen/landkreis-holzminden/554-556-sperrung-weserbruecke-lauenfoerde-beverungen\" target=\"_blank\" rel=\"noopener\">Lauenförde-Beverungen</a><br><a href=\"http://weserems.hafas.de/pdf/1558512267592_HOL_554_beide_FPL_Baustelle%20Beverungen.pdf\" target=\"_blank\" rel=\"noopener\">Baustellenfahrplan Linie 554</a>",
"icoX": 0,
"prio": 6,
"prod": 16383,
"affProdRefL": [
3,
1,
2
],
"lModDate": "20191209",
"lModTime": "135545",
"sDate": "20191215",
"sTime": "000000",
"eDate": "20201212",
"eTime": "235900",
"sDaily": "000000",
"eDaily": "235900",
"comp": "VSN",
"catRefL": [
0
],
"pubChL": [
{
"name": "timetable",
"fDate": "20190522",
"fTime": "100100",
"tDate": "20201212",
"tTime": "235900"
}
],
"edgeRefL": [
2
],
"eventRefL": [
1
]
},
{
"hid": "HIM_FREETEXT_14527",
"act": true,
"head": "Verlegung einer Stromleitung in der Lindenstraße (Umleitung verschoben)",
"text": "Betrifft die Linien 91, 92, 94, N7<br /><br />Beginn der Umleitung verschoben auf voraussichtlich 16. März bis Juni 2020<br /><br />Die Bauarbeiten sollten ursprünglich bereits am 2. März beginnen. Ab diesem Datum wurde auch die Umleitung der Buslinien geplant. Bitte beachten Sie, dass die Fahrpläne an den Haltestellen sowie die Fahrplanauskunft im Internet ab 2. März den Bauplan anzeigen, obwohl die Busse bis zum Beginn der Bauarbeiten noch in der regulären Linienführung fahren.<br /><br />Umleitung ab Baubeginn:<br />Die Linien 91, 92, 94 und N7 werden in Richtung Vegesack zwischen (H) Bf Blumenthal und (H) Bremer Vulkan über die Straßen Zur Westpier und Am Werfttor umgeleitet.<br /><br />Haltestellenänderungen in Richtung Vegesack:<br />(H) Wätjens Park &gt; verlegt vor die Kreuzung Lüssumer Str./Zur Westpier<br />(H) Margaretenallee &gt; entfällt <br />",
"icoX": 0,
"prio": 6,
"prod": 32,
"affProdRefL": [
4,
5,
6,
7
],
"lModDate": "20200221",
"lModTime": "113447",
"sDate": "20200221",
"sTime": "113100",
"eDate": "20200630",
"eTime": "235900",
"sDaily": "000000",
"eDaily": "235900",
"comp": "BSAG",
"catRefL": [
0
],
"pubChL": [
{
"name": "TIMETABLE",
"fDate": "20200221",
"fTime": "113100",
"tDate": "20200630",
"tTime": "235900"
}
],
"eventRefL": [
2
]
},
{
"hid": "HIM_FREETEXT_14525",
"act": true,
"head": "Verlegung einer Stromleitung in der Lindenstraße",
"text": "Betrifft die Linien 91, 92, 94, N7<br /><br />Beginn der Umleitung verschoben auf voraussichtlich 16. März bis Juni 2020<br /><br />Die Bauarbeiten sollten ursprünglich bereits am 2. März beginnen. Ab diesem Datum wurde auch die Umleitung der Buslinien geplant. Bitte beachten Sie, dass die Fahrpläne an den Haltestellen sowie die Fahrplanauskunft im Internet ab 2. März den Bauplan anzeigen, obwohl die Busse bis zum Beginn der Bauarbeiten noch in der regulären Linienführung fahren.<br /><br />Umleitung ab Baubeginn:<br />Die Linien 91, 92, 94 und N7 werden in Richtung Vegesack zwischen (H) Bf Blumenthal und (H) Bremer Vulkan über die Straßen Zur Westpier und Am Werfttor umgeleitet.<br /><br />Haltestellenänderungen in Richtung Vegesack:<br />(H) Wätjens Park &gt; verlegt vor die Kreuzung Lüssumer Str./Zur Westpier<br />(H) Margaretenallee &gt; entfällt <br />",
"icoX": 0,
"prio": 6,
"tLocX": 0,
"prod": 32,
"affProdRefL": [
4,
5,
6,
7
],
"lModDate": "20200221",
"lModTime": "133105",
"sDate": "20200221",
"sTime": "110100",
"eDate": "20200630",
"eTime": "235900",
"sDaily": "000000",
"eDaily": "235900",
"comp": "BSAG",
"catRefL": [
0
],
"pubChL": [
{
"name": "timetable",
"fDate": "20200221",
"fTime": "110100",
"tDate": "20200630",
"tTime": "235900"
}
],
"eventRefL": [
3
]
}
]
}

View file

@ -14,6 +14,7 @@ require('./vbb-departures')
require('./bvg-radar')
require('./oebb-trip')
require('./rejseplanen-trip')
require('./vsn-remarks')
require('./db-netz-remarks')
require('./vsn-departures')

27
test/vsn-remarks.js Normal file
View file

@ -0,0 +1,27 @@
'use strict'
const test = require('tape')
const createClient = require('..')
const rawProfile = require('../p/vsn')
const res = require('./fixtures/vsn-remarks.json')
const expected = require('./fixtures/vsn-remarks.js')
const client = createClient(rawProfile, 'public-transport/hafas-client:test')
const {profile} = client
const opt = {
results: 100, // maximum number of remarks
// filter by time
from: Date.now(), to: null,
products: null, // filter by affected products
}
test('parses a remarks() response correctly (VSN)', (t) => {
const common = profile.parseCommon({profile, opt, res})
const ctx = {profile, opt, common, res}
const warnings = res.msgL.map(w => profile.parseWarning(ctx, w))
t.deepEqual(warnings, expected)
t.end()
})

View file

@ -39,6 +39,7 @@ const parseArgs = [
['radar', 1, parseJsObject],
['reachableFrom', 0, parseJsObject],
['reachableFrom', 1, parseJsObject],
['remarks', 0, parseJsObject],
['serverInfo', 0, parseJsObject],
]