public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
269 stars 54 forks source link

Collect (And Remove) Prefixes in Train Names #172

Open nixmeer opened 4 years ago

nixmeer commented 4 years ago

Hello. For some time, the MMM-PublicTransportHafas on my magic mirror displays ugly train names. Instead of "S3", it now says "ABR S3" which tells me the train is being operated by a private company named abellio.

This issue is about collecting trains and connections that have this issue to parse them (I guess)

derhuerst commented 4 years ago

I see two ways to tackle this:

  1. Manually maintain a list a list of rules (e.g. /^abr\s+/i -> ''). Will be easy to implement, but a lot of work to maintain.
  2. attempt to clean the line names using context (line.operator, OpenStreetMap, Wikidata, etc). Will likely be complex and "heavy" (require many dependencies, pull a lot of data, etc).

Probably both will be need to achieve reasonable coverage; @juliuste implemented this combination for DB station names, let's do the same with line names.

For Germany/Deutsche Bahn for example, this logic is useful far beyond the scope of hafas-client, so I'd like to do this in a separate repo which db-hafas. Let's create a repo for this and compile a list there!

nixmeer commented 4 years ago

Ok, so what’s the Plan Right now? Where and how to help?

For the list part: it might be easier to work backwards and take a look at the private team operators and check which of these do have their own prefix. Wikipedia provides a long list. It might miss some operators but is still a good source

derhuerst commented 4 years ago

For the list part: it might be easier to work backwards and take a look at the private team operators and check which of these do have their own prefix. Wikipedia provides a long list. It might miss some operators but is still a good source

Sure, if you want to help, start a list with prefixes! Your contribution is appreciated!

For each prefix, note down a link to their Wikipedia page, website or at least a name of the operator.

nixmeer commented 4 years ago

At the DB Reiseauskunft, I could confirm the use of the following prefixes:

At the same time, I can confirm that the following operators operate connections without such prefixes:

That's it for now.

nixmeer commented 4 years ago

@derhuerst what's up next? when do you expect to implement the list?