Giter Site home page Giter Site logo

Personal shortcuts about vbb-telegram HOT 10 OPEN

derhuerst avatar derhuerst commented on May 29, 2024
Personal shortcuts

from vbb-telegram.

Comments (10)

derhuerst avatar derhuerst commented on May 29, 2024

@georgjaehnig

I'm not sure this is necessary. It's quite a lot of work for (imho) not so much convenience. For commutes you do every day, you certainly know the fastet route. It's just a matter of when the trains run at your station. For this, the /abfahrt feature remembers the most used stations.

from vbb-telegram.

georgjaehnig avatar georgjaehnig commented on May 29, 2024

It's quite a lot of work for (imho) not so much convenience.

OK, I can't say much about the necessary work, have no idea about TG bot coding.

I thought especially about the last example with the current location. I imagine myself being somewhere at a party on Sunday morning and super-tired. I just wanna hit 2 simple taps to get my way home.

For commutes you do every day, you certainly know the fastet route.

Yes, but I might wanna make sure there are no interruptions or changes, these happen quite often, maybe even without planning (recently, they spontaneously closed down the track in Friedrichshain to defuse a bomb – would be great if I could check with a single tap if my regular commute is working as expected)

from vbb-telegram.

derhuerst avatar derhuerst commented on May 29, 2024

Thinking about commuting more, I'd like to implement this feature.

Right now, I'm pretty busy however with work and I'm about to migrate all of my VBB modules to their new international IDs, but after that, I'll probably give it a shot.

from vbb-telegram.

georgjaehnig avatar georgjaehnig commented on May 29, 2024

Just because of your reply, I was reminded of a similar idea that would be closely related to this feature that probably would be very convenient. (Don't want to make you feel overwhelmed with this, just leaving it here.. :) )

Imagine, you would not only set up a shortcut but also an actual connection: You could tell the bot: Every weekday, I commute from Ostkreuz to Frohnau at 7:30 and I use the S5 and then the S1. The bot would store that particular connection.

Then, every evening before, the bot would in the background fetch the connection and make a diff with the stored one, checking if something has changed (e.g. if there are construction works, line changes etc.) If that's the case, it would send a message with the new connection. If not, nothing would happen.

That way, the commuter never again would need to read S-Bahn statements about timetable changes. He would be informed only in case something actually changes.

Some technical hints: It would be enough to store the commuter's connection only as a hash (not the whole object/serialized string), since we only want to act if something has changed. If that's the case, we send out the whole newly fetched connection anyway.

from vbb-telegram.

derhuerst avatar derhuerst commented on May 29, 2024

I agree, this is very useful. I'd prefer a second bot for that however.

There's a few technical problems involved. This first one is parsing the disruption announcements from S-Bahn & BVG, which is hard. vbb-disruptions scrapes their websites & fetching from their Twitter channels wouldn't be hard, but actually making sense of this…

I think someone already tried this before, will ask at OKLab Berlin.

from vbb-telegram.

georgjaehnig avatar georgjaehnig commented on May 29, 2024

I agree, this is very useful.

Cool. :)

This first one is parsing the disruption announcements from S-Bahn & BVG, which is hard.

But that's completely not my idea. We leave the disruption announcements aside – we only fetch the connections, and look for diffs.

An example: I set up my connection when there are no disruptions on the line. So the bot would look for the next weekday connection

  • from Ostkreuz
  • to Frohnau
  • dep. 7:30

and get this connection:

+-------------------------+--------+--------+----------+----------------+
| Berlin Ostkreuz (S)     |        |  07:31 | S     42 |1. FB K2        |
| Berlin Gesundbrunnen(S) |  07:45 |  07:49 | S      1 |2. FB K2        |
| Berlin-Frohnau          |  08:08 |        |          |                |
+-------------------------+--------+--------+----------+----------------+

We assume that is the connection without disruptions and save it.

Then, every evening before a weekday, the bot fetches the connection again in the background. Usually, it will receive the very same connection. It would recognise this by doing a diff with the saved one and do nothing.

But one day, it would get a different one, for instance, one S42 is to be cancelled, so you have to take an earlier one:

+-------------------------+--------+--------+----------+----------------+
| Berlin Ostkreuz (S)     |        |  07:26 | S     42 |1. FB K2        |
| Berlin Gesundbrunnen(S) |  07:40 |  07:49 | S      1 |2. FB K2        |
| Berlin-Frohnau          |  08:08 |        |          |                |
+-------------------------+--------+--------+----------+----------------+

This time, the diff with the stored connection is not empty. So the bot sends out the newly fetched connection.

from vbb-telegram.

derhuerst avatar derhuerst commented on May 29, 2024

Their API by far doesn't reflect all disruptions realtime(ish) enough. That's why pure diffing will be very brittle.

from vbb-telegram.

georgjaehnig avatar georgjaehnig commented on May 29, 2024

Hm, using Öffi, I'm always surprised how realtime the data is, it even shows me current delays of my bus. Could it be that Öffi is using something different than their API?

And my experience is that announced disruptions are always reflected in the official timetable interface.

Just picked the first announced on for this weekend from their flyer. It states that Friday evening after 22:00, no S42 will be operating between Südkreuz and Hermannstr. And that's what I also see when I now check for that connection – only S46 is operating between there.

from vbb-telegram.

derhuerst avatar derhuerst commented on May 29, 2024

Hm, using Öffi, I'm always surprised how realtime the data is, it even shows me current delays of my bus. Could it be that Öffi is using something different than their API?

No, it's exactly the same API. You can check the source code.

And my experience is that announced disruptions are always reflected in the official timetable interface.

Mostly, yes. But there are many spontaneous disruptions which are not reflected in the API and provided on Twitter in a non-machine-readable format. 😢 There's a standard called GTFS RT for that, which they don't use/provide.

from vbb-telegram.

derhuerst avatar derhuerst commented on May 29, 2024

FYI I started working on watching a "journey" for delays/changes at vbb-get-off-bot. Might want to extract that into a lib.

from vbb-telegram.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.