transitio.validate_feed#
- transitio.validate_feed(path, *, max_entry_bytes=None, max_total_bytes=None, max_rows=None, max_columns=None, max_notices_per_file=None, reference_date=None)#
Validate a GTFS zip and return the collected notices.
The current rule set covers the structural tier (file presence, column shape, row shape, primary-key uniqueness) plus the field-format and referential-integrity tiers of transitio’s routing-oriented catalogue: date/time/number/enum/timezone formats, required and conditionally required fields, coordinate sanity, calendar and frequency ranges, agency consistency, parent-station relations and cross-table foreign keys. Semantic rules (stop-time progression, calendar coverage, shapes, frequency overlaps) follow. Notice codes and severities use the canonical gtfs-validator naming; the canonical grouped report rendering that merges these notices with hosted validation reports is provided by the upcoming report module, not by this function’s flat notice list.
- Parameters:
path (str or pathlib.Path) – Path of the GTFS
.zipfile.max_entry_bytes (int, optional) – Uncompressed-size budget per archive entry (default 1 GiB). A file over budget is reported as
unreadable_fileand skipped.max_total_bytes (int, optional) – Cumulative uncompressed-size budget (default 2 GiB), enforced while reading.
max_rows (int, optional) – Rows retained per file (default 20 million); reading past the cap raises a
too_many_rowsnotice and stops for that file.max_columns (int, optional) – Column-count guard per file (default 1000).
max_notices_per_file (int, optional) – Row-level notices retained per file (default 10000); further occurrences are counted in a
notice_limit_reachednotice.reference_date (str, optional) –
YYYYMMDDday for calendar-expiry checks; defaults to today.
- Returns:
{"notices": [...], "row_counts": {...}, "service_window": ...}. Each notice carriescode,severity(ERROR/WARNING/INFO) and acontextmapping with the notice-specific fields.service_windowis the actual computed service-day span as a[start, end]pair ofYYYYMMDDstrings (orNone) — use it to verify the optimistic published dataset ranges from the catalog.- Return type:
dict
- Raises:
OSError – If the file cannot be opened or is not a readable zip archive.