tulsawebdevs / django-multi-gtfs

Django app to import and export General Transit Feed Specification (GTFS)
http://tulsawebdevs.org/
Apache License 2.0
51 stars 33 forks source link

service_date table doesn't have feed_id field #54

Open francot opened 7 years ago

francot commented 7 years ago

service_date table doesn't have feed_id field so it's impossible manage multigtfs that use calendar_dates information

jwhitlock commented 7 years ago

A ServiceDate is related to the Feed through the Service, such as service_data.service.feed_id or ServiceDate.objects.filter(service__feed_id=1).

francot commented 7 years ago

Gtfs is also valid if come with empty calendar.txt file and all information about service_id validity in calendar_dates.txt File.

From GTFS reference: Alternate: Omit calendar.txt, and include ALL dates of service in calendar_dates.txt. If your schedule varies most days of the month, or you want to programmatically output service dates without specifying a normal weekly schedule, this approach may be preferable.

In this case without feed_id in the table I cannot associate service_id to trips.

jwhitlock commented 7 years ago

Yes, the "calendar_dates.txt only" strategy is the strategy used by the Portland TriMet feed, arguably one of the most important GTFS feeds. multigtfs handles this by adding a single Service record with a blank start_date and end_date, and relates the ServiceDate records to the Feed through this. On export, calendar.txt is omitted if there is only this "fake" Service record. See commit 2960772839ebc49ef398589e600155c845c84d8f for the changes and tests that aded this support.