Type Definitions


Name Type Attributes Default Description
require string

The agency module require name or path

config string <optional>

The agency module additional configuration file path

notes string <optional>

The agency update notes to be included in the database

agency RightTrackAgency

The RightTrackAgency Class for the agency

update boolean false

The GTFS data update flag (true when a GTFS data update is requested)

updateComplete boolean false

The GTFS data update success flag (true when GTFS data is successfully updated)

published Date

The Date/Time the GTFS data was published

compile boolean false

The DB compilation flag (true when the DB compilation is requested)

compileComplete boolean false

The DB compilation success flag (true when DB is successfully compiled)

compiled Date

the Date/Time the DB was compiled

version int

the DB version code (based off of the compile date/time)

sane boolean false

DB Sanity Check flag (true if passed sanity checks)

files Object

Agency Database File Locations, set when the agency database has been compiled

Name Type Description
latestDir string

Latest database directory

latestDb string

Latest database file location

latestDbZip string

Latest database zip file location

latestVersion string

Latest version file location

Agency Build Options

These options are set during the update and compilation process for the specific agency. These options provide the Right Track Agency configuration, update and compilation process success and generated database version and file information.

  • Object

buildTable(db, agencyOptions, callback)


Build Table function.

This function is used to build a table in the Right Track Database.

Name Type Description
db object

The SQLite database being built

agencyOptions AgencyOptions

The Agency Build Options

callback buildTableCallback

The build table callback function



Build Table callback function.

This function is used when the build table script is complete.


Name Type Attributes Default Description
force boolean false

Force a GTFS data update and database compilation, when true

test boolean false

Don't install the database, when true

post string <optional>

The path to the post-update script

agencies Array.<AgencyOptions>

List of Agency Build Options for the Right Track Agencies that are to be processed by the db-build script.

email string <optional>

The email address to send summary reports to, if provided

smtp Object <optional>

SMTP server settings for sending summary reports, if email is set

Name Type Default Description
host string localhost

STMP server host

port int 25

SMTP server port

secure boolean false

SMTP server use TLS

requireTLS boolean false

SMTP server require TLS

auth Object

SMTP auth settings (auth.user = username, auth.pass = password)

from string

SMTP server From address

Right Track DB Build Options

These options are set from the command line arguments and are used to determine which Agencies to check for updates and compile databases for. The options are set, modified and returned via the options module.

  • Object


Name Type Attributes Description
type int

The type of Exception (Warning or Error)

message string

The Exception message

details string <optional>

The Exception details

agencyId string <optional>

The Agency Code of the Agency that invoked the Exception

Right Track Database Builder Exception (Warning/Error)

  • Object


Name Type Attributes Description
name string

Name of table in the final database

sourceDirectory string | undefined <optional>

Path to the directory containing the source file

sourceFile string | undefined <optional>

Name of the source file

separator string | undefined <optional>

Field separator used in the source file

fields Array.<Object>

List of table fields

fields[].name string

Name of field (will be column name in final table and must match source file header name unless source_name is specified)

fields[].type string

Data Type of field (TEXT, INTEGER, etc)

fields[].attributes string <optional>

Additional attributes of field (PRIMARY KEY, NOT NULL, etc)

fields[].source_name string <optional>

Source file header for field (if different than name)

fields[].index boolean <optional>

Set to true to make an index for this field

fields[].foreignKey Object <optional>

Set a foreign key relationship with this field

Name Type Description
table string

Foreign Table Name

field string

Foreign Field Name

Right Track Table Schema.

This defines the Right Track Database table's properties, including table fields and their types, foreign keys, and indices.

  • Object


Name Type Description
RTTableValues[].key string

Name of table column

RTTableValues[].value object

Value of data item

Right Track Table Initial Values

This defines the initial values that will be loaded into a table.

  • Array.<Object>



Main process callback function.

This callback function is used to return to the main update / compilation process started by the run module.

updateCallback(requested, successful)


Update callback function.

This function is used to return the status of an agency update check: whether an update is found and has been requested and whether the update was successful and the new GTFS files have been downloaded.

Name Type Description
requested boolean

Update requested flag (true when a GTFS data update was requested)

successful boolean

Update success flag (true when a GTFS data update was successful)

updateFunction(agencyOptions, callback)


Agency Update Check function.

This function is used to check the agency for a GTFS data update. If an update is found it will download the new data and place the GTFS files in the agency's GTFS directory. Once complete, this function will call the updateCallback callback function with the status of the update checks (an update was requested, and if the update was successful)

Name Type Description
agencyOptions Object

Agency build options (from Options)

callback updateCallback

The update callback function