Documentation ¶
Overview ¶
Package mobsql is an interface for downloading and loading one or multiple GTFS archives (pulled from the Mobility Database catalog) into a SQLite database.
The database (seeded through mobsql) mirrors GTFS's specification (e.g. there is a transfers, stop_times, stops, agency tables etc.); however each GTFS table also has an additional 'source' column. The source column refers to Mobility Database mdb_id field. Besides that, GTFS schema is imported as 1-to-1 for GTFS schedule specification sans several exceptions (such as stop_times conversion of departure_time to int). Exceptions can be seen by examining the config package's Schema variable (and noting Conversion fields set on LoadColumn specs).
The only package endconsumers of this API should import and use directly is the top level git.sr.ht/~mil/mobsql; everything is aliased from there. Subpackages are internal implementations & may change between versions. See aliased package implementations for documentation on each function and type.
There are 6 primary functions exposed by mobsql's API:
InitializeRuntime: Initializes a Mobsql 'runtime' which represents a a connection to the SQLite DB & configuration params which all other API operations depend on.
FilterToSourceset: Converts a 'filter specification' to a set of MDBIDs which all Sourceset* operations operate based on. Filter specification is a broad way of 'searching' the Mobility Database for arbitrary GTFS sources to operate on.
Sourceset{Load,Compute,Purge,Status}: The main logic of the application. Allows load (downloading & importing GTFS to the DB), status (checking the GTFS sources that have been loaded), compute (converting SQL views into materialized tables based on the origin GTFS tables), and purge (removing GTFS data from the SQLite database).
The general usage pattern for using Mobsql as an API is:
Create a runtime via InitializeRuntime()
Determine which MDBID sources you will use either by using FilterToSourceset() OR by manually referencing the Mobility Database (https://database.mobilitydata.org/) for the MDBID needed
Run Sourceset{Load,Compute,Status,Purge} by passing the runtime and the MDBIDs
The CLI (cli package) implements all the above functionality (1-3) and should be understood as a good reference implementation for using Mobsql as a Go library in practice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DTypeInt uint = apptypes.DTypeInt
var DTypeReal uint = apptypes.DTypeReal
var DTypeText uint = apptypes.DTypeText
var FilterToSourceset = apifilter.FilterToSourceset
var InitializeRuntime = apiinit.InitializeRuntime
var SourcesetCompute = apicompute.SourcesetCompute
var SourcesetLoad = apiload.SourcesetLoad
var SourcesetPurge = apipurge.SourcesetPurge
var SourcesetStatus = apistatus.SourcesetStatus
Functions ¶
This section is empty.
Types ¶
type ComputedTable ¶ added in v0.4.0
type ComputedTable = apptypes.ComputedTable
type LoadColumn ¶ added in v0.4.0
type LoadColumn = apptypes.LoadColumn
type MobsqlRuntime ¶ added in v0.4.0
type MobsqlRuntime = apptypes.MobsqlRuntime
type PurgeTablesOption ¶ added in v0.5.0
type PurgeTablesOption = apipurge.PurgeTablesOption
var PurgeTablesOptionAll PurgeTablesOption = apipurge.PurgeTablesOptionAll
var PurgeTablesOptionComputed PurgeTablesOption = apipurge.PurgeTablesOptionComputed
var PurgeTablesOptionGTFS PurgeTablesOption = apipurge.PurgeTablesOptionGTFS
type RuntimeConfig ¶ added in v0.4.0
type RuntimeConfig = apptypes.RuntimeConfig
type SchemaExtra ¶ added in v0.4.0
type SchemaExtra = apptypes.SchemaExtra
type SourceStatus ¶
type SourceStatus = apistatus.SourceStatus
type SourcesetFilter ¶
type SourcesetFilter = apifilter.SourcesetFilter
type SourcesetOpResult ¶
type SourcesetOpResult = apptypes.SourcesetOpResult
Directories ¶
Path | Synopsis |
---|---|
api
|
|
Package main is the CLI interface for mobsql consuming the mobsql API.
|
Package main is the CLI interface for mobsql consuming the mobsql API. |
Package config contains the data structures used to represent the database schema for seeding and loading
|
Package config contains the data structures used to represent the database schema for seeding and loading |
util
|
|
utildownload
Package utildownload contains some internal download functions utilized by the primary mobsql app logic.
|
Package utildownload contains some internal download functions utilized by the primary mobsql app logic. |
utilfiles
Package utildownload contains internal helper functions related to file IO utilized by the primary mobsql app logic.
|
Package utildownload contains internal helper functions related to file IO utilized by the primary mobsql app logic. |
utilfuncs
Package utildownload contains internal helper functions utilized by the primary mobsql app logic.
|
Package utildownload contains internal helper functions utilized by the primary mobsql app logic. |
utillog
Package utillog is a simple logging interface with three different types of log messages that can be enabled via the 3 variables LogInfo, LogWarn, and LogDebug.
|
Package utillog is a simple logging interface with three different types of log messages that can be enabled via the 3 variables LogInfo, LogWarn, and LogDebug. |