{"id":13423688,"url":"https://github.com/tmelliott/transitr","last_synced_at":"2026-01-18T04:42:43.624Z","repository":{"id":85571721,"uuid":"141076616","full_name":"tmelliott/transitr","owner":"tmelliott","description":"An R package for constructing and modelling a transit network in real time to obtain vehicle ETAs","archived":false,"fork":false,"pushed_at":"2023-06-06T11:05:35.000Z","size":5478,"stargazers_count":23,"open_issues_count":18,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-06-27T07:02:33.766Z","etag":null,"topics":["gtfs","gtfs-realtime","r","transit"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmelliott.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-07-16T02:25:19.000Z","updated_at":"2025-01-22T15:59:52.000Z","dependencies_parsed_at":"2023-10-11T07:45:54.753Z","dependency_job_id":null,"html_url":"https://github.com/tmelliott/transitr","commit_stats":{"total_commits":543,"total_committers":1,"mean_commits":543.0,"dds":0.0,"last_synced_commit":"4aa1b3276a6e2ab813075eaab8fab536b7da2432"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tmelliott/transitr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmelliott%2Ftransitr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmelliott%2Ftransitr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmelliott%2Ftransitr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmelliott%2Ftransitr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmelliott","download_url":"https://codeload.github.com/tmelliott/transitr/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmelliott%2Ftransitr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28530015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gtfs","gtfs-realtime","r","transit"],"created_at":"2024-07-31T00:00:40.685Z","updated_at":"2026-01-18T04:42:43.603Z","avatar_url":"https://github.com/tmelliott.png","language":"C++","readme":"# transitr\n\n[![Travis build status](https://travis-ci.org/tmelliott/transitr.svg?branch=develop)](https://travis-ci.org/tmelliott/transitr)\n[![codecov](https://codecov.io/gh/tmelliott/transitr/branch/develop/graph/badge.svg)](https://codecov.io/gh/tmelliott/transitr)\n\nThe goals of `transitr` are to make it easy to __load GTFS data__ into a database,\nconstruct a __transit network__ of roads and intersections,\nand __model vehicles in real-time__ from an API feed to update the network\nand __generate ETAs__.\n\n\n# install\n\n`transitr` is not (yet) on CRAN, so for you would need to use `devtools`:\n```r\ndevtools::install_github('tmelliott/transitr')\n```\n\n\n# usage\n\n__Still under development!__\nThis here is just for demonstration of what it could be like at some point\nin the future.\n\n```r\nlibrary(transitr)\nlibrary(magrittr)\n\n## Create a database, construct network, and connect to a realtime feed\ndbname \u003c- \"realtime.db\"\nnw \u003c- create_gtfs(\"https://cdn01.at.govt.nz/data/gtfs.zip\", db = dbname) %\u003e%\n    construct() %\u003e%\n    realtime_feed(\"https://api.at.govt.nz/v2/public/realtime/vehiclelocations\",\n                  with_headers(\"Ocp-Apim-Subscription-Key\" = \"mykey\"),\n                  response = \"protobuf\")\n\n## Set the parameters and then run the model\nnw %\u003e% \n    set_parameters(n_core = 2, \n                   n_particles = 500, \n                   gps_error = 5) %\u003e%\n    model()\n```\n\nOnce running, you can launch a new R session and view the shiny app:\n```r\ntransitr::view_realtime(\"realtime.db\")\n```\n\n\n# mock data server\n\nIn order to facilitate model development and checking, there's also a mock data server\nin the `simulations` directory.\n\nTo install:\n```bash\ncd simulations\nyarn \n\n## or if you don't use yarn\nnpm install\n```\n\nTo start the server, you need first an archive of vehicle position feeds,\n```bash\nls archive | grep vehicle | head -n 5\n# vehicle_locations_20180911050001.pb\n# vehicle_locations_20180911050031.pb\n# vehicle_locations_20180911050102.pb\n# vehicle_locations_20180911050132.pb\n# vehicle_locations_20180911050201.pb\n\nyarn start\n# yarn run v1.9.4\n# $ node mock_server.js\n# Mock GTFS server running on port 3000!\n```\n\nNow you can run the model with the local server, which will automatically serve \nthe next file with each request.\n```r\n## assumeing you've constructed with simulation flag:\n## $ make FLAGS=\"-DSIMULATION\"\n## simulation history will be saved in a `history` directory\ndir.create(\"history\")\n\n## set some process ID for the server to recognise (allows running multiple simulations simultaneously)\npid \u003c- \"test1\"\nnw \u003c- load_gtfs(\"fulldata.db\") %\u003e%\n    realtime_feed(sprintf(\"http://localhost:3000/%s/vehicle_positions\", pid),\n                  response = \"protobuf\") %\u003e%\n    set_parameters(n_core = 1,\n                   n_particles = 2000,\n                   gps_error = 10)\n\nnw %\u003e% model()\n```\n","funding_links":[],"categories":["C++","Producing Data","Uncategorized"],"sub_categories":["GTFS","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmelliott%2Ftransitr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmelliott%2Ftransitr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmelliott%2Ftransitr/lists"}