OpendataCH / Transport

Swiss public transport API
http://transport.opendata.ch/
MIT License
241 stars 50 forks source link

Train cancellations #91

Open fabian opened 11 years ago

fabian commented 11 years ago

Add train cancellations to API responses.

        <RtStateList>
          <RtState value="WARNING"/>
          <RtState value="WARNING_CONNECTION_NOT_RIDABLE"/>
        </RtStateList>
        ...

screen shot 2013-09-12 at 10 55 44

              <StopPrognosis>
                <Arr handicappedAccess="2"/>
                <Dep handicappedAccess="2"/>
                <Status>PARTIAL_FAILURE_AT_ARR</Status>
              </StopPrognosis>

screen shot 2013-09-12 at 10 55 56

ChristianKohler commented 10 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?

fabian commented 10 years ago

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.

dragoon commented 9 years ago

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?

fabian commented 8 years ago

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.

screenshot 2016-04-01 14 49 00
fabian commented 8 years ago

Added another fixture for a cancelled train in https://github.com/OpendataCH/Transport/commit/3e2d02451553f3bb486beb345c0b5571704bd0ba.

CedricReichenbach commented 6 years ago

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
            }
         },
      }
    ]
}