rt

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package rt provides support for GTFS-RealTime. This API is under development and will change.

Index

Constants

This section is empty.

Variables

View Source
var (
	E001 = RealtimeError{Code: 1, /* contains filtered or unexported fields */}
	E002 = RealtimeError{Code: 2, /* contains filtered or unexported fields */}
	E003 = RealtimeError{Code: 3, /* contains filtered or unexported fields */}
	E004 = RealtimeError{Code: 4, /* contains filtered or unexported fields */}
	// E006 = RealtimeError{msg: "Missing required trip field for frequency-based exact_times = 0", Code: 6}
	E009 = RealtimeError{Code: 9, /* contains filtered or unexported fields */}
	// E010 = RealtimeError{msg: "location_type not 0 in stops.txt (Note that this is implemented but not executed because it's specific to GTFS - see issue #126)", Code: 10}
	E011 = RealtimeError{Code: 11, /* contains filtered or unexported fields */}
	// E012 = RealtimeError{msg: "Header timestamp should be greater than or equal to all other timestamps", Code: 12}
	// E013 = RealtimeError{msg: "Frequency type 0 trip schedule_relationship should be UNSCHEDULED or empty", Code: 13}
	E015 = RealtimeError{Code: 15, /* contains filtered or unexported fields */}
	// E016 = RealtimeError{msg: "trip_ids with schedule_relationship ADDED must not be in GTFS data", Code: 16}
	// E017 = RealtimeError{msg: "GTFS-rt content changed but has the same header timestamp", Code: 17}
	E018 = RealtimeError{Code: 18, /* contains filtered or unexported fields */} // same as E012?
	// E019 = RealtimeError{msg: "GTFS-rt frequency type 1 trip start_time must be a multiple of GTFS headway_secs later than GTFS start_time", Code: 19}
	E020 = RealtimeError{Code: 20, /* contains filtered or unexported fields */}
	E021 = RealtimeError{Code: 21, /* contains filtered or unexported fields */}
	E022 = RealtimeError{Code: 22, /* contains filtered or unexported fields */}
	// E023 = RealtimeError{msg: "trip start_time does not match first GTFS arrival_time", Code: 23}
	E024 = RealtimeError{Code: 24, /* contains filtered or unexported fields */}
	E025 = RealtimeError{Code: 25, /* contains filtered or unexported fields */}
	// E026 = RealtimeError{msg: "Invalid vehicle position", Code: 26}
	// E027 = RealtimeError{msg: "Invalid vehicle bearing", Code: 27}
	// E028 = RealtimeError{msg: "Vehicle position outside agency coverage area", Code: 28}
	// E029 = RealtimeError{msg: "Vehicle position far from trip shape", Code: 29}
	// E030 = RealtimeError{msg: "GTFS-rt alert trip_id does not belong to GTFS-rt alert route_id  in GTFS trips.txt", Code: 30}
	// E031 = RealtimeError{msg: "Alert informed_entity.route_id does not match informed_entity.trip.route_id", Code: 31}
	// E032 = RealtimeError{msg: "Alert does not have an informed_entity", Code: 32}
	// E033 = RealtimeError{msg: "Alert informed_entity does not have any specifiers", Code: 33}
	// E034 = RealtimeError{msg: "GTFS-rt agency_id does not exist in GTFS data", Code: 34}
	// E035 = RealtimeError{msg: "GTFS-rt trip.trip_id does not belong to GTFS-rt trip.route_id in GTFS trips.txt", Code: 35}
	E036 = RealtimeError{Code: 36, /* contains filtered or unexported fields */}
	E037 = RealtimeError{Code: 37, /* contains filtered or unexported fields */}
	E038 = RealtimeError{Code: 38, /* contains filtered or unexported fields */}
	E039 = RealtimeError{Code: 39, /* contains filtered or unexported fields */}
	E040 = RealtimeError{Code: 40, /* contains filtered or unexported fields */}
	E041 = RealtimeError{Code: 41, /* contains filtered or unexported fields */}
	E042 = RealtimeError{Code: 42, /* contains filtered or unexported fields */}
	E043 = RealtimeError{Code: 43, /* contains filtered or unexported fields */}
	// E044 = RealtimeError{msg: "stop_time_update arrival/departure doesn't have delay or time", Code: 44}
	// E045 = RealtimeError{msg: "GTFS-rt stop_time_update stop_sequence and stop_id do not match GTFS", Code: 45}
	// E046 = RealtimeError{msg: "GTFS-rt stop_time_update without time doesn't have arrival/departure time in GTFS", Code: 46}
	// E047 = RealtimeError{msg: "VehiclePosition and TripUpdate ID pairing mismatch", Code: 47}
	E048 = RealtimeError{Code: 48, /* contains filtered or unexported fields */}
	E049 = RealtimeError{Code: 49, /* contains filtered or unexported fields */}
	E050 = RealtimeError{Code: 50, /* contains filtered or unexported fields */}
)

Errors https://github.com/CUTR-at-USF/gtfs-realtime-validator/blob/master/RULES.md

Functions

func FeedEntityCompletenessCheck

func FeedEntityCompletenessCheck(rm *RuleMsg) []error

func FeedEntityIDCheck

func FeedEntityIDCheck(rm *RuleMsg) []error

func FeedEntityIsDeletedCheck

func FeedEntityIsDeletedCheck(rm *RuleMsg) []error

func HeaderInvalidRealtimeVersion

func HeaderInvalidRealtimeVersion(rm *RuleMsg) []error

func HeaderRequired

func HeaderRequired(rm *RuleMsg) []error

func HeaderTimestampBoundsCheck

func HeaderTimestampBoundsCheck(rm *RuleMsg) []error

func HeaderTimestampIncreasing

func HeaderTimestampIncreasing(rm *RuleMsg) []error

func HeaderTimestampIncrementalityCheck

func HeaderTimestampIncrementalityCheck(rm *RuleMsg) []error

func HeaderTimestampRequired

func HeaderTimestampRequired(rm *RuleMsg) []error

func Read

func Read(address string) (*pb.FeedMessage, error)

Read opens a message from a file or url.

func ReadFile

func ReadFile(filename string) (*pb.FeedMessage, error)

ReadFile opens a message from a file.

func ReadURL

func ReadURL(address string) (*pb.FeedMessage, error)

ReadURL opens a message from a url.

func TripDescriptorTripIDCheck

func TripDescriptorTripIDCheck(rm *RuleMsg) []error

func TripUpdateTripDescriptorRequiredCheck

func TripUpdateTripDescriptorRequiredCheck(rm *RuleMsg) []error

Types

type RealtimeError

type RealtimeError struct {
	Code int
	// contains filtered or unexported fields
}

RealtimeError is a GTFS RealTime error.

func (RealtimeError) Error

func (err RealtimeError) Error() string

type RealtimeWarning

type RealtimeWarning struct {
	Code int
	// contains filtered or unexported fields
}

RealtimeWarning is a GTFS RealTime warning.

func (RealtimeWarning) Error

func (err RealtimeWarning) Error() string

type RuleMsg

type RuleMsg struct {
	Current  *pb.FeedMessage
	Previous *pb.FeedMessage
	Entity   interface{}
	// contains filtered or unexported fields
}

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator validates RT messages based on data from a static feed. It can be initialized through NewValidatorFromReader or through the Copier Validator interface.

func NewValidator

func NewValidator() *Validator

NewValidator returns an initialized validator.

func NewValidatorFromReader

func NewValidatorFromReader(reader tl.Reader) (*Validator, error)

NewValidatorFromReader returns a Validator with data from a Reader.

func (*Validator) SetGeomCache

func (fi *Validator) SetGeomCache(g *xy.GeomCache)

SetGeomCache sets a shared geometry cache.

func (*Validator) Validate

func (fi *Validator) Validate(ent tl.Entity) []error

Validate gets a stream of entities from Copier to build up the cache.

func (*Validator) ValidateFeedEntity

func (fi *Validator) ValidateFeedEntity(ent *pb.FeedEntity, current *pb.FeedMessage) (errs []error)

// ValidateFeedEntity .

func (*Validator) ValidateFeedMessage

func (fi *Validator) ValidateFeedMessage(current *pb.FeedMessage, previous *pb.FeedMessage) (errs []error)

ValidateFeedMessage .

func (*Validator) ValidateHeader

func (fi *Validator) ValidateHeader(header *pb.FeedHeader, current *pb.FeedMessage) (errs []error)

ValidateHeader .

func (*Validator) ValidateStopTimeUpdate

func (fi *Validator) ValidateStopTimeUpdate(st *pb.TripUpdate_StopTimeUpdate, current *pb.FeedMessage) (errs []error)

ValidateStopTimeUpdate .

func (*Validator) ValidateTripDescriptor

func (fi *Validator) ValidateTripDescriptor(td *pb.TripDescriptor, current *pb.FeedMessage) (errs []error)

ValidateTripDescriptor .

func (*Validator) ValidateTripUpdate

func (fi *Validator) ValidateTripUpdate(trip *pb.TripUpdate, current *pb.FeedMessage) (errs []error)

ValidateTripUpdate .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL