Closed barbeau closed 6 years ago
Good outline of CSV parsing methods at https://github.com/arnaudroger/SimpleFlatMapper/wiki/How-to-parse-a-csv-file-in-java.
I'd prefer to use Jackson as we're using it elsewhere and it provides a structured parsing method based on a POJO.
Here's the info for Jackson CSV databinding with POJOs: https://github.com/FasterXML/jackson-dataformats-text/tree/master/csv#data-binding-with-schema
Summary:
There are some feeds returned by TransitFeeds.com API that require API keys, and therefore the GTFS-realtime public URL endpoint isn't retrievable from the TransitFeeds.com API -
feed.getUrls().getDownloadUrl()
returns an empty string.One example is TriMet in Portland, OR - here's their developer page: https://developer.trimet.org/GTFS.shtml
Data is at:
...but for the GTFS-rt feeds you need to append a
&appID=0000000000000000000000000
where the 0s are your API key.Luckily, for these feeds TransitFeeds.com does give you an info URL (
feed.getUrls().getInfoUrl()
) which looks to be the page where you can sign up for an API key. So we can use this info to start tracking down API keys for these known feeds (see bottom of this issue for a list I pulled from the API).After we have API keys, we need a way to specify these feeds in a separate CSV file that we can use as input to this tool so the feeds that require API keys can be included in the analysis.
Here's a sample CSV format for
feeds.csv
:feed_ids
should have a negative number so they don't collide with IDs from TransitFeeds.com. The subfolder created for the feed should be named thefeed_id
(for example,-1-Portland, OR, USA
). The GTFS feed should only be downloaded once, and should be renamed togtfs.zip
in the folder. So, ifgtfs.zip
already exists, don't download it again.The code to download these feeds should be implemented in a separate class
CsvFeedsDownloader
so it can be used independently of theTransitFeedsDownloader
(we may have other downloaders too, e.g., for Transitland - see https://github.com/CUTR-at-USF/transit-feed-quality-calculator/issues/4).@Suryakandukoori Could you please take a look at this? I'm open to alternate formats for the CSV, or it could be JSON too I suppose. Just something simple we can hand-edit to add feeds ourselves.
Steps to reproduce:
Expected behavior:
Be able to download and validate feeds that require API keys
Observed behavior:
Currently feeds with API keys have blank download URLs in the TransitFeeds.com, and therefore as simply skipped over when trying to download GTFS-realtime and GTFS feeds.
List of feeds from TransitFeeds.com we need API keys for, along with dev website URL
We may also need to include Denver RTD as well - here's the error message we're currently getting for those URLs: