OneBusAway / onebusaway-gtfs-modules

A Java-based library for reading, writing, and transforming public transit data in the GTFS format, including database support.

Home Page:https://github.com/OneBusAway/onebusaway-gtfs-modules/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Merging already merged feeds may create duplicate IDs

hbruch opened this issue · comments

Summary:

Trying to merge multiple regional feeds together with another, already merged feed resulted in duplicate schedule_ids for calendar.txt entries.

Steps to reproduce:
Merge a feed with two schedules with IDs T0, a-T0 with another feed with another, different schedule with ID T0.

Expected behavior:
Resulting feed has calendar entries with unique IDs.

Observed behavior:
Resulting feed has calendar entries with duplicate IDs a-T0.

Root cause
This behavior is caused by MergeSupport.renameAgencyAndId which prepends a prefix without further checking for uniqueness which might result in duplicates.

As long as no feed contains IDs starting with single letters followed by a hyphen (e.g. "a-"), this will not cause an issue. However, the documentation should describe this duplicate resolution strategy.