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

[REQUEST] Implement stop times time and distance verification for a trip #212

Closed
maximearmstrong opened this issue May 11, 2020 · 2 comments · Fixed by #350
Closed

[REQUEST] Implement stop times time and distance verification for a trip #212

maximearmstrong opened this issue May 11, 2020 · 2 comments · Fixed by #350
Assignees
Labels
python validator Rules implemented in the original Google Python Validator

Comments

@maximearmstrong
Copy link
Contributor

maximearmstrong commented May 11, 2020

Is your feature request related to a problem? Please describe.
Stop times in a trip should be have increasing time and distance. This is a GTFS rule implemented in Google Python validator as ValidateStopTimesSequenceHasIncreasingTimeAndDistance.

Describe the solution you'd like
Actual Google GTFS validator behaviour : verifies the time and distance travelled at a stop time in a trip is greater than the previous ones. (verifies the stop time and the distance travelled according to the shape)
https://github.com/google/transitfeed/blob/d727e97cb66ac2ca2d699a382ea1d449ee26c2a1/transitfeed/trip.py#L595

Describe alternatives you've considered

Additional context
Line 203 in Error support priorities https://docs.google.com/spreadsheets/d/1vqe6wq7ctqk1EhYkgtZ0_TbcQ91vccfs2daSjn20BLE/edit#gid=0

@barbeau
Copy link
Member

barbeau commented May 11, 2020

cc @timMillet

Note that the Python validator allows sequential arrival and departure times in a trip to be the same - so you can have:

1, 12:00:00, 12:00:00
2, 12:10:00, 12:10:00
3, 12:10:00, 12:10:00
4, 12:15:00, 12:15:00

The Python validator only flags times that go backwards in time. This caught us in the GTFS-RT validator, as we initially implemented a rule that said that predictions needed to move forward in time for each stop (see CUTR-at-USF/gtfs-realtime-validator#365).

Allowing sequential times being the same dates back to a major scheduling software package called HASTUS rounding times to the nearest minute:
https://github.com/google/transitfeed/blob/d727e97cb66ac2ca2d699a382ea1d449ee26c2a1/transitfeed/trip.py#L733

I don't know for sure if HASTUS still has this issue, although someone flagged that issue with our GTFS-RT validator, so I assume it (or another GTFS exporter) does.

It would be nice to update the validator to be more strict rules for this if the state of the industry allows. If not, we may have to implement some of the same heuristics in the Python validator:

# HASTUS makes it hard to output GTFS with times to the nearest second
# it rounds times to the nearest minute. Therefore stop_times at the
# same time ending in :00 are fairly common. These times off by no more
# than 30 have not caused a problem. See
# https://github.com/google/transitfeed/issues/193
# Show a warning if times are not rounded to the nearest minute or
# distance is more than max_speed for one minute.

@maximearmstrong maximearmstrong added the python validator Rules implemented in the original Google Python Validator label Jun 9, 2020
@ghost ghost assigned lionel-nj Aug 13, 2020
@lionel-nj
Copy link
Contributor

Time travel verification is already implemented:

@lionel-nj lionel-nj linked a pull request Aug 25, 2020 that will close this issue
6 tasks
lionel-nj added a commit that referenced this issue Sep 4, 2020
* Define new Notices

- write new error and warning notices
- export notices as pb and json
  - write test to verify said export

* Implement new use case -- Write rule case logic

- write test to verify said implementation

* Update rules docs

* Improve code legibility -- Refactor notice export

* Improve code legibility -- Update use case javadoc

* Rework rule logic

- remove unused Notice
- rework notice constructor for consistency and clarity
  - rename notice
  - update related tests
- update rules docs
  - write additional test

* - add additional check on notice lists size
- change error code for future merge to master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python validator Rules implemented in the original Google Python Validator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants