View source: R/utils-helpers.R
| filter_by_validation | R Documentation |
Filter feed or dataset results by validation quality thresholds. This is a
convenience wrapper around get_validation_report() that returns the original
data filtered to only include feeds/datasets meeting your quality criteria.
Note: This function does not support GBFS validation reports at this time as GBFS validation reports are located at a different endpoint and have a different validation criteria.
filter_by_validation(
data,
max_errors = NULL,
max_warnings = NULL,
max_info = NULL,
require_validation = TRUE
)
data |
A tibble from |
max_errors |
Maximum number of validation errors allowed. Use |
max_warnings |
Maximum number of validation warnings allowed. If |
max_info |
Maximum number of informational notices allowed. If |
require_validation |
Logical. If |
A filtered version of the input data frame containing only feeds/datasets that meet the specified quality criteria.
get_validation_report() to inspect validation metrics,
view_validation_report() to view full validation reports
# Create sample data with validation information (search results structure)
sample_data <- tibble::tibble(
id = c("mdb-1", "mdb-2", "mdb-3"),
provider = c("Agency A", "Agency B", "Agency C"),
latest_dataset = tibble::tibble(
id = c("mdb-1-202501", "mdb-2-202501", "mdb-3-202501"),
validation_report = tibble::tibble(
total_error = c(0L, 5L, 100L),
total_warning = c(10L, 50L, 500L),
total_info = c(5L, 10L, 20L)
)
)
)
# Filter to feeds with zero errors
filter_by_validation(sample_data, max_errors = 0)
# Filter with multiple criteria
filter_by_validation(sample_data, max_errors = 10, max_warnings = 100)
# With real API data:
ca_feeds <- feeds(
country_code = "US",
subdivision_name = "California",
data_type = "gtfs"
)
clean_feeds <- filter_by_validation(ca_feeds, max_errors = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.