| Title: | Validate and Analyse 'GTFS' Schedule Feeds with 'GTFS Analyzer' |
|---|---|
| Description: | An interface to the 'GTFS Analyzer' command line validator <https://github.com/ttezer/gtfs-analyzer> for 'GTFS' (General Transit Feed Specification) Schedule feeds. Runs the validator on a feed archive and returns publishability, quality scores and findings as R objects, and compares two versions of a feed. The validator is a standalone executable; it can be installed into the user cache directory with a checksum-verified download, or an existing executable can be used. |
| Authors: | Tacettin Tezer [aut, cre] |
| Maintainer: | Tacettin Tezer <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-11-26 15:37:57 UTC |
| Source: | https://github.com/ttezer/gtfs-analyzer |
Runs GTFS Analyzer on a GTFS Schedule ZIP archive and returns the publishability verdict, quality scores and findings.
ga_analyze(feed, lang = "en", today = NULL, max_notices_per_rule = NULL)ga_analyze(feed, lang = "en", today = NULL, max_notices_per_rule = NULL)
feed |
Path to a GTFS ZIP archive. |
lang |
Language of titles, messages and remediations: one of '"en"', '"tr"', '"ja"', '"fr"' or '"es"'. |
today |
Validation date as '"YYYYMMDD"', or 'NULL' for the current date. |
max_notices_per_rule |
Keep at most this many findings per rule, or 'NULL' for all. Scores and the verdict always cover every finding. |
The validator's exit code 1 only means that findings exist; it is not treated as an error. A feed the validator cannot read at all (exit code 2) signals an error of class 'gtfsanalyzer_fatal'.
An object of class 'ga_result': a list with 'publishable', 'scores' (named numeric), 'notices' (data frame), 'status', 'engine' and 'raw' (the parsed JSON).
if (nzchar(ga_binary(required = FALSE))) { res <- ga_analyze(system.file("extdata", "sample-feed.zip", package = "gtfsanalyzer")) res }if (nzchar(ga_binary(required = FALSE))) { res <- ga_analyze(system.file("extdata", "sample-feed.zip", package = "gtfsanalyzer")) res }
Looks, in order, at the 'GTFS_ANALYZER_BIN' environment variable, the 'gtfsanalyzer.bin' option, the copy installed by [ga_install()] for the pinned engine version, and finally 'gtfs-analyzer' on the 'PATH'.
ga_binary(required = TRUE)ga_binary(required = TRUE)
required |
If 'TRUE', signal an error when no executable is found. |
The path to the executable, or '""' when none is found and 'required' is 'FALSE'.
ga_binary(required = FALSE)ga_binary(required = FALSE)
Validates both feeds (or takes existing [ga_analyze()] results) and reports per rule how the number of findings changed, plus the change in scores. Useful before and after editing a timetable.
ga_compare(before, after, ...)ga_compare(before, after, ...)
before, after
|
Paths to GTFS ZIP archives, or 'ga_result' objects. |
... |
Passed to [ga_analyze()] when a path is given. |
An object of class 'ga_comparison': a list with 'rules' (data frame with 'rule_id', 'severity', 'before', 'after', 'change' and 'state', one of '"new"', '"resolved"', '"increased"', '"decreased"'), 'scores' (data frame of before/after/delta) and 'publishable' (before/after).
if (nzchar(ga_binary(required = FALSE))) { f <- system.file("extdata", "sample-feed.zip", package = "gtfsanalyzer") ga_compare(f, f) }if (nzchar(ga_binary(required = FALSE))) { f <- system.file("extdata", "sample-feed.zip", package = "gtfsanalyzer") ga_compare(f, f) }
Downloads the release archive for the current platform from GitHub, verifies its SHA256 checksum against the value pinned in this package and unpacks it into the user cache directory ([tools::R_user_dir()]). Nothing is downloaded unless this function is called. Verification needs the 'openssl' package; without it the function stops before downloading.
ga_install(version = ga_engine_version, force = FALSE)ga_install(version = ga_engine_version, force = FALSE)
version |
Engine version to install. Only versions with a pinned checksum can be installed. |
force |
Reinstall even if the executable is already present. |
The path to the installed executable, invisibly.
## Not run: ga_install() ## End(Not run)## Not run: ga_install() ## End(Not run)
List the validator's rules
ga_rules(lang = "en")ga_rules(lang = "en")
lang |
Language of titles: one of '"en"', '"tr"', '"ja"', '"fr"', '"es"'. |
A data frame with one row per rule: 'id', 'severity', 'class', 'authority_source', 'base_effort' and 'title'.
if (nzchar(ga_binary(required = FALSE))) { head(ga_rules()) }if (nzchar(ga_binary(required = FALSE))) { head(ga_rules()) }