transit fare attributes table structure

transit fare attributes table structure#

All transit fares for transit agencies in the model are included on this table. It includes the agency ID is applies to, as well as price and transfer criteria, which are crucial for proper consideration for trip routing.

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

fare_id*

INTEGER

NO

ID of the trip in the format AA000000000000 (Agency)

fare

TEXT

NO

ID of the fare as contained on GTFS

agency_id

INTEGER

NO

Transit_Agencies(agency_id)

ID of the agency to which the fare applies

price

REAL

YES

Fare in dollars

currency

TEXT

YES

Currency of the fare as shown on GTFS

payment_method

INTEGER

YES

Indicates when the fare must be paid as shown in GTFS, not currently used in POLARIS

transfer

INTEGER

YES

Indicates the number of transfers permitted on this fare as shown in GTFS. Empty implies unlimited transfers

transfer_duration

REAL

YES

Length of time in seconds before a transfer expires as shown in GTFS.

(* - Primary key)

The SQL statement for table and index creation is below.

create TABLE IF NOT EXISTS "Transit_Fare_Attributes" (
    fare_id           INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    fare              TEXT    NOT NULL,
    agency_id         INTEGER NOT NULL,
    price             REAL,
    currency          TEXT,
    payment_method    INTEGER,
    transfer          INTEGER,
    transfer_duration REAL,

    FOREIGN KEY(agency_id) REFERENCES Transit_Agencies(agency_id) deferrable initially deferred
);

CREATE UNIQUE INDEX IF NOT EXISTS fare_transfer_uniqueness ON Transit_Fare_Attributes (fare_id, transfer);