trynmaps / tryn-api Goto Github PK
View Code? Open in Web Editor NEWOpenTransit API for historical transit vehicle location data
License: Apache License 2.0
OpenTransit API for historical transit vehicle location data
License: Apache License 2.0
Implementing https://github.com/trynmaps/orion/wiki/Point-Reliability
This has been long overdue, but given that we're only showing all the vehicles at a given time, having all this data in a Cassandra database is pretty expensive ($200/month) with little benefit.
Using S3 is just as good for supporting the web-app, and as for doing geo-query analysis, Cassandra would've required setting up ElasticSearch or Spark on it, so we might as well make a new database from scratch optimized for geo-analysis. As for trip analysis, reading trips from S3 should be good enough (can be directly used in Jupyter - or use Spark notebook), with aggregated data eventually being stored in a more flexible DB like Postgres.
This ticket tracks modifying the API to use S3 such that it remains unchanged (ie. existing queries will continue to work).
Using the API to track schedule adherence for Marin Tiburon ferry bus route.
Actual: fetches stops regardless of whether the field's included in the query
Expected: shouldn't do so as it's an unnecessary network call
Right now, a query looks like this:
{
trynState(agency: "muni", startTime: "1515272617534", endTime: "1515273457194") {
agency
startTime
states {
time
routes {
name
stops {
sid
name
lat
lon
}
vehicles {
vid
lat
lon
heading
}
}
}
}
}
The route name along with all the stop info will be duplicated. The reason stops can't be moved upwards is because a stop belongs to a route. At the same time, the route name is also duplicated, as would any future metadata.
The proposed schema layout is as such:
{
trynState(agency: "muni", startTime: "1515272617534", endTime: "1515273457194") {
agency
startTime
routes {
rid
stops {
sid
name
lat
lon
}
routeStates {
vtime
vehicles {
vid
lat
lon
heading
}
}
}
}
}
Goal: make this part of the Vehicle type so that the client will know for certain which direction a bus is moving towards
We currently only return stops
for Muni, but not for the other agencies, including the TTC (easy to add as it uses Nextbus), Marin (have to make separate API call), and GRT (on the roadmap).
However, a better solution to this seems to have a separate API called tryn-stops that does this for us by either making an API call, or by looking it up in the GTFS file (it should have all the stops by route in memory).
This would involve:
goal: request an agency's gtfs from a certain day using the API
Why? Needed for accurate stops, routes, frequency, and schedule adherence
I was looking at the schema and saw TrynState
and trynstate
. I don't know what other things might break if they're changed though.
and ensure it's been moved over to orion, which used it for the s3 migration
Currently, tryn-api ignores the endTime and only answers the startTime with one state.
Expected behaviour is to return multiple states
instead of just one as it currently does. This is blocking the SpeedViz project - https://github.com/trynmaps/orion/wiki/Speed-Visualizations-(SpeedViz)-Design-Proposal
2-car Muni trains (on all lines except J) have both their cars show up in Nextbus. This can be observed on the web-app map.
For the MVP, this causes the median/average observed headways between cars to be much lower than what they really were.
Issues:
Notes:
Possible Approaches:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.