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

Add extension for MTA buses #2

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

cedarbaum
Copy link
Collaborator

@cedarbaum cedarbaum commented Mar 23, 2023

Add an extension for MTA bus GTFS realtime data which transforms the TripIds to be a combination of (1) the original TripId, (2) the VehicleId and (3) the DirectionId. This is an attempt to ensure that TripIds are unique so they can be followed accurately between updates.

extensions/nyctbustrips/nyctbustrips.go Outdated Show resolved Hide resolved
tripId := trip.Trip.GetTripId()
vehicleId := trip.Vehicle.GetId()
direction := trip.Trip.GetDirectionId()
compositeTripId := strings.Replace(fmt.Sprintf("%s_%s_%d", tripId, vehicleId, direction), " ", "_", -1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a related note, I think with this code the Trip ID may now vary across the trip? Like initially the trip won't have a vehicle assigned. Then when a vehicle is assigned, the trip ID will change. In Transiter this will result in any existing data for the trip being deleted when the ID change happens. I think this is totally fine (and we can always change it down the line) but just mentioning it anyway.

Copy link
Collaborator Author

@cedarbaum cedarbaum Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great point - I think truly tracking a trip end-to-end will be tricky with this feed's structure unfortunately 🙃.

@jamespfennell
Copy link
Owner

Thanks for new commits!

@jamespfennell jamespfennell merged commit 82b1e64 into jamespfennell:main Mar 29, 2023
jamespfennell added a commit to jamespfennell/transiter that referenced this pull request Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants