etalab / transport-validator

GTFS validator
https://transport.data.gouv.fr/validation/
MIT License
37 stars 10 forks source link

Add a new rule forbidding negative stop_time #200

Closed stuebinm closed 1 month ago

stuebinm commented 1 month ago

This adds an error if a stop_time has its arrival_time later than its departure_time (i.e. a vehicle would remain at the stop for a negative period of time), along with a corresponding test for this error.

As test data I have added a minimised version of the actual gtfs in which this issue just bit me ;)

(note that the MobilityData gtfs-validator has a more general check which also catches this issue: https://gtfs-validator.mobilitydata.org/rules.html#start_and_end_range_out_of_order-rule)

AntoineAugusti commented 1 month ago

@stuebinm Hi, thanks a lot for your contribution, much appreciated!

In which context do you use this library if you're willing to share?

stuebinm commented 1 month ago

@antoine-de

In which context do you use this library if you're willing to share?

I use it for Ilztalbahn (a small volunteer-association operated railway line) as an automated check before publishing a new gtfs version (hence my earlier PR about making daemon support optional https://github.com/etalab/transport-validator/pull/197). Since we only have the one line and only a couple trains per week there's little automation in how the gtfs is generated, and sometimes people edit it by hand, so it's very useful to run this validator as a sanity check on it.

(btw, thanks a lot for this project! It's very cool to have open-source tools for handling gtfs which we can use, and sometimes even contribute back to!)

stuebinm commented 1 month ago

short note on the last force-push: I have added the new validation to the readme file as requested, and have also downgraded it from Severity::Error to Severity::Warning to be in line with e.g. NullDuration and NegativeTravelTime which are likewise warnings, not errors.

AntoineAugusti commented 1 month ago

Will merge after adding the required error messages and translations on transport.data.gouv.fr

Thanks for your contribution @stuebinm, much appreciated 🙏🥳