Skip to content

feat: warn when trip_headsign matches intermediate stop name#2139

Open
PatrickSteil wants to merge 1 commit intoMobilityData:masterfrom
PatrickSteil:master
Open

feat: warn when trip_headsign matches intermediate stop name#2139
PatrickSteil wants to merge 1 commit intoMobilityData:masterfrom
PatrickSteil:master

Conversation

@PatrickSteil
Copy link
Copy Markdown
Contributor

Adds a new validation rule TripHeadsignValidator that warns when a trip's trip_headsign matches the stop_name of an intermediate stop (i.e., any stop that is not the last stop of the trip). This can cause confusion for passengers boarding after that stop, as the headsign suggests the vehicle is heading somewhere it has already passed.
The notice TripHeadsignMatchesIntermediateStopNotice is emitted as a WARNING and includes:

  • the offending trip_id and its row number in trips.txt
  • the trip_headsign value
  • the stop_id and stop_sequence of the intermediate stop matching the trip_headsign
  • the stop_id of the actual last stop of the trip

NoticeFieldsTest has been updated to register a new notice field name introduced: tripHeadsign.

Note that if a trip visits the last stop multiple times, then no warning is shown.

The following screenshot shows a real-world example of the official Swiss GTFS feed, where a trip passed through St. Gallen, and continues to Winterthur. But the trip_headsign shows St. Gallen.

Screenshot 2026-03-28 at 14 20 28

@welcome
Copy link
Copy Markdown

welcome bot commented Mar 28, 2026

Thanks for opening this pull request! You're awesome. We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of titles with semantic prefixes:

  • fix: Bug with ssl network connections + Java module permissions.
  • feat: Initial support for multiple @PrimaryKey annotations.
  • docs: update RELEASE.md with new process
    To get this PR to the finish line, please do the following:
  • Read our Contribution Guidelines
  • Follow Google Java style coding standards
  • Include tests when adding/changing behavior
  • Include screenshots

@PatrickSteil
Copy link
Copy Markdown
Contributor Author

In this PR patrickbr/gtfstidy#41, i posted the same example but with a screenshot of the trip's route, as well as implementing a fix by overwriting the stop_headsign.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant