Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when service exceptions are outside service dates? #1241

Closed
josiekre opened this issue Aug 3, 2018 · 5 comments
Closed

Bug when service exceptions are outside service dates? #1241

josiekre opened this issue Aug 3, 2018 · 5 comments
Labels

Comments

@josiekre
Copy link

josiekre commented Aug 3, 2018

I might be missing something, but I'm almost certain I've found a discrepancy between the original GTFS and the resulting schedules from schedule_stop_pairs.

For example, from SHA1 ff834518ff5728fc178966b3465c5057c3ade019, route r-dqcjp-nm for trips 47 and 48 have a service end date of 2018-12-25 but they should be 2018-03-31.

There's a service exception on 2018-12-25 for this service ID (in GTFS Red_Winter_Monday_Friday), which is invalid because it is past the service end date. This might be what has caused the service end date in the API to span past its actual service date.

I caught this because there are repetitive services for this route between 2018-03-31 until 2018-12-25 now when pulling data from the API.

@josiekre josiekre changed the title Discrepancy between S3 bucket gtfs zip and the response from API w/ same sha1 Bug when service exceptions are outside service dates? Aug 3, 2018
@drewda drewda added the question label Aug 6, 2018
@drewda
Copy link
Member

drewda commented Aug 6, 2018

Hi @josiekre, thanks for your question. You are right that there are occasionally differences between original GTFS feeds and ScheduleStopPair contents. When the contents of a feed are about to expire, Transitland automatically extends the appropriate SSPs out into the future. This is so that routing engines that use Transitland data will still return trips to their users -- the schedules may be out of date, but many routing providers would rather provide something rather than nothing to their users.

If a feed version has had its schedule extended, you should see tags called extend_to_date and extend_from_date. For example, see this feed version: http://transit.land/api/v1/feed_versions/55b23bcff5ccf13a08e1b1fbe49308e34f086ebd

If you have any follow ups, feel free to comment and we'll reopen the issue.

@drewda drewda closed this as completed Aug 6, 2018
@josiekre
Copy link
Author

josiekre commented Aug 6, 2018

That does not seem to be the case for this feed. See: http://transit.land/api/v1/feed_versions/ff834518ff5728fc178966b3465c5057c3ade019.

In short, this feed had two service IDs for one route (Red bus line) Monday - Friday, one which went Jan 1 - March 31 2018 and the other which goes Apr 1 - Oct 6 2018. Right now, both are returning in the feed even though the first should be gone.

Thanks for looking into this with me.

@drewda
Copy link
Member

drewda commented Aug 24, 2018

@josiekre you're right, this is likely a different issue than feed extension.

FWIW, we do have a test to catch situations of service exceptions that are provided outside of actual service windows: https://github.com/transitland/transitland-datastore/blob/master/spec/models/schedule_stop_pair_spec.rb#L306-L322

We'll see if there are any other explanations for this behavior.

@irees
Copy link
Member

irees commented Oct 20, 2018

@josiekre
Hi, your initial assumption is correct. When importing GTFS, Transitland expands the service start_date/end_date to include all service exceptions. See: https://github.com/transitland/gtfs/blob/master/lib/gtfs/service_period.rb#L78-L84 .

This was to simplify some of the "service on date" queries, but in retrospect may have been a poor decision. I agree it should probably be handled differently, e.g. only expanding the service range when reading only from calendar_dates.txt without a value from calendars.txt. I created an issue for making this change. #1261

@josiekre
Copy link
Author

I'm solving it on my end right now by looking for unique service per route somehow (I think). It's a while ago so the details escape me. But I'm going to close this since you've moved it to a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants