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

How should GTFS transform strategies interact with extensions?

kurtraschke opened this issue · comments

Summary:

onebusaway-gtfs provides an extension mechanism (via onebusaway-csv-entities) which can be used when reading and writing GTFS feeds (in order to read or write fields which are not declared in the model class). However, there is no mechanism for transform strategies in onebusaway-gtfs-transformer to register their intention to use a particular extension, so when GtfsTransformer reads or writes GTFS, transforms are unable to register their extensions with the EntitySchemaFactory, and thus extensions are neither read nor written.

Note that there are some code fragments (specifically, the SchemaUpdateStrategy class, and GtfsTransformer.writeGtfs()) that suggest a prior effort to address this?

Somewhat (tangentially) related to #102, particularly as it pertains to modularizing/extracting agency-specific transforms (if they depend on extension fields).

Steps to reproduce:

  1. Implement GtfsTransformStrategy.
  2. Call .putExtension() or .getExtension() on an instance of a GTFS model class.

Expected behavior:

GTFS transform strategies should be able to declare the extensions they will use when reading or writing feeds.

Observed behavior:

GTFS transform strategies are not able to declare the extensions they will use, so they are not able to use the extension mechanism to read or write columns other than those declared in the model classes.

Sample implementation in a38a2aa - @sdjacobs if this is of interest I can open a PR...