Bug in the id_prefix "de:09162:"?
Hey everyone! :)
I might have noticed a small bug. The id_prefix is defined as "de:09162:" and is used to convert the IDs. But I think that there is a problem with this definition. For many stations, it is correct, but there are stations with another prefix, for example "Garching, Forschungszentrum" has the ID "de:09184:460" (see https://www.mvg.de/api/fahrinfo/location/query?q=forschungszentrum). So I'm afraid that for some stations the code produces wrong IDs. I think that "09162" is only correct for stations located inside Munich and I think that stations somewhere else use another number (but I'm not 100% sure about that).
It would be really cool if you could fix that. Thank you! :)
(by the way, this is my first issue, so if I do something wrong, please don't be angry and just tell me what I can do better next time :) )
Hey, thanks for raising this issue!
Some history: the id_prefix was added after a change in the api; before, the station IDs didn't have any prefix. The code with the id_prefix was added as a workaround so old code would continue working.
It seems like you're the first person to notice this issue. Unfortunately, I'm not sure there is a clean way to fix the conversion logic as we wouldn't know what would be the correct prefix for that ID.
Ideally, if you use the new IDs with a prefix everywhere, everything should work, or is there a case where there is an error?
As a sidenote, I'm not really actively developing this library anymore, I would suggest to maybe check out https://github.com/mondbaron/mvg instead, which is a more modern take and uses the newer API endpoint rather than the legacy one this library uses.