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

Personal shortcuts #2

Open
georgjaehnig opened this issue Jul 14, 2016 · 10 comments
Open

Personal shortcuts #2

georgjaehnig opened this issue Jul 14, 2016 · 10 comments

Comments

@georgjaehnig
Copy link

georgjaehnig commented Jul 14, 2016

How about allowing to set some personal shortcuts? For instance, let's say I live at Ostkreuz and work in Frohnau, then I'd like to set only once something like

  • /set-shortcut work, Ostkreuz, Frohnau, now

This make the bot remember a shortcut named work.

Afterwards, I can anytime call /shortcut work, and get next connection fetched.

This could be also extended to the current location. For instance, I could set

  • /set-shortcut home, [current location], Ostkreuz, now

Then, when I call /shortcut home, my current location gets fetched and then the next connection – without any tedious typing.

@derhuerst
Copy link
Owner

@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.

@georgjaehnig
Copy link
Author

georgjaehnig commented Jul 14, 2016

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)

@derhuerst
Copy link
Owner

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.

@georgjaehnig
Copy link
Author

georgjaehnig commented Dec 14, 2016

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.

@derhuerst
Copy link
Owner

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.

@georgjaehnig
Copy link
Author

georgjaehnig commented Dec 14, 2016

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.

@derhuerst
Copy link
Owner

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

@georgjaehnig
Copy link
Author

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.

@derhuerst
Copy link
Owner

derhuerst commented Dec 14, 2016

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.

@derhuerst
Copy link
Owner

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

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

No branches or pull requests

2 participants