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 support for real time GTFS feed #24

Merged
merged 6 commits into from
Apr 26, 2024
Merged

Conversation

Andykmcc
Copy link
Contributor

@Andykmcc Andykmcc commented Apr 24, 2024

This PR adds support for real time gtfs data. Set and env var for each data type endpoint. our data source is a touch rate limit of 60 reqs per hour so i had to build a cache into the solution right out of the gate. the results are cached for 60 seconds. If you set a CACHE_URL env var then they will go to the redis compat. cache server or they will just be cached in memory in the node process.

The responses are all pretty large (72KB, 560KB and 3.5 MB). I added the ability to filter by tripid and routeid to the vehicle position api and the trip updates api. i skipped adding filters to the service alerts api because i dont know what is a useful way to filter them and the response is <100KB so 🤷 ...

I dont like all the cache logic sprinkled through the controller code but i decided to try to write it all out here to make sure i understood the desired rules and figured we can come up with a more elegant implementation later. ideally some kind of decorator/middleware for the route that just like @cache(60) or something like that.

I also cleaned up the docker-compose since i haven't touch this in a while.

  • upgrade node v20.12
  • Add real time vehicle position endpoint
  • add support for redis cache
  • fix docker compose file
  • add real time alerts endpoint
  • add real time trip update

@Andykmcc Andykmcc requested a review from arindam1993 April 24, 2024 04:37
@Andykmcc Andykmcc changed the title andy/add api 511 route Add support for real time GTFS feed Apr 24, 2024
@Andykmcc Andykmcc force-pushed the andy/add-api-511-route branch from c416def to 925586b Compare April 26, 2024 05:49
@Andykmcc Andykmcc merged commit 925586b into main Apr 26, 2024
6 checks passed
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.

1 participant