FahrplanDatenGarten / pyhafas

A python client for the HAFAS (HaCon Fahrplan Auskunfts System)
https://pyhafas.readthedocs.io
MIT License
47 stars 20 forks source link

Add KVB profile (Kölner Verkehrsbetriebe) #21

Closed akloeckner closed 1 year ago

akloeckner commented 1 year ago

I read in #12 that we should open an issue, if we would like to have a specific profile. So here's my issue for KVB. The metadata is in transport-apis. Maybe it's a matter of a few minutes for a maintainer to add this. I would for sure need a few days...

Why would I like to have it? While the planned journeys are also in the DB system, the realtime data is much more accurate in the local transport provider's system. And I want to use the data for displaying "next departures" of our local tramway station.

1Maxnet1 commented 1 year ago

I will give it a try this week :)

akloeckner commented 1 year ago

Nice, thanks a lot! Let me know, if I can somehow help with my limited insight in the interface.

1Maxnet1 commented 1 year ago

I started my work here: https://github.com/1Maxnet1/pyhafas/tree/kvb-profile You can have a look at the Profile, and let me know, if any namings do not fit the local naming scheme :) I did not yet try it out and will create some tests for that before I create a PR

akloeckner commented 1 year ago

Are you referring to the product names?

I have taken a screenshot from our KVB trip planner app:

Screenshot_20230517_134827

I'm not sure where those names are used. I have only found some comments here:

https://github.com/1Maxnet1/pyhafas/blob/d44133e9258d7b473bb56813e3c2199a6729f04b/pyhafas/profile/kvb/__init__.py#L32

I would suggest to use

Why?

The tram is in fact both above ground (Stadtbahn/Straßenbahn) and underground (U-Bahn). The long-distance and regional types are not limited to the products listed in the comments, I believe. For example, the TGV and Thalys stop in Cologne, too.

PS: Our local transport association VRS uses some sightly different names. That's why I have changed my suggested names from Stadtbahn to Straßenbahn. Which is, what people say as well. See here:

Screenshot_20230517_140135_VRS

That one also lists TaxiBus or Anruf-Sammel-Taxi (AST), a bus that only comes if you phone in some time in advance. I would just use the abbreviation, because no-one knows what it stands for anyway.

1Maxnet1 commented 1 year ago

Thanks for the input, I just double checked the publicly available configuration file (https://github.com/public-transport/transport-apis/blob/v1/data/de/kvb-hafas-mgate.json) and adjusted my naming (For the VSN which is already supported by this repository, the names match their respective configuration as well, so it is consistent). It almost fits your proposed names, so I would go with this for now. If you later have any issues in your application, we can figure out how to handle the names.

akloeckner commented 1 year ago

Looks good! Thanks!

1Maxnet1 commented 1 year ago

I updated my branch again. Except for Journeys the tests seem to work fine. Will take a lot at that soon.

1Maxnet1 commented 1 year ago

I just created a PR with my initial work: #28 Please have a look and test it out, whether you find any issues.

leona-ya commented 1 year ago

Solved in #28. I also tested it works.

akloeckner commented 1 year ago

Thanks a lot to both of you!!

akloeckner commented 1 year ago

Thanks for adding the KVB provider! Would you mind to create a new relase, so I can use the new profile in https://github.com/akloeckner/hacs-hafas? If you'd like to finish #24 first, I'm also fine with that. :-)

leona-ya commented 1 year ago

Will release now.

akloeckner commented 1 year ago

Perfect, thanks!