Comments (7)
Hmmm, interesting that I hadn't noticed this before, but it's a fairly obvious bug in the cop-out-of-a-temporary-implementation I'm using to push Visits onto the result list.
The exposure of this bug (which your example hits pretty squarely) exploits 3 caveats of that implementation:
- The visit list has no concept of dates. It only understands times, the same way that
stop_time
s in GTFS only understand times. Dates are applied to those times viacalendar
andservice_id
mappings. visits_between
doesn't actually do any bounds- or order-checking on it's arguments. That is, it doesn't ensure that the first argument comes chronologically before the second to create a closed loop.- The objects that are pushed onto the result list for the call forces the date portion of the Visit to be the start date.
I haven't fully looked into this yet, but I'm fairly certain that the results you're getting are actually for the next station in the visit list. Essentially, there are no visits after 23:17:33
for the BUS064
, and the visit list sees 20170320 00:17:33
as occurring before the start time. Because of that, the upper bound that visits_between
uses to determine when to stop iterating is never met, and instead the iteration continues onto the next station.
I'm currently working on implementing support for requests that span multiple dates, so I believe this will be covered by that work. You can track the date_iteration
branch if you'd like to follow along.
from timetable_cpp.
I think 52890f6 fixes this, but I don't want to close until I've tested it more and finished the implementation.
At a minimum, you should now be getting results with the correct date on them when you make a call to visits_between
(the other visits_*
calls haven't been updated yet), so this issue should at least be more obvious, if not resolved.
from timetable_cpp.
Thanks for working on this. 52890f6 seems to introduce a new bug with the date iterator (look at the last result):
Received call to `visits_between`:
stop: BUS313SW
start: 20170320 23:13:45
end: 20170321 00:13:45
count: 10
20170320
Iterating date from 20170320 to 20170321
20170321
Responded in 5.745ms with:
[["20170320 23:30:00","20170320 23:30:00","1B","to CityBus Center"],["20170320 23:32:00","20170320 23:32:00","4B","to Campus & CityBus Center"],["20170320 24:30:00","20170320 24:30:00","1B","to CityBus Center"]]
It looks like times past midnight are showing up as hours > 23
on the same date, rather than starting with hour 0
on the next date.
from timetable_cpp.
Indeed. This is due to the way that GTFS deals with stop_time
s that pass the midnight boundary. In short, it defines visits above 24 hours rather than wrapping to 0 on the next day so that trip times can more easily be calculated. You can get a little more information from the stop_times.txt
reference section on the arrival_time
field.
I'm currently working on a proper DateTime
implementation that will deal with these kinds of things, and will hopefully make the iteration implementation much cleaner as well. I'll have an initial commit up soon.
from timetable_cpp.
I believe 46bd10e fully implements #10 for visits_between
and fixes this bug. @elliottwilliams can you test this and let me know if you hit any new issues? I'll be implementing the other visits_*
calls shortly.
from timetable_cpp.
This should be solved with the merging of #12.
from timetable_cpp.
FWIW, I've been using Timetable near midnight recently and haven't seen any issues. Thanks!
from timetable_cpp.
Related Issues (16)
- RPC calls for visits within a time interval HOT 7
- Iterate dates on `visits_*` calls
- Build on linux HOT 8
- RPC to get hours of service for a station/route HOT 5
- Improve `stop_time` indexing. HOT 1
- Date formatter bug in visits_after HOT 5
- Data versioning and idempotency HOT 2
- Optional csv fields HOT 1
- Rename `next/last_visits` to `visits_before/after`. HOT 1
- Handling agencies that don't have stop codes HOT 2
- Stop times > 23:59:59 unsearchable after midnight HOT 3
- Create visits RPCs for all routes at a station HOT 5
- Responses limited to 1024 characters
- Re-arrange RPC arguments to allow route agnosticism HOT 2
- Add route information to RPC responses HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timetable_cpp.