Documentation
¶
Overview ¶
Package rules provides a number of GTFS validation rules and examples.
Index ¶
- func ValidateStopTimes(stoptimes []gtfs.StopTime) []error
- type AgencyIDConditionallyRequiredCheck
- type CalendarDuplicateDates
- type EntityDuplicateIDCheck
- type EntityDuplicateKeyCheck
- type FareProductRiderCategoryDefaultCheck
- type FlexGeographyIDDuplicateError
- type FlexGeographyIDUniqueCheck
- type FlexLocationGeometryCheck
- type FlexLocationGeometryError
- type FlexStopLocationTypeCheck
- type FlexStopLocationTypeError
- type FlexZoneIDConditionalCheck
- type FlexZoneIDRequiredError
- type InconsistentTimezoneCheck
- type InconsistentTimezoneError
- type InvalidFarezoneError
- type InvalidParentStationError
- type ParentStationLocationTypeCheck
- type StopTimeSequenceCheck
- type TransferStopLocationTypeCheck
- type TransferStopLocationTypeError
- type ValidFarezoneCheck
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateStopTimes ¶ added in v0.18.0
ValidateStopTimes checks if the trip follows GTFS rules, including GTFS-Flex extensions.
Types ¶
type AgencyIDConditionallyRequiredCheck ¶
type AgencyIDConditionallyRequiredCheck struct {
// contains filtered or unexported fields
}
AgencyIDConditionallyRequiredCheck checks if agency_id is missing when more than one agency is present. This check is for when agency_id is *required* - see AgencyIDRecommendedCheck for when it is recommended but not required.
type CalendarDuplicateDates ¶ added in v0.10.0
type CalendarDuplicateDates struct {
}
type EntityDuplicateIDCheck ¶ added in v1.0.0
type EntityDuplicateIDCheck struct {
// contains filtered or unexported fields
}
EntityDuplicateCheck determines if a unique entity ID is present more than once in the file.
type EntityDuplicateKeyCheck ¶ added in v1.0.0
type EntityDuplicateKeyCheck struct {
// contains filtered or unexported fields
}
type FareProductRiderCategoryDefaultCheck ¶ added in v1.1.0
type FareProductRiderCategoryDefaultCheck struct {
// contains filtered or unexported fields
}
FareProductRiderCategoryDefaultCheck checks if agency_id is missing when more than one agency is present.
type FlexGeographyIDDuplicateError ¶ added in v1.3.0
type FlexGeographyIDDuplicateError struct {
GeographyID string
FirstFile string
SecondFile string
// contains filtered or unexported fields
}
FlexGeographyIDDuplicateError reports when a geography ID is duplicated across stops.txt, locations.geojson, or location_groups.txt.
func (*FlexGeographyIDDuplicateError) Error ¶ added in v1.3.0
func (e *FlexGeographyIDDuplicateError) Error() string
type FlexGeographyIDUniqueCheck ¶ added in v1.3.0
type FlexGeographyIDUniqueCheck struct {
// contains filtered or unexported fields
}
FlexGeographyIDUniqueCheck validates that geography IDs are unique across stops.txt, locations.geojson, and location_groups.txt.
Per GTFS-Flex specification, these three ID spaces are merged into a single namespace that can be referenced in stop_times.txt via stop_id or location_id.
func (*FlexGeographyIDUniqueCheck) AfterWrite ¶ added in v1.3.0
type FlexLocationGeometryCheck ¶ added in v1.3.0
type FlexLocationGeometryCheck struct{}
FlexLocationGeometryCheck validates that locations have valid Polygon or MultiPolygon geometries.
type FlexLocationGeometryError ¶ added in v1.3.0
type FlexLocationGeometryError struct {
LocationID string
ErrorMessage string
// contains filtered or unexported fields
}
FlexLocationGeometryError reports when a location has invalid geometry.
func (*FlexLocationGeometryError) Error ¶ added in v1.3.0
func (e *FlexLocationGeometryError) Error() string
type FlexStopLocationTypeCheck ¶ added in v1.3.0
type FlexStopLocationTypeCheck struct {
// contains filtered or unexported fields
}
FlexStopLocationTypeCheck validates that stops referenced in flex stop_times have appropriate location_type. According to GTFS-Flex, stops used in continuous stopping or location_id/location_group_id references must be location_type=0 (stop/platform).
func (*FlexStopLocationTypeCheck) AfterWrite ¶ added in v1.3.0
type FlexStopLocationTypeError ¶ added in v1.3.0
type FlexStopLocationTypeError struct {
StopID string
LocationType int
// contains filtered or unexported fields
}
FlexStopLocationTypeError reports when a stop referenced in a flex service has invalid location_type.
func (*FlexStopLocationTypeError) Error ¶ added in v1.3.0
func (e *FlexStopLocationTypeError) Error() string
type FlexZoneIDConditionalCheck ¶ added in v1.3.0
type FlexZoneIDConditionalCheck struct {
// contains filtered or unexported fields
}
FlexZoneIDConditionalCheck validates that locations have zone_id when fare_rules.txt exists.
func (*FlexZoneIDConditionalCheck) AfterWrite ¶ added in v1.3.0
type FlexZoneIDRequiredError ¶ added in v1.3.0
type FlexZoneIDRequiredError struct {
LocationID string
// contains filtered or unexported fields
}
FlexZoneIDRequiredError reports when zone_id is missing in locations.geojson but fare_rules.txt exists.
func (*FlexZoneIDRequiredError) Error ¶ added in v1.3.0
func (e *FlexZoneIDRequiredError) Error() string
type InconsistentTimezoneCheck ¶
type InconsistentTimezoneCheck struct {
// contains filtered or unexported fields
}
InconsistentTimezoneCheck checks for InconsistentTimezoneErrors.
type InconsistentTimezoneError ¶
type InconsistentTimezoneError struct {
// contains filtered or unexported fields
}
InconsistentTimezoneError reports when agency.txt has more than 1 unique timezone present.
func NewInconsistentTimezoneError ¶
func NewInconsistentTimezoneError(value string) *InconsistentTimezoneError
NewInconsistentTimezoneError returns a new InconsistentTimezoneError.
func (*InconsistentTimezoneError) Error ¶
func (e *InconsistentTimezoneError) Error() string
type InvalidFarezoneError ¶
type InvalidFarezoneError struct {
// contains filtered or unexported fields
}
InvalidFarezoneError reports when a farezone does not exist.
func NewInvalidFarezoneError ¶
func NewInvalidFarezoneError(field string, value string) *InvalidFarezoneError
NewInvalidFarezoneError returns a new InvalidFarezoneError
func (*InvalidFarezoneError) Error ¶
func (e *InvalidFarezoneError) Error() string
type InvalidParentStationError ¶
type InvalidParentStationError struct {
StopID string
LocationType int
ParentStation string
ParentStationType int
// contains filtered or unexported fields
}
InvalidParentStationError reports when a parent_station has a location_type that is not allowed.
func (*InvalidParentStationError) Error ¶
func (e *InvalidParentStationError) Error() string
type ParentStationLocationTypeCheck ¶
type ParentStationLocationTypeCheck struct {
// contains filtered or unexported fields
}
ParentStationLocationTypeCheck checks for InvalidParentStationErrors.
func (*ParentStationLocationTypeCheck) AfterWrite ¶ added in v0.12.0
type StopTimeSequenceCheck ¶
type StopTimeSequenceCheck struct{}
StopTimeSequenceCheck checks that all sequences stop_time sequences in a trip are valid. This should be split into multiple validators.
type TransferStopLocationTypeCheck ¶ added in v1.1.2
type TransferStopLocationTypeCheck struct {
// contains filtered or unexported fields
}
TransferStopLocationTypeCheck checks that stops referenced in transfers.txt have valid location_types. According to GTFS spec: - For transfer_type 0,1,2,3: stops must have location_type 0 (stop/platform) or 1 (station) - For transfer_type 4,5: fields are optional, but when provided must have location_type 0 (stop/platform)
func (*TransferStopLocationTypeCheck) AfterWrite ¶ added in v1.1.2
type TransferStopLocationTypeError ¶ added in v1.1.2
type TransferStopLocationTypeError struct {
StopID string
FieldName string // from_stop_id or to_stop_id
LocationType int
TransferType int64
}
TransferStopLocationTypeError reports when a transfer references a stop with an invalid location_type.
func (*TransferStopLocationTypeError) Error ¶ added in v1.1.2
func (e *TransferStopLocationTypeError) Error() string
type ValidFarezoneCheck ¶
type ValidFarezoneCheck struct {
// contains filtered or unexported fields
}
ValidFarezoneCheck checks for InvalidFarezoneErrors.
Source Files
¶
- agency_id_required.go
- calendar_duplicate_dates.go
- entity_duplicate.go
- flex_geography_id_unique.go
- flex_location_geometry.go
- flex_stop_location_type.go
- flex_zone_id_conditional.go
- inconsistent_timezone.go
- invalid_farezone.go
- invalid_parent_station.go
- rider_category_id_required.go
- rules.go
- stop_time_sequence.go
- transfer_stop_location_type.go