Retrieve GTFS data with a GraphQL query (nodejs graphql-yoga) from a database (npm gtfs + mongoose + MongoDB)
Use case is made with Montreal public transit agencies: exo, RTL and STM
docker login docker.pkg.github.com
Use your Github username and your Github developer token as password.
docker-compose up -d
docker-compose up -d --build serviceoffer
GraphQL query console: http://localhost:4000
MongoDB admin: http://localhost:8082/
Connection URI: mongodb://mongo:27017/gtfs
curl --request POST \
--url http://localhost:3000/import_gtfs
curl --request GET \
--url http://localhost:3000/export_gtfs
Query available agencies
query {
agencies {
agency_key
}
}
Query RTL specific data
query {
agencies(agency_key: "rtl_gtfs") {
routes(route_id: "889") {
route_long_name
trips(direction_id: "1") {
trip_id
}
}
}
}
Modify agency name
mutation {
agency(agency_key: "rtl_gtfs", agency_name: "ralph") {
agency_name
}
}
Modify stop arrival time to 05:32:56
mutation {
stopTime(agency_key:"rtl_gtfs", trip_id:"889_1_A_F2_8833_24_40", arrival_time:"05:32:56"){
arrival_time
}
}
curl --request POST \
--url http://localhost:4000/graphql \
--header 'content-type: application/json' \
--data '{"query":"{\n agencies {\n agency_key\n }\n}\n"}'
You are welcome to contribute either directly via GitHub Pull Request or via Gerrit: https://review.gerrithub.io/q/project:transitco/serviceOffer+status:open
Intial setup to use Gerrit:
pip install git-review
Create a change:
git checkout -b BRANCH_NAME
git add .
git commit -m "MESSAGE"
git review
Modify an existing change:
git review -d CHANGE_ID
git add .
git commit --amend
git review