transit trips schedule table structure

transit trips schedule table structure#

For each transit trip, this table lists the arrival and departure at each stop, listed in order by their index in the sequence available in the transit pattern links table

The transit trip ID can be traced back to the pattern, route and agency directly through the encoding of their trip_id, as explained in the documentation for the Transit_Agencies table.

The time_source field indicates whether the stop timing came from the GTFS feed (0) or from any pre-processing (i.e. stop_time_de-duplication) (1).

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

trip_id*

INTEGER

NO

Transit_Trips(trip_id)

ID of the trip as seen in the transait_trips table

index

INTEGER

NO

Sequence number of the stop served by the pattern

arrival

INTEGER

NO

Vehicle arrival time at the stop in seconds from the beginning of the day

departure

INTEGER

NO

Vehicle departure time from the stop in seconds from the beginning of the day

time_source

INTEGER

NO

0

0 indicates that the times in GTFS were used directly, 1 indicates that corrections were made

(* - Primary key)

The SQL statement for table and index creation is below.

CREATE TABLE IF NOT EXISTS "Transit_Trips_Schedule" (
    trip_id      INTEGER  NOT NULL,
    "index"      INTEGER  NOT NULL,
    arrival      INTEGER  NOT NULL,
    departure    INTEGER  NOT NULL,
    time_source  INTEGER  NOT NULL DEFAULT 0,

    PRIMARY KEY(trip_id,"index"),
    FOREIGN KEY(trip_id) REFERENCES Transit_Trips(trip_id) deferrable initially deferred
);