Open coding-to-music opened 1 year ago
This appears to be an error within the tidytransit package.
tidytransit believes the primary_key
field for the fare_products.txt
table is the fare_product_id
column:
# fare_products
m$fare_products <- spec_setup_fields(
c("fare_product_id", "fare_product_name", "amount",
"currency"),
c("req", "opt", "req", "req"),
c("character", "character", "numeric", "numeric"), # TODO currency should be handled with integers
"opt",
"fare_product_id") ## primary_key ##
Per GTFS documentation, https://gtfs.org/schedule/reference/#fare_productstxt, the primary key is a combination of fare_product_id
and fare_media_id
:
fare_products.txt¶
File: Optional
Primary Key (fare_product_id, fare_media_id)
fare_media_id
can also be NULL in the fare_products.txt
table, so tidytransit would also have to handle that.
It's an interesting question - MBTA is not responsible for Tidytransit - and Tidytransit is trying to be compatable with all the transit systems in the world - not sure if the files are expected to be automatically importable - Tidytransit is not able to read documentation, the files are expected to be self-importable. Having a unique index sequence id column could solve the problem. Otherwise people are not going to be able to use Tidytransit for MBTA and will spin for hours/days trying to figure out the problem. But technically it's not MBTA's problem if a third party can't read the files... It is interesting that all the many other files in the MBTA.zip are able to be read. Anyway, just fyi about this issue. Thx
Hello, I was running this project:
https://github.com/coding-to-music/r-stringlines-nyc-mta-gtfs-train-visualization
And I saw an error using tidytransit with the MBTA GTFS feed, a new file fare_products.txt
https://github.com/mbta/gtfs-documentation/pull/34
produces this error when running the R program:
To fix, back up the zip file so you have an original copy:
Now remove the offending file from the zip file
Now the file can be used as normal
I was able to produce many stringlines, after the fare_products.txt was removed
https://github.com/coding-to-music/r-stringlines-nyc-mta-gtfs-train-visualization/tree/main/stringlines