Open fabian opened 11 years ago
Hi Fabian, the service is really great so far but it lacks of trustabilty due to absence of cancellations and delay data. Any plans to implement cancellations and delays any time soon?
Hi Christian. Information about delays is actually provided by the API (prognosis
). No short-term plans to add cancellations - if anyone has time a PR would be welcome.
My 5 cents: if a train is fully cancelled, this is encoded in the STBJourney
object,
can be retrieved as follows in the Journey->createFromXml()
function:
$status = trim((string)$xml->JProg->JStatus); // =="FAILURE" when cancelled
But here is another question: should we skip such trains or introduce a new attribute in the API?
I've captured today's disruption at Stein-Säckingen for a connection between Zürich and Basel with a canceled train (with an alternative) in hafas_response_2016-04-01.xml.
I don't think we should just emit them from the API but rather flag them with an additional attribute.
Added another fixture for a cancelled train in https://github.com/OpendataCH/Transport/commit/3e2d02451553f3bb486beb345c0b5571704bd0ba.
For the record, here's an example of how fahrplan.search.ch reports disruptions:
{
...
"connections":[
{
...
"disruptions":{
"http://fahrplan.sbb.ch/bin/help.exe/de?tpl=showmap_external&messageID=895012&mti=1&hMap=false#hfsShm":{
"id":"895012",
"header":"Einschränkung: Bern - Fribourg/Freiburg",
"lead":"Zwischen Bern und Fribourg/Freiburg ist die Strecke für den Bahnverkehr nur beschränkt befahrbar.",
"text":"Zwischen Bern und Fribourg/Freiburg ist die Strecke für den Bahnverkehr nur beschränkt befahrbar.<br /><br /> Sie müssen mit Verspätungen und Zugausfällen rechnen.<br /><br /> Grund: Starker Schneefall<br /><br /> Dauer der Einschränkung unbestimmt.",
"timerange":"01.03.2018 00:00 - 01.03.2018 23:59",
"exact":false,
"priority":40
}
},
}
]
}
Add train cancellations to API responses.