View source: R/validate_gtfs.R
| validate_gtfs | R Documentation |
Run the MobilityData Canonical GTFS Schedule Validator on a ZIP archive or a GTFS object and return its findings. The validator checks the official GTFS Schedule specification and produces additional best-practice notices.
validate_gtfs(
gtfs,
validator_jar = NULL,
output_dir = NULL,
quiet = FALSE,
download_validator = FALSE
)
gtfs |
Path to a local GTFS ZIP archive or a named list of GTFS tables,
including a |
validator_jar |
Optional path to a MobilityData validator CLI JAR.
When |
output_dir |
Optional directory in which to keep the validator's
reports. It must not exist or must be empty. When |
quiet |
Logical. If |
download_validator |
Logical. If |
Requires Java 17 or newer and the suggested package jsonlite. Supply a
MobilityData CLI JAR from https://github.com/MobilityData/gtfs-validator/releases
(version 8.0.1 or newer recommended), or explicitly set
download_validator = TRUE to download version 8.0.1. The cached download's
SHA-256 is checked against the published release checksum before each use.
The ZIP is passed directly to the validator without importing or repairing
it. An object is first exported with write_gtfs(); its report describes the
exported representation, not the original file or any previously repaired
data. No data are uploaded by this function. Results depend on the validator
version and its implemented rules; no errors found is not a certification.
The output directory must be empty to avoid overwriting existing reports or confusing a failed execution with a previous successful one.
A list with class gtfs_validation: notices, a data frame with
rule codes, severities, occurrence counts and sample details;
system_notices, a data frame of system errors; report and
system_errors, the parsed JSON reports; has_errors, TRUE or FALSE
when validation completed with recognized severities and without system
errors, otherwise NA; and
report_path, system_errors_path, html_path, and output_dir, which
are NULL when reports are not saved. The result is returned invisibly.
read_gtfs(), write_gtfs(),
https://gtfs.org/getting-started/validate/
# Requires Java 17 or newer, jsonlite and openssl, and initially internet:
## Not run:
result <- validate_gtfs(for_rail_gtfs, download_validator = TRUE)
result$notices
# Supply output_dir to keep the HTML and JSON reports:
result <- validate_gtfs(for_rail_gtfs, output_dir = "validation-report",
download_validator = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.