iduedu.deduplicate_across_feeds¶
- iduedu.deduplicate_across_feeds(tables, prefixes, *, platform_tolerance=0.5, crs=None)[source]¶
Count once what several merged feeds publish twice. Edits
tablesin place.Catalogues overlap: two versions of one feed, a national feed and a city feed of the same operator, a mirror and its original. Merged with qualified identifiers, the copies never collide – they sit side by side, and the graph gets two patterns where the city runs one. Two rules remove them, both narrow on purpose, because a wrong merge is worse than a leftover duplicate:
Platforms –
stopsrows withlocation_type0 or empty, where passengers board; the graph builder makes themplatformnodes, while the vehicle’s stopping place is a separate node per pattern and is not touched. Platforms of different sources withinplatform_tolerancemetres are one platform. The default 0.5 m is measured: across 125 703 platforms of cities merged from several feeds, 63% had another source’s platform within 0.5 m (the same coordinate republished), while distinct platforms of one feed already occur 1-3 m apart. Stations, entrances, generic nodes and boarding areas are never fused, nor platforms of one source.Trips – after that, a trip of one source is a copy of a trip of another when both run the same
route_typethrough the same platforms with the same arrival and departure times (in seconds), pickup and drop-off rules and, for frequency-based trips, the same headways. The source that sorts first keeps it.
- Parameters:
- Return type:
- Returns:
{"platforms_fused": n, "trips_dropped": m}.