{"id":37975680,"url":"https://github.com/jasonad123/mobdb","last_synced_at":"2026-01-16T18:30:08.476Z","repository":{"id":322354938,"uuid":"1089078451","full_name":"jasonad123/mobdb","owner":"jasonad123","description":"R package for accessing the Mobility Database","archived":false,"fork":false,"pushed_at":"2026-01-10T15:47:01.000Z","size":4032,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-10T21:25:49.132Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://mobdb.jasonadle.com","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonad123.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-03T21:20:52.000Z","updated_at":"2026-01-10T02:50:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jasonad123/mobdb","commit_stats":null,"previous_names":["jasonad123/mobdb"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jasonad123/mobdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonad123%2Fmobdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonad123%2Fmobdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonad123%2Fmobdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonad123%2Fmobdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonad123","download_url":"https://codeload.github.com/jasonad123/mobdb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonad123%2Fmobdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-16T18:30:07.074Z","updated_at":"2026-01-16T18:30:08.426Z","avatar_url":"https://github.com/jasonad123.png","language":"R","readme":"# mobdb \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"180\" alt=\"logo\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n[![R-CMD-check](https://github.com/jasonad123/mobdb/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jasonad123/mobdb/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/jasonad123/mobdb/graph/badge.svg)](https://app.codecov.io/gh/jasonad123/mobdb)\n[![mobdb status badge](https://jasonad123.r-universe.dev/mobdb/badges/version)](https://jasonad123.r-universe.dev/mobdb)\n\u003c!-- badges: end --\u003e\n\n**mobdb** provides R functions to search and access transit feed data from the [Mobility Database](https://mobilitydatabase.org). The package wraps the Mobility Database Catalog API, enabling the discovery of GTFS (General Transit Feed Specification) Schedule, GTFS Realtime, and GBFS (General Bikeshare Feed Specification) feeds from organizations worldwide.\n\n## Installation\n\nTo get started, install it from [r-universe](https://jasonad123.r-universe.dev/mobdb):\n\n```r\n# Install from r-universe\ninstall.packages('mobdb', repos = c('https://jasonad123.r-universe.dev', 'https://cloud.r-project.org'))\n```\n\nAlternatively, you can install also install `mobdb` from GitHub:\n\n```r\n# Install using pak (recommended)\n# install.packages(\"pak\")\npak::pak(\"jasonad123/mobdb\")\n\n# Or using remotes\n# install.packages(\"remotes\")\nremotes::install_github(\"jasonad123/mobdb\")\n```\n\n## Authentication\n\nTo use the Mobility Database Catalog API, you need a refresh token:\n\n1. Sign up at [mobilitydatabase.org](https://mobilitydatabase.org)\n2. Navigate to your account details page to view your refresh token\n3. Set your token in R:\n\n```r\nlibrary(mobdb)\n\n# For current session only\nmobdb_set_key(\"your_refresh_token_here\")\n\n# To save permanently in .Renviron\nmobdb_set_key(\"your_refresh_token_here\", install = TRUE)\n```\n\nAlternatively, you can set the `MOBDB_REFRESH_TOKEN` environment variable in your `.Renviron` file.\n\n## Usage\n\n### Search for feeds\n\n```r\n# Search by provider name\nbart_feeds \u003c- feeds(provider = \"BART\")\n\n# Filter feeds by location\non_feeds \u003c- feeds(\n  country_code = \"CA\",\n  subdivision_name = \"Ontario\",\n  data_type = \"gtfs\"\n)\n\n# Or search generically\ntoronto \u003c- mobdb_search(provider = \"toronto\")\n\n# Note: mobdb_search() has known issues with relevance ranking. \n# Use feeds() with filters for more precise results.\n\n```\n\n### Download GTFS Schedule feeds\n\nThe `download_feed()` function downloads GTFS Schedule feeds by feed ID or by searching for providers/locations.\n\n```r\nlibrary(tidytransit)\nlibrary(gtfsio)\n\n# Download by feed ID\nstm_montreal \u003c- download_feed(\"mdb-2126\")\n\n# Download by provider name (excludes GTFS-Flex feeds automatically)\nbart_gtfs \u003c- download_feed(provider = \"BART\")\n\n# Use feed_name parameter when multiple feeds exist for a provider\ndc_bus \u003c- download_feed(provider = \"WMATA\", feed_name = \"Bus\")\n\n# Download from agency source URL instead of MobilityData hosted version\nkcm_gtfs \u003c- download_feed(provider = \"King County\", use_source_url = TRUE)\n\n# Filter by location\non_gtfs \u003c- download_feed(\n  country_code = \"CA\",\n  subdivision_name = \"Ontario\"\n)\n\n# Export as GTFS zip file\npdx_gtfs \u003c- download_feed(\"mdb-247\")\nexport_gtfs(stm_montreal, \"data/gtfs/trimet.zip\")\n\n# Check exported file contents\nzip::zip_list(\"data/gtfs/trimet.zip\")$filename\n#\u003e [1] \"agency.txt\"         \"calendar.txt\"       \"calendar_dates.txt\"\n#\u003e [4] \"feed_info.txt\"      \"routes.txt\"         \"shapes.txt\"\n#\u003e [7] \"stops.txt\"          \"stop_times.txt\"     \"trips.txt\"\n```\n\n**Note:** When multiple feeds match your search criteria, the function displays a table of options and prompts you to specify which feed to download using its feed ID.\n\n```r\ngtfs \u003c- download_feed(provider = \"San Francisco\")\n#\u003e Searching for GTFS Schedule feeds...\n#\u003e ! Found 2 matching feeds:\n#\u003e\n#\u003e # A tibble: 2 × 4\n#\u003e   id     provider                                          feed_name status\n#\u003e   \u003cchr\u003e  \u003cchr\u003e                                             \u003cchr\u003e     \u003cchr\u003e\n#\u003e 1 mdb-62 San Francisco Bay Area Water Emergency Transp... \"\"        active\n#\u003e 2 mdb-50 San Francisco Municipal Transportation Agency ... \"\"        inactive\n#\u003e\n#\u003e Error: Multiple feeds found. Please specify which one to download.\n#\u003e Use `download_feed(feed_id = \"mdb-XXX\")` with one of the IDs above.\n```\n\n### Smart feed selection with `download_best_feed()`\n\nThe `download_best_feed()` function provides intelligent, one-shot downloading with automatic feed selection. It ranks feeds by status (active \u003e future \u003e inactive \u003e deprecated), official designation, validation quality, and service date coverage.\n\n```r\n# Simple one-shot download - automatically selects the best feed\nbart_feed \u003c- download_best_feed(provider = \"Bay Area Rapid Transit\")\n\n# Download with quality filtering - only error-free feeds\nclean_feed \u003c- download_best_feed(\n  provider = \"Capital Metro\",\n  max_validation_errors = 0\n)\n\n# Location-based search\nontario_feed \u003c- download_best_feed(\n  country_code = \"CA\",\n  subdivision_name = \"Ontario\"\n)\n\n# Interactive mode prompts when multiple equally-ranked feeds exist\nwmata_feed \u003c- download_best_feed(provider = \"WMATA\")\n#\u003e Multiple GTFS Schedule feeds found. Please select one:\n#\u003e   1. [mdb-1124] Washington Metropolitan Area Transit Authority (Bus)\n#\u003e      Status: active | Official: TRUE | Errors: 0 | Warnings: 23\n#\u003e      Service: 2024-11-15 to 2025-06-30\n#\u003e\n#\u003e   2. [mdb-1125] Washington Metropolitan Area Transit Authority (Rail)\n#\u003e      Status: active | Official: TRUE | Errors: 0 | Warnings: 15\n#\u003e      Service: 2024-12-01 to 2025-06-30\n#\u003e\n#\u003e Enter selection (1-2) or 'q' to quit: 1\n\n# Non-interactive mode for scripts\noptions(mobdb.interactive = FALSE)\nfeed \u003c- download_best_feed(provider = \"Metro Transit\")\n```\n\nThe function automatically falls back to historical datasets when the current feed is marked \"future\" or \"inactive\", ensuring you get usable data.\n\n**Note:** Like `download_feed()`, this function only works with GTFS Schedule feeds. For GTFS-RT or GBFS feeds, use `mobdb_read_gtfs()` or fetch URLs with `mobdb_get_feed()`.\n\n### Get feed details\n\n```r\n# Get detailed information about a specific feed\nfeed_info \u003c- mobdb_get_feed(\"mdb-247\")\n\n# Get just the download URL\nurl \u003c- mobdb_feed_url(\"mdb-247\")\n\n# Or extract URLs from multiple feeds (requires data_type for location filters)\nfeeds \u003c- feeds(country_code = \"US\", data_type = \"gtfs\", limit = 10)\nurls \u003c- mobdb_extract_urls(feeds)\n```\n\n### Check feed quality before downloading\n\nMobilityData validates all GTFS Schedule feeds through the canonical GTFS validator. You can check validation results before downloading:\n\n```r\n# Get validation report for a feed\ndatasets \u003c- mobdb_datasets(\"mdb-482\")  # Alexandria DASH\nvalidation \u003c- get_validation_report(datasets)\nvalidation\n#\u003e # A tibble: 1 × 12\n#\u003e   dataset_id    feed_id total_error total_warning total_info html_report\n#\u003e   \u003cchr\u003e         \u003cchr\u003e         \u003cint\u003e         \u003cint\u003e      \u003cint\u003e \u003cchr\u003e\n#\u003e 1 mdb-482-2025… mdb-482           0            38          0 https://...\n\n# View detailed validation report in browser\nview_validation_report(\"mdb-482\")\n\n# Check feed quality, then download if clean\nif (validation$total_error == 0) {\n  gtfs \u003c- download_feed(\"mdb-482\")\n}\n```\n\n### Access historical datasets\n\n```r\n# List all available versions for a feed\nversions \u003c- download_feed(\"mdb-53\", latest = FALSE)  # BART\nnrow(versions)\n#\u003e [1] 29\n\n# Download a specific historical version\nhistorical \u003c- download_feed(dataset_id = \"mdb-53-202507240047\")\n\n# Compare validation across versions\nrecent_versions \u003c- versions[1:3, ]\nsapply(1:3, function(i) {\n  get_validation_report(recent_versions[i, ])$total_error\n})\n#\u003e [1]   2 266   2\n```\n\n### Using with tidytransit\n\nThe package provides three functions for working with [tidytransit](https://github.com/r-transit/tidytransit):\n\n- **`download_feed()`** - Download GTFS Schedule feeds with provider/location search (recommended)\n- **`download_best_feed()`** - Download \"best available\" GTFS Schedule feed for a selected provider\n- **`mobdb_read_gtfs()`** - More flexible reader that works with any GTFS feed type\n\n```r\nlibrary(tidytransit)\nlibrary(dplyr)\n\n# Download GTFS Schedule feed with search (recommended for most users)\ngtfs \u003c- download_feed(provider = \"TriMet\")\n\n# Or use mobdb_read_gtfs() for more flexibility\ngtfs \u003c- mobdb_read_gtfs(\"mdb-247\")\n\n# Pass a data frame from feeds()\nfeeds \u003c- feeds(provider = \"TriMet\", data_type = \"gtfs\")\ngtfs \u003c- mobdb_read_gtfs(feeds[1, ])\n\n# Or manually extract URLs and use tidytransit directly\nurls \u003c- mobdb_extract_urls(feeds)\ngtfs \u003c- read_gtfs(urls[1])\n\n# Now analyze with tidytransit\ngtfs$routes\ngtfs$stops\n```\n\n### Pagination\n\nFor large result sets, use pagination:\n\n```r\n# Get first 100 results\npage1 \u003c- feeds(limit = 100, offset = 0)\n\n# Get next 100 results\npage2 \u003c- feeds(limit = 100, offset = 100)\n```\n\n## Related Packages\n\n- [tidytransit](https://github.com/r-transit/tidytransit) - Read, validate, and analyze GTFS feeds\n- [gtfstools](https://github.com/ipeaGIT/gtfstools) - Edit and analyze GTFS feeds\n- [gtfsio](https://github.com/r-transit/gtfsio) - Read and write GTFS files\n\n## License\n\nMIT License\n\n## Disclaimers\n\n**Not Affiliated with MobilityData**: This package is an independent, community-developed project and is not officially affiliated with, endorsed by, or supported by MobilityData or the Mobility Database project. It is a third-party API wrapper created to facilitate R users' access to the Mobility Database.\n\n**Work in Progress**: This package is under active development. While all functions have been tested against the live API and the package passes R CMD check, the API structure may change, and some features are still being refined. Use in production environments at your own discretion.\n\n**Generative AI Assistance**: This code and documentation were developed with assistance from generative AI tools, including Claude and Claude Code. While all outputs have been reviewed and tested, users should validate results independently before use in production environments.\n","funding_links":[],"categories":["Producing Data"],"sub_categories":["GTFS"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonad123%2Fmobdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonad123%2Fmobdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonad123%2Fmobdb/lists"}