Documentation
¶
Overview ¶
Package validator provides GTFS and GTFS-RT validation utilities.
Index ¶
- func SaveValidationReport(ctx context.Context, atx tldb.Adapter, result *Result, fvid int, ...) error
- type Options
- type RealtimeResult
- type Result
- type ResultDetails
- type ValidationReportErrorExemplar
- type ValidationReportErrorGroup
- type ValidationReportTripUpdateStat
- type ValidationReportVehiclePositionStat
- type Validator
- func (v *Validator) Validate(ctx context.Context) (*Result, error)
- func (v *Validator) ValidateRT(ctx context.Context, fn string, evaluateAt time.Time, ...) (RealtimeResult, error)
- func (v *Validator) ValidateRTs(ctx context.Context, rtUrls []string, evaluateAt time.Time, ...) (*Result, error)
- func (v *Validator) ValidateStatic(reader adapters.Reader, evaluateAt time.Time, evaluateAtLocal time.Time) (*Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶ added in v0.8.0
type Options struct {
BestPractices bool
CheckFileLimits bool
IncludeServiceLevels bool
IncludeEntities bool
IncludeEntitiesLimit int
IncludeRouteGeometries bool
UseHeaderTimestamp bool
ValidateRealtimeMessages []string
IncludeRealtimeJson bool
MaxRTMessageSize uint64
EvaluateAt time.Time
EvaluateAtTimezone string
// ErrorThreshold sets the maximum error percentage (0-100) allowed per file.
// The key is the filename (e.g., "stops.txt") or "*" for the default threshold.
// If any file exceeds its threshold, the validation is considered failed.
// Example: {"*": 10, "stops.txt": 5} means 10% default, 5% for stops.txt.
ErrorThreshold map[string]float64
copier.Options
}
Options defines options for the Validator.
type RealtimeResult ¶ added in v0.14.0
type RealtimeResult struct {
Url string `json:"url"`
Json map[string]any `json:"json"`
EntityCounts rt.EntityCounts `json:"entity_counts"`
TripUpdateStats []rt.RTTripStat `json:"trip_update_stats"`
VehiclePositionStats []rt.RTTripStat `json:"vehicle_position_stats"`
Errors []error
}
type Result ¶ added in v0.8.0
type Result struct {
Validator tt.String `json:"validator"`
ValidatorVersion tt.String `json:"validator_version"`
Success tt.Bool `json:"success"`
FailureReason tt.String `json:"failure_reason"`
ReportedAt tt.Time `json:"reported_at"`
ReportedAtLocal tt.Time `json:"reported_at_local"`
ReportedAtLocalTimezone tt.String `json:"reported_at_local_timezone"`
File tt.String `json:"file"`
IncludesStatic tt.Bool `json:"includes_static"`
IncludesRT tt.Bool `json:"includes_rt"`
Details ResultDetails `json:"details" db:"-"`
Errors map[string]*ValidationReportErrorGroup `json:"errors" db:"-"`
Warnings map[string]*ValidationReportErrorGroup `json:"warnings" db:"-"`
tt.BaseEntity
}
Result contains a validation report result,
type ResultDetails ¶ added in v0.16.0
type ResultDetails struct {
SHA1 tt.String `json:"sha1"`
Timezone tt.String `json:"timezone"`
EarliestCalendarDate tt.Date `json:"earliest_calendar_date"`
LatestCalendarDate tt.Date `json:"latest_calendar_date"`
Agencies []gtfs.Agency `json:"agencies"`
Routes []gtfs.Route `json:"routes"`
Stops []gtfs.Stop `json:"stops"`
FeedInfos []gtfs.FeedInfo `json:"feed_infos"`
Files []dmfr.FeedVersionFileInfo `json:"files"`
ServiceLevels []dmfr.FeedVersionServiceLevel `json:"service_levels"`
Realtime []RealtimeResult `json:"realtime"`
}
type ValidationReportErrorExemplar ¶ added in v0.16.0
type ValidationReportErrorExemplar struct {
ValidationReportErrorGroupID int
Line int
Message string
EntityID string
Value string
Geometry tt.Geometry
EntityJson tt.Map
tt.DatabaseEntity
}
func (*ValidationReportErrorExemplar) TableName ¶ added in v0.16.0
func (e *ValidationReportErrorExemplar) TableName() string
type ValidationReportErrorGroup ¶ added in v0.16.0
type ValidationReportErrorGroup struct {
ValidationReportID int
Filename string
Field string
ErrorType string
ErrorCode string
GroupKey string
Level int
Count int
Errors []ValidationReportErrorExemplar `db:"-"`
tt.DatabaseEntity
}
func (*ValidationReportErrorGroup) TableName ¶ added in v0.16.0
func (e *ValidationReportErrorGroup) TableName() string
type ValidationReportTripUpdateStat ¶ added in v0.16.0
type ValidationReportTripUpdateStat struct {
ValidationReportID int
AgencyID string
RouteID string
TripScheduledIDs tt.Strings `db:"trip_scheduled_ids"`
TripRtIDs tt.Strings `db:"trip_rt_ids"`
TripScheduledCount int
TripScheduledMatched int `db:"trip_match_count"`
TripScheduledNotMatched int
TripRtCount int
TripRtMatched int
TripRtNotMatched int
TripRtAddedIDs tt.Strings `db:"trip_rt_added_ids"`
TripRtAddedCount int
TripRtNotFoundIDs tt.Strings `db:"trip_rt_not_found_ids"`
TripRtNotFoundCount int
tt.DatabaseEntity
}
func (*ValidationReportTripUpdateStat) TableName ¶ added in v0.16.0
func (e *ValidationReportTripUpdateStat) TableName() string
type ValidationReportVehiclePositionStat ¶ added in v0.16.0
type ValidationReportVehiclePositionStat struct {
ValidationReportID int
AgencyID string
RouteID string
TripScheduledIDs tt.Strings `db:"trip_scheduled_ids"`
TripRtIDs tt.Strings `db:"trip_rt_ids"`
TripScheduledCount int
TripScheduledMatched int `db:"trip_match_count"`
TripScheduledNotMatched int
TripRtCount int
TripRtMatched int
TripRtNotMatched int
TripRtAddedIDs tt.Strings `db:"trip_rt_added_ids"`
TripRtAddedCount int
TripRtNotFoundIDs tt.Strings `db:"trip_rt_not_found_ids"`
TripRtNotFoundCount int
tt.DatabaseEntity
}
func (*ValidationReportVehiclePositionStat) TableName ¶ added in v0.16.0
func (e *ValidationReportVehiclePositionStat) TableName() string
type Validator ¶
type Validator struct {
Reader adapters.Reader
Options Options
// contains filtered or unexported fields
}
Validator checks a GTFS source for errors and warnings.
func NewValidator ¶
NewValidator returns a new Validator.
func (*Validator) Validate ¶
Validate performs a basic validation, as well as optional extended reports.
func (*Validator) ValidateRT ¶ added in v0.16.0
func (v *Validator) ValidateRT(ctx context.Context, fn string, evaluateAt time.Time, evaluateAtLocal time.Time) (RealtimeResult, error)
Validate realtime messages
func (*Validator) ValidateRTs ¶ added in v0.16.0
Click to show internal directories.
Click to hide internal directories.