OpendataCH / Transport

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

Delay Information #151

Closed ghost closed 7 years ago

ghost commented 7 years ago

There are two options for getting the (arrival) delay of a train. One is to read the field stationboard.prognosis.arrival and subtract the value in stationboard.stop.arrival. Another is to read the field stationboard.stop.delay. These methods don't provide the same results. The Sbb stationboard is using the second method. But sometimes this field is set the a negative value, i.e. -1427, -1421 and simmilar. The sbb stationboard is at this time showing a correct delay. Might be the same for the connections search, but i didn't test that.

fabian commented 7 years ago

Can you provide an example transport.opendata.ch query URL and a snapshot of the response where you see the negative values?

ghost commented 7 years ago

The query would be this: http://transport.opendata.ch/v1/stationboard?station=008507000&type=arrival&transportations[]=ice_tgv_rj&transportations[]=ec_ic&transportations[]=ir&limit=10

the negative value can be found in the following file, line 31. response.txt

fabian commented 7 years ago

Thanks for the query and the example response file!

I was now able to find a bug in the midnight check for delayed arrival times and found a fix for it. Can you confirm it's working now as expected?

ghost commented 7 years ago

Well I wasn't able to really reproduce the error, so I can't say for sure if it's really fixed. But I haven't seen these negative values since. I will give notice, if I find anything strange.