MobilityData / gtfs-realtime-validator

Java-based tool that validates General Transit Feed Specification (GTFS)-realtime feeds
Other
41 stars 10 forks source link

Detect when no vehicles exist but service is scheduled #81

Open isabelle-dr opened 2 years ago

isabelle-dr commented 2 years ago

Issue by mcplanner-zz Nov 30, 2020 Originally opened as https://github.com/CUTR-at-USF/gtfs-realtime-validator/issues/390


Summary: I ran the validator on a feed that is blank by design, and no error was given.

Steps to reproduce: Bay Area Rapid Transit (BART) prefers to not produce a vehicle position feed because they're concerned about physical security. Their regional agency (MTC) produces vehicle positions, trip updates, and alerts on behalf of all their local agencies, including BART. I plugged in the vehicle position and BART identifiers in their URL format (http://api.511.org/transit/vehiclepositions?api_key=[key]&agency=BA) and put this URL in the validator. No errors were given, which made me assume it was just a really good feed.

Expected behavior: I expected some indication that the API wasn't returning anything at all.

Observed behavior: The validator returned 0 errors.

Platform: MacOS Catalina 10.15.7 Java version: 11.0.5 Chrome version 86.0.4240.80

isabelle-dr commented 2 years ago

Comment by barbeau Dec 1, 2020


@mcplanner Thanks for opening this! No errors = perfect! :)

Could you attach the .pb file that is returned (just from putting the URL in a browser) in a zip file, or if you can see the results in plain text in the validator, paste the plain text?

I'm curious if there is some content (i.e., a header) and no vehicles, or if the entire feed is empty.

If the header is there but no vehicles, it might be challenging to tell the difference between this type of feed and a normal situation where an agency isn't running service (e.g., in the middle of the night) - we'd need to compare against static feed to see if there is service running. Maybe this would be better presented as % coverage of trips shown as active in the static schedule data.

Possible related issues:

isabelle-dr commented 2 years ago

Comment by mcplanner-zz Dec 01, 2020


Here you go. Thank you! vehiclepositions.zip

KClough commented 1 year ago

@isabelle-dr @maximearmstrong

Wanted to run my intended approach for this issue by you before I get started on implementation.

  1. Determine what services are currently running.
  2. Compare the number of vehicle positions in the RT feed against the expected number of services in the static feed.
  3. If the number of current services * (expected coverage %) is less than the number of vehicle positions in the RT feed, create a validation error (or warning?)

Outstanding questions: