Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Latest commit

 

History

History
610 lines (361 loc) · 19.1 KB

RULES.md

File metadata and controls

610 lines (361 loc) · 19.1 KB

Implemented rules

Rules are declared in the Notice module. Below are details of currently implemented rules.

Table of Errors

Error ID Error Title
E001 Missing required field
E003 Missing required file
E004 Invalid csv row length
E005 Cannot parse integer
E006 Cannot parse float
E007 Cannot download archive
E008 Cannot unzip archive
E010 Integer field value out of range
E011 Float field value out of range
E012 Invalid url field value
E013 Invalid timezone field value
E014 Invalid color field value
E015 Missing required value
E016 Invalid time value
E017 Cannot parse date
E018 Invalid currency code
E019 Illegal field value combination
E020 Duplicated entity
E021 Unexpected enum value
E022 Invalid language code
E023 Invalid email
E024 Same name and description for route
E025 Insufficient route color contrast
E026 Invalid route type
E027 Missing route short name and long name
E028 Route long name equals short name
E029 Missing field agency_id for file agency.txt with more than 1 record
E030 Inconsistent field agency_timezone
E031 Invalid agency_id
E032 calendar.txt end_date is before start_date
E033 route_id not found in GTFS routes.txt
E034 shape_id not found in GTFS shapes.txt
E035 agency_id not found in GTFS agency.txt
E036 service_id not found in GTFS calendar.txt or calendar_dates.txt
E037 trip_id not found in GTFS trips.txt
E038 All shapes should be used in trips.txt
E039 feed_start_date after feed_end_date
E040 Dataset should be valid for at least the next 7 days
E041 Invalid parent location_type for stop
E042 Station stop (location_type=2) has a parent stop
E043 Duplicated field
E044 Missing trip edge arrival_time or departure_time
E045 arrival_time after departure_time in stop_times.txt
E046 Fast travel between stops in stop_times.txt
E047 Csv file is empty
E048 end_time after start_time in frequencies.txt
E049 Backwards time travel between stops in stop_times.txt
E050 Trips must be used in stop_times.txt
E051 Trips must have more than one stop to be usable
E052 Stop too far from trip shape
E053 Trip frequencies overlap
E054 Block trips must not have overlapping stop times
E055 Mismatching feed and agency language fields
E056 Missing calendar_dates.txt and calendar.txt files
E057 Decreasing shape_dist_traveled in stop_times.txt
E058 Decreasing shape_dist_traveled in shapes.txt

Table of Warnings

Warning ID Warning Title
W001 Input zip archive contains folder
W002 Non standard field name
W003 Non ascii or non printable char in id
W004 Extra file found
W005 Route short name too long
W006 Missing route short name
W007 Missing route long name
W008 Route long name contains short name
W009 Dataset should cover at least the next 30 days of service
W010 feed_end_date should be provided if feed_start_date is provided
W011 feed_start_date should be provided if feed_end_date is provided
W012 Optional csv file is empty
W014 Duplicate routes.route_long_name
W015 Duplicate routes.route_short_name
W016 Duplicate combination of fields route_long_name and routes.route_short_name

Errors

A field marked as required is missing.

A file marked as required is missing.

A csv file row length does not match header row length.

Value of a field with type integer could not be parsed as such.

Value of a field with type float could not be parsed as such.

An error happened when trying to download gtfs archive from network.

An error happened when trying to unzip gtfs archive.

Value of field with type integer is out of range.

Value of field with type float is out of range.

Value of field with type url is not valid.

References:

Value of field with type timezone is not valid.

References:

Value of field with type color is not valid.

References:

A value marked as required is missing.

Value of field with type time is not valid.

References:

Value of a field with type date could not be parsed as such.

References:

Value of field with type currency code is not valid.

References:

Definition of some fields is not valid under the GTFS specification```

Some gtfs entity defined multiple times in dataset.

Value of field with type enum is unexpected.

Language codes used in a GTFS feed should be under the IETF BCP 47 format. Please visit links below for an introduction to IETF BCP 47.

References:

An email should be a valid email address (e.g., [email protected])

References:

The GTFS spec defines routes.txt route_description as:

Description of a route that provides useful, quality information. Do not simply duplicate the name of the route.

See the GTFS and GTFS Best Practices links below for more examples of how to populate the route_short_name, route_long_name, and route_description fields.

References:

GTFS routes.txt GTFS routes.txt Best Practices

References:

A Route color and a Route text color should be contrasting. Minimum Contrast Ratio allowed is 4.5. Contrast Ratio is computed according to the W3 Color Contrast Procedure. Please visit links below for more information about color contrast.

References:

At least one of routes.route_short_name or routes.route_long_name should be provided - both can't be blank or missing.

References:

All records of file agency.txt should have a non-null value for field agency_id when this file counts more than one record.

All records of file agency.txt should have the same value for field agency_timezone agency_id when this file counts more than one record.

When provided field agency_id should not be blank.

In calendar.txt, the end_date of a service record must not be earlier than the start_date.

References:

Value of field route_id should exist in GTFS routes.txt.

Value of field shape_id should exist in GTFS shapes.txt.

Value of field agency_id should exist in GTFS agency.txt.

Value of field service_id should exist in GTFS calendar.txt or calendar_dates.txt.

Value of field trip_id should exist in GTFS trips.txt.

All records defined by GTFS shapes.txt should be used in trips.txt.

The feed_end_date date must not precede the feed_start_date date if both are given.

References:

At any time, the published GTFS dataset should be valid for at least the next 7 days, and ideally for as long as the operator is confident that the schedule will continue to be operated.

References:

Value of field location_type of parent found in field parent_station is invalid.

According to spec

  • Stop/platform can only have Station as parent
  • Station can NOT have a parent
  • Entrance/exit or generic node can only have Station as parent
  • Boarding Area can only have Platform as parent

Any other combination raise this error.

References:

Field parent_station must be empty when location_type is 2.

References:

A file cannot contain the same header value twice (i.e., duplicated column of data).

First and last stop of a trip must define both fields.

The departure_time must not precede the arrival_time in stop_times.txt if both are given.

References:

Calculated speed between stops is too fast (>150 kmh).

Empty csv file found in the archive: file does not have any headers, or is a required file and does not have any data. The GTFS specification requires the first line of each file to contain field names and required files must have data. This is related to W012.

References:

E048 - end_time after start_time in frequencies.txt

The end_time must not precede the start_time in frequencies.txt.

References:

For a given trip_id, the arrival_time of (n+1)-th stoptime in sequence must not precede the departure_time of n-th stoptime in sequence.

Trips must be referred to at least once in stop_times.txt.

A trip must visit more than one stop in stop_times.txt to be usable by passengers for boarding and alighting.

Per GTFS Best Practices, route alignments (in shapes.txt) should be within 100 meters of stop locations which a trip serves.

References:

Trip frequencies must not overlap in time

References:

Trip stop times should not overlap when they are part of the same block operating on the same day.

References:

Files agency.txt and feed_info.txt must define matching agency.agency_lang and feed_info.feed_lang. The default language may be multilingual for datasets with the original text in multiple languages. In such cases, the feed_lang field should contain the language code mul defined by the norm ISO 639-2.

  • If feed_lang is not mul and does not match with agency_lang, that's an error
  • If there is more than one agency_lang and feed_lang isn't mul, that's an error
  • If feed_lang is mul and there isn't more than one agency_lang, that's an error

References:

Both files calendar_dates.txt and calendar.txt are missing from the GTFS archive. At least one of the files must be provided.

Stop times in a trip should have increasing distance.

shape_dist_traveled should increase along a shape.

References:

Warnings

A gtfs zip archive cannot contain a folder.

Field not defined in the specification found. It will be ignored.

A value of filed with type id contains non ascii or non printable characters. This is not recommended.

File not defined in the specification found. It will be ignored.

If possible, the GTFS dataset should cover at least the next 30 days of service

References:

feed_end_date should be provided in conjunction with field feed_start_date.

feed_end_date should be provided in conjunction with field feed_start_date.

Empty csv optional file found in the archive: file contains header but does not have data.
This is related to E047.

All routes should have different routes.route_long_name. If routes have the same routes.route_long_name, they must be different routes serving different areas; and must not be different trips of the same route or different directions of the same route. Note that two routes can have the same routes.route_long_name if they do not belong to the same agency.

All routes should have different rouytes.route_short_name. If routes have the same routes.route_short_name, they must be different routes serving different areas; and must not be different trips of the same route or different directions of the same route. Note that two routes can have the same routes.route_short_name if they do not belong to the same agency.

The same combination of route_short_name and route_long_name should not be used for more than one route.