Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liveboards in the past hour #497

Open
koeleboe opened this issue Oct 28, 2023 · 6 comments
Open

Liveboards in the past hour #497

koeleboe opened this issue Oct 28, 2023 · 6 comments

Comments

@koeleboe
Copy link

Lately the liveboards are pretty buggy, especially when going into the past. Often not all trains are shown (only one or two or even nothing - error)

For example: https://api.irail.be//liveboard/?id=BE.NMBS.008893559&station=Gent-Sint-Pieters&date=281023&time=1934&arrdep=departure&lang=en&format=json&alerts=false

Only returns one train (19:37 to Oostende), which is of course not right.

@Bertware
Copy link
Member

Bertware commented Oct 29, 2023

This issue is caused by the new NMBS systems not providing this data for the past anymore, requiring a fallback to parsing the website for liveboards in the past. This has always been lacking certain details, but at least the trains should show up correctly. I noticed the NMBS seems to have a new webpage for this, will see if I can adjust the fallback to be more reliable.

@Bertware
Copy link
Member

Even https://www.belgiantrain.be/nl/travel-info/current/search-by-station does not really search in the past, so it seems like more work is needed on the iRail side to compute these results ourselves, for example based on their GTFS/GTFS-RT feed. That feed is missing information such as platforms, but it's quality may hopefully be sufficient for historic data.

There is already a linked connections feed for the NMBS GTFS/GTFS-RT data on graph.irail.be, which should allow to consume the data in an easier way.

@koeleboe
Copy link
Author

Ok that's clear. I guessed it has something to do with the new NMBS systems. The most important reason that I opened this ticket that it worked fine the past couple of months, but since a few weeks not.

The old variant is still available (halleluja), because the new variant is really a mess for filling in the compensation form. http://www.belgianrail.be/jp/nmbs-realtime/query.exe/nn?HWAI=VIEW!view=realtimeinfo

Bertware added a commit that referenced this issue Oct 29, 2023
@Bertware
Copy link
Member

Pushed a possible fix to staging.api.irail.be, could you check if the data is correct, or at least better? Please search back at least two hours in the past, otherwise you might still get a response from the "new" source which doesn't handle historical data that well (now you only get data from the fallback if the new one fails, this should probably be replaced by a cutoff based on the queried time)

@koeleboe
Copy link
Author

Thanks! Seems to work for now! I get a lot more trains now in the staging api!Could this be implemented at a later stage in the hyperrail app too?

@Bertware
Copy link
Member

The fix has now been rolled out to production as well. Any apps querying in the past will benefit from this, as the whole fallback datasource logic is implemented on the server side. Leaving the issue open in order to improve the "failover" logic so the iRail API picks the best datasource for requests in the near past (typically between 1 minute and 1 hour in the past)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants