-
Notifications
You must be signed in to change notification settings - Fork 0
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
RPC calls for visits within a time interval #1
Comments
This is definitely possible (and fairly easy) with the current system. In fact I've already implemented it. Right now, there exists a map with a complex key of The question is: does this hierarchy make sense? Or should it be rearranged in a way that's more efficient for the queries that will be made? For example, having the |
The two views in 1.0 that feed off of Timetable data will be station views, so inverting your map to have the top-level key be Perhaps "the right thing" to do here is to have a map keyed by route-trip-station, and another by station-route-trip, and pick the more efficient for a given RPC call, but station-route-trip is the most useful to Proper for now. |
And if you're cool with the |
I made two minor changes to the call I added to the wiki:
|
All that makes sense to me. Having two maps wouldn't be too bad, since each one can just store pointers (or rather, references). The only changes will be adding a new key class for the different order. Will try this out tonight. |
Update on implementation: there's still only one map at this point, but it's key is Update on performance: I'm currently working with Citybus' most recent archive, which has more than 250,000 StopTimes shared across 800 Stops and just under 9,000 Trips. The total memory usage with this single map is 213MB. My best guess at the implications of adding a second map will increase that memory usage to ~300MB. Processing time (parsing, interpolating stop times, and creating the map) before the system is available is ~4 seconds. Overall, it's actually a lot better than I was anticipating based on the dataset, but could probably be improved farther with better usage of references and move-constructors, but that's a future concern. |
…on, getting ready for filter_iterator. CSV Parsing can now be done all at once (as before, but now called `all`) or as a stream (via `initialize` and `next`). Also, `visit_list_key` and its usages have also been re-arranged to be `(Station, StopTime, Route, Trip)` to better accomodate its primary use case (See #1). For uses better managed by a different arrangement, another key/map will likely be made. In general, Timetable is now ready to have a `filter_iterator` that takes a custom predicate and only returns results that pass the predicate condition. The primary use of this will be to filter out visits whose service is not being offered in a given timeframe (a la `Timetable::Calendar`), or to return only visits from a given set of routes.
This has been referenced in a few other issues as well (#3 in particular), but this RPC has both been added to the wiki and implemented in Timetable, so I'm going to close this issue as completed. |
As Proper starts to consume Timetable data, I'm realizing that a more useful way to query arrival data is by asking for all the arrivals within a time interval. Proper's station views (by default) show all arrivals for the next hour; this RPC would suit that use case nicely. Here's how I envision the RPC looking:
timetable.visits_between(station, route, start_time, end_time, n) -> [(ETA, ETD)]
start_time
andend_time
are standard (%Y%m%d %H:%M:%S
) timestamps.n
allows a count limit to be specified, but it can be omitted.The text was updated successfully, but these errors were encountered: