model

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllDurationUnit = []DurationUnit{
	DurationUnitSeconds,
}
View Source
var ErrArtifactNotFound = errors.New("artifact not found")

ErrArtifactNotFound is returned by ArtifactReader.GetByID when no row matches.

Functions

func AddConfig added in v1.3.0

func AddConfig(cfg Config) func(http.Handler) http.Handler

func AddConfigAndPerms added in v1.3.0

func AddConfigAndPerms(cfg Config, next http.Handler) http.Handler

func AddPerms added in v1.3.0

func AddPerms(checker Checker) func(http.Handler) http.Handler

func WithConfig added in v1.3.0

func WithConfig(ctx context.Context, cfg Config) context.Context

WithConfig stores cfg in ctx for non-HTTP entry points (background jobs, tests). Unlike AddConfig, this does not enforce a non-nil Checker — test scaffolding (testconfig) is responsible for providing one.

func WithPermFilter added in v1.3.2

func WithPermFilter(ctx context.Context, pf *PermFilter) context.Context

WithPermFilter stores a PermFilter directly in context. Use this when you need to set permissions without going through a Checker, such as when populating AllowedFeeds from an external source like gatekeeper.

Note: The provided PermFilter will NOT be mutated by subsequent calls to WithPerms. WithPerms creates a new merged PermFilter if it needs to combine permissions.

To grant unrestricted access, pass a PermFilter with IsGlobalAdmin=true.

func WithPerms added in v1.3.0

func WithPerms(ctx context.Context, checker Checker) (context.Context, error)

WithPerms populates permission filters in the context using the provided Checker. If an existing PermFilter is already set in context (e.g., via WithPermFilter), the checker's results are merged into a new PermFilter (the original is not mutated).

Merge behavior:

  • No existing filter: checker results are used directly
  • Existing filter + checker results: creates new filter with merged, deduplicated IDs
  • Either filter has IsGlobalAdmin=true: resulting filter has IsGlobalAdmin=true

Returns an error if the Checker fails to resolve the caller's permissions. The returned context still has the original PermFilter (if any) untouched.

Types

type Actions added in v1.3.0

type Agency

type Agency struct {
	OnestopID       string      `json:"onestop_id"`
	FeedOnestopID   string      `json:"feed_onestop_id"`
	FeedVersionSHA1 string      `json:"feed_version_sha1"`
	Geometry        *tt.Polygon `json:"geometry"`
	SearchRank      *string
	CoifID          *int
	gtfs.Agency
}

type AgencyFilter

type AgencyFilter struct {
	// Search by resolved Onestop ID (operator's when associated, else agency's)
	OnestopID *string `json:"onestop_id,omitempty"`
	// Search for agencies with this feed version SHA1 hash
	FeedVersionSha1 *string `json:"feed_version_sha1,omitempty"`
	// Search for agencies with this feed Onestop ID
	FeedOnestopID *string `json:"feed_onestop_id,omitempty"`
	// Search for agencies with this GTFS agency_id
	AgencyID *string `json:"agency_id,omitempty"`
	// Search for agencies with this GTFS agency_name
	AgencyName *string `json:"agency_name,omitempty"`
	// Full text search
	Search *string `json:"search,omitempty"`
	// Search for agencies by city name (provided by Natural Earth)
	CityName *string `json:"city_name,omitempty"`
	// Search for agencies by country name (provided by Natural Earth)
	Adm0Name *string `json:"adm0_name,omitempty"`
	// Search for agencies by state/province/division name (provided by Natural Earth)
	Adm1Name *string `json:"adm1_name,omitempty"`
	// Search for agencies by country 2 letter ISO 3166 code (provided by Natural Earth)
	Adm0Iso *string `json:"adm0_iso,omitempty"`
	// Search for agencies by state/province/division ISO 3166-2 code (provided by Natural Earth)
	Adm1Iso *string `json:"adm1_iso,omitempty"`
	// Search for agencies with these license details
	License *LicenseFilter `json:"license,omitempty"`
	// Geographic search options
	Location *AgencyLocationFilter `json:"location,omitempty"`
	// Search for agencies within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for agencies within this geographic polygon
	Within *tt.Polygon `json:"within,omitempty"`
	// Search for agencies within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
}

Search options for agencies

type AgencyLocationFilter added in v1.3.0

type AgencyLocationFilter struct {
	// Search for agencies within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for agencies within this geographic polygon
	Polygon *tt.Polygon `json:"polygon,omitempty"`
	// Search for agencies within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
	// Focus search on this point; results will be sorted by distance
	Focus *FocusPoint `json:"focus,omitempty"`
}

Geographic search options for agencies

type AgencyPlace

type AgencyPlace struct {
	// Best-matched city name
	CityName *string `json:"city_name,omitempty"`
	// Best-matched state or province name
	Adm1Name *string `json:"adm1_name,omitempty"`
	// Best-matched state or province ISO code
	Adm1Iso *string `json:"adm1_iso,omitempty"`
	// Best-matched country name
	Adm0Name *string `json:"adm0_name,omitempty"`
	// Best-matched country ISO code
	Adm0Iso *string `json:"adm0_iso,omitempty"`
	// Relative weight of this place association; higher values indicate stronger association (e.g. greater stop overlap)
	Rank     *float64 `json:"rank,omitempty"`
	AgencyID int      `json:"-"`
}

Place associated with an agency.

type AgencyPlaceFilter

type AgencyPlaceFilter struct {
	// Search for associations with at least this rank value
	MinRank *float64 `json:"min_rank,omitempty"`
}

Search options for agency associated places

type Alert added in v1.3.0

type Alert struct {
	// Time ranges during which this alert is active. See https://gtfs.org/realtime/reference/#message-timerange
	ActivePeriod []*RTTimeRange `json:"active_period,omitempty"`
	// GTFS-RT Alert [cause](https://gtfs.org/realtime/reference/#enum-cause)
	Cause *string `json:"cause,omitempty"`
	// GTFS-RT Alert [effect](https://gtfs.org/realtime/reference/#enum-effect)
	Effect *string `json:"effect,omitempty"`
	// GTFS-RT Alert header text
	HeaderText []*RTTranslation `json:"header_text"`
	// GTFS-RT Alert description text
	DescriptionText []*RTTranslation `json:"description_text"`
	// Header text optimized for text-to-speech (TTS) systems
	TtsHeaderText []*RTTranslation `json:"tts_header_text,omitempty"`
	// Description text optimized for text-to-speech (TTS) systems
	TtsDescriptionText []*RTTranslation `json:"tts_description_text,omitempty"`
	// URL for more information
	URL []*RTTranslation `json:"url,omitempty"`
	// Alert severity: `UNKNOWN_SEVERITY`, `INFO`, `WARNING`, or `SEVERE`
	SeverityLevel *string `json:"severity_level,omitempty"`
}

Alert(https://gtfs.org/reference/realtime/v2/#message-alert) message, also called a service alert, provided by a source GTFS Realtime feed.

type ArtifactOpts added in v1.3.4

type ArtifactOpts struct {
	Filename    string
	ContentType string
}

ArtifactOpts are the caller-supplied fields when a worker publishes an artifact. JobID, StorageKey, SizeBytes and SHA1 are filled in by the store.

type ArtifactReader added in v1.3.4

type ArtifactReader interface {
	// ListByJob returns jobID's artifacts, newest first.
	ListByJob(ctx context.Context, jobID string) ([]*JobArtifact, error)
	// GetByID returns one row, or ErrArtifactNotFound.
	GetByID(ctx context.Context, artifactID int) (*JobArtifact, error)
}

ArtifactReader is the read side used by the jobserver to list and look up artifacts. It is not scoped to a single job; callers pass the job id / row id.

type ArtifactStore added in v1.3.4

type ArtifactStore interface {
	CreateFile(ctx context.Context, opts ArtifactOpts, localPath string) (*JobArtifact, error)
	CreateReader(ctx context.Context, opts ArtifactOpts, r io.Reader) (*JobArtifact, error)
}

ArtifactStore is the per-job handle a worker uses to publish files. A scoped instance (bound to the executing job's id/user/kind) is resolved by JobArtifacts(ctx) from the job's JobMeta and Config.ArtifactStoreFactory.

func JobArtifacts added in v1.3.4

func JobArtifacts(ctx context.Context) ArtifactStore

JobArtifacts returns an ArtifactStore scoped to the executing job, or nil when there is no job on the context (e.g. an HTTP request) or no artifact storage is configured for this deployment. Workers call this to publish files attributed to the job they are running; the scope (id/user/kind) comes from the runner-stamped JobMeta, so a worker cannot misattribute a file to another job. A non-nil return means "in a job AND artifacts are available here."

type ArtifactStoreFactory added in v1.3.4

type ArtifactStoreFactory interface {
	ArtifactReader
	For(jobID, userID, kind string) ArtifactStore
}

ArtifactStoreFactory produces a per-job ArtifactStore and also serves the read API. The job middleware calls For(...) once per execution to bind the artifact identity; the jobserver uses the read methods directly.

type BookingRule added in v1.3.0

type BookingRule struct {
	FeedOnestopID   string
	FeedVersionSHA1 string
	gtfs.BookingRule
}

type BookingRuleFilter added in v1.3.0

type BookingRuleFilter struct {
	// Restrict to specific ids
	Ids []int `json:"ids,omitempty"`
	// Search for booking rules with this booking_rule_id
	BookingRuleID *string `json:"booking_rule_id,omitempty"`
}

Search options for GTFS Flex booking rules

type BoundingBox added in v1.3.0

type BoundingBox struct {
	// Minimum longitude
	MinLon float64 `json:"min_lon"`
	// Minimum latitude
	MinLat float64 `json:"min_lat"`
	// Maximum longitude
	MaxLon float64 `json:"max_lon"`
	// Maximum latitude
	MaxLat float64 `json:"max_lat"`
}

Search for entities within a specified bounding box

type Calendar

type Calendar struct {
	gtfs.Calendar
}

type CalendarDate

type CalendarDate struct {
	gtfs.CalendarDate
}

type CalendarDateFilter

type CalendarDateFilter struct {
	// Search for calendar date exceptions on this date
	Date *tt.Date `json:"date,omitempty"`
	// Search for calendar date exceptions with this GTFS exception_type [1=service added, 2=service removed]
	ExceptionType *int `json:"exception_type,omitempty"`
}

Search options for calendar dates

type CensusCursor added in v1.3.2

type CensusCursor struct {
	Geoid   string
	TableID int
	Valid   bool
}

CensusCursor encodes pagination state for census values using composite key (geoid, table_id)

func DecodeCensusCursor added in v1.3.2

func DecodeCensusCursor(cursor string) (CensusCursor, error)

DecodeCensusCursor decodes a cursor string

func NewCensusCursor added in v1.3.2

func NewCensusCursor(geoid string, tableID int) CensusCursor

NewCensusCursor creates a new census cursor

func (*CensusCursor) Encode added in v1.3.2

func (c *CensusCursor) Encode() string

Encode returns a base64-encoded cursor string

type CensusDataset added in v1.3.0

type CensusDataset struct {
	// Internal integer ID
	ID int `json:"id"`
	// Dataset name (e.g. `acsdt5y2022`, `tiger2021`, `ntd-annual-2024`)
	Name string `json:"name"`
	// Human-readable description
	Description *string `json:"description,omitempty"`
	// URL to the source or documentation
	URL *tt.Url `json:"url,omitempty"`
	// Earliest year of data coverage
	YearMin *int `json:"year_min,omitempty"`
	// Latest year of data coverage
	YearMax *int `json:"year_max,omitempty"`
	// Source files or archives that make up this dataset
	Sources []*CensusSource `json:"sources,omitempty"`
	// Geographic units in this dataset
	Geographies []*CensusGeography `json:"geographies,omitempty"`
	// Data table definitions available in this dataset
	Tables []*CensusTable `json:"tables,omitempty"`
	// Geographic layers (boundary types) available in this dataset, e.g. `tract`, `blockgroup`, `state`
	Layers []*CensusLayer `json:"layers,omitempty"`
	// Cursor-paginated data values for this dataset.
	// Use for large datasets (e.g. NTD) where result sets exceed practical limits for the per-geography `CensusGeography.values` field.
	// Filter by `geoid`, `geoid_prefix`, or `table`.
	ValuesRelay *CensusValueConnection `json:"values_relay,omitempty"`
}

A named collection of geographic and/or statistical data from a single source.

Datasets currently include: - **US Census Bureau ACS** (e.g. `acsdt5y2022`): American Community Survey 5-year estimates; contains demographic and socioeconomic data (population, income, etc.) keyed to standard FIPS geographic identifiers - **US Census Bureau TIGER/Line** (e.g. `tiger2021`): geographic boundary files for census tracts, block groups, states, and other administrative units - **US Federal Transit Administration NTD** (e.g. `ntd-annual-2024`): National Transit Database annual reporting data; contains operational metrics (vehicle revenue miles, operating expenses) by agency and mode

Each dataset contains one or more `CensusLayer`s (geographic boundary types), `CensusSource`s (individual source files), `CensusTable`s (data table definitions), and queryable `CensusGeography` records with associated `CensusValue` data.

type CensusDatasetFilter added in v1.3.0

type CensusDatasetFilter struct {
	// Search for the dataset with this exact name (e.g. `acsdt5y2022`)
	Name *string `json:"name,omitempty"`
	// Full-text search across dataset name and description
	Search *string `json:"search,omitempty"`
}

Search options for census datasets

type CensusDatasetGeographyFilter added in v1.3.0

type CensusDatasetGeographyFilter struct {
	// Restrict to geographies with these integer IDs
	Ids []int `json:"ids,omitempty"`
	// Search within this dataset (e.g. `tiger2021`)
	Dataset *string `json:"dataset,omitempty"`
	// Search within this layer (e.g. `tract`, `state`)
	Layer *string `json:"layer,omitempty"`
	// Search for geographies matching this string (matches on name)
	Search *string `json:"search,omitempty"`
	// Geographic search options
	Location *CensusDatasetGeographyLocationFilter `json:"location,omitempty"`
}

Search options for census geographies within a specific dataset

Note: please see the CensusDatasetGeographyLocationFilter documentation for details on how spatial searches may return duplicate geographies based on multiple intersections.

type CensusDatasetGeographyLocationFilter added in v1.3.0

type CensusDatasetGeographyLocationFilter struct {
	// Search within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search within this geographic polygon
	Within *tt.Polygon `json:"within,omitempty"`
	// Search within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
	// Focus search on this point; results will be sorted by distance
	Focus *FocusPoint `json:"focus,omitempty"`
	// Search based on a buffer around these stop IDs
	StopBuffer *StopBuffer `json:"stop_buffer,omitempty"`
}

Search options for census geographies

Note: when using spatial searches (radius, stop_buffer, etc.), individual census geographies may appear multiple times in the result set, each representing a different intersection with the search area. For example: - Two stops with small radius buffers in the same census tract will return that tract twice, once for each buffer intersection - A complex polygon search that touches multiple disconnected areas of the same geography will return separate entries for each intersection - Each duplicate entry will have different `intersection_area` and `intersection_geometry` values representing the specific overlap

Clients should aggregate or de-duplicate results as needed based on the `geoid` field if a single entry per geography is desired.

type CensusDatasetValueFilter added in v1.3.2

type CensusDatasetValueFilter struct {
	// Filter by table name
	Table *string `json:"table,omitempty"`
	// Filter by exact geoid
	Geoid *string `json:"geoid,omitempty"`
	// Filter by geoid prefix (e.g. 'ntd:00001' to find all values for NTD agency 00001)
	GeoidPrefix *string `json:"geoid_prefix,omitempty"`
}

Search options for census values within a dataset

type CensusField added in v1.3.0

type CensusField struct {
	// Internal integer ID
	ID int `json:"id"`
	// Column name as it appears in `CensusValue.values` (e.g. `b01001_001`)
	FieldName string `json:"field_name"`
	// Human-readable label for this column (e.g. `Total`)
	FieldTitle string `json:"field_title"`
	// Display order of this column within the table
	ColumnOrder *float64 `json:"column_order,omitempty"`
	TableID     int      `json:"-"`
}

Schema definition for a single column within a `CensusTable`. Field names from this type correspond to keys in the `CensusValue.values` map.

type CensusGeography

type CensusGeography struct {
	// Internal integer ID
	ID int `json:"id"`
	// Name of the parent dataset (e.g. `tiger2021`)
	DatasetName string `json:"dataset_name"`
	// Name of the source file this geography was loaded from (e.g. `tl_2024_01_tract.zip`)
	SourceName string `json:"source_name"`
	// Name of the layer this geography belongs to (e.g. `tract`, `state`)
	LayerName string `json:"layer_name"`
	// Standard identifier for this geography.
	// For ACS/TIGER geographies this is the FIPS code (e.g. `06075` for San Francisco County).
	// For NTD geographies this is the NTD agency ID.
	// Use this field to deduplicate results from spatial queries.
	Geoid *string `json:"geoid,omitempty"`
	// Human-readable name of this geography (e.g. a county or tract name)
	Name *string `json:"name,omitempty"`
	// Geometry area in square meters
	GeometryArea *float64 `json:"geometry_area,omitempty"`
	// Land area, in square meters (from TIGER/Line `ALAND` field)
	Aland *float64 `json:"aland,omitempty"`
	// Water area, in square meters (from TIGER/Line `AWATER` field)
	Awater *float64 `json:"awater,omitempty"`
	// State or province name
	Adm1Name *string `json:"adm1_name,omitempty"`
	// State or province ISO 3166-2 code (e.g. `US-CA`)
	Adm1Iso *string `json:"adm1_iso,omitempty"`
	// Country name
	Adm0Name *string `json:"adm0_name,omitempty"`
	// Country ISO 3166-1 alpha-2 code (e.g. `US`)
	Adm0Iso *string `json:"adm0_iso,omitempty"`
	// Boundary geometry for this geography as a MultiPolygon
	Geometry *tt.MultiPolygon `json:"geometry,omitempty"`
	// When this geography was returned by a spatial query (e.g. `stop_buffer` or `bbox`), the area of overlap between this geography and the search area, in square meters.
	// Divide by `geometry_area` to get the fraction of the geography covered by the search area, then apply that fraction to a population value to estimate population served.
	IntersectionArea *float64 `json:"intersection_area,omitempty"`
	// When this geography was returned by a spatial query, the geometry of the intersection between this geography and the search area.
	// Only populated when explicitly requested; may be expensive to compute.
	IntersectionGeometry *tt.Geometry `json:"intersection_geometry,omitempty"`
	// Statistical data values for this geography from the specified tables
	Values []*CensusValue `json:"values"`
	// The layer this geography belongs to
	Layer *CensusLayer `json:"layer,omitempty"`
	// The source file this geography was loaded from
	Source        *CensusSource `json:"source,omitempty"`
	DatasetID     int           `json:"-"`
	LayerID       int           `json:"-"`
	MatchEntityID int           `json:"-"`
	SourceID      int           `json:"-"`
}

A single spatial unit within a layer — for example, a specific Census Tract, a US State, or an NTD agency record.

Geographies are the primary unit of analysis: they carry geometry, administrative context, and can be linked to statistical data via `values`. When queried with a spatial filter (e.g. `stop_buffer` or `bbox`), the `intersection_area` and `intersection_geometry` fields are populated to describe the overlap between the geography and the search area — useful for calculating what fraction of a geography (and its population) is covered by a transit service area.

Note: spatial queries may return the same geography multiple times when it intersects a search area in multiple places (e.g. two separate stop buffers within the same tract). Use `geoid` to deduplicate if needed.

type CensusGeographyFilter added in v1.3.0

type CensusGeographyFilter struct {
	// Search within this dataset
	Dataset *string `json:"dataset,omitempty"`
	// Search within this layer
	Layer *string `json:"layer,omitempty"`
	// Buffer radius in meters around the parent entity's geometry (e.g. stop or route stops)
	Radius *float64 `json:"radius,omitempty"`
	// Search for geographies matching this string
	Search *string `json:"search,omitempty"`
}

Search options for census geographies

Note: please see the CensusDatasetGeographyLocationFilter documentation for details on how spatial searches may return duplicate geographies based on multiple intersections.

type CensusLayer added in v1.3.0

type CensusLayer struct {
	// Internal integer ID
	ID int `json:"id"`
	// Layer name used as a filter key (e.g. `tract`, `blockgroup`, `state`)
	Name string `json:"name"`
	// Human-readable description of this layer
	Description *string `json:"description,omitempty"`
	// Geographic units belonging to this layer
	Geographies []*CensusGeography `json:"geographies,omitempty"`
	DatasetID   int                `json:"-"`
}

A named category of geographic boundaries within a dataset, grouping geometries of the same type (e.g. all census tracts, all states).

Common layer names include `tract` (census tracts), `blockgroup` (block groups), and `state`. Layers are used as the primary filter when querying `CensusGeography` records to select the desired level of geographic aggregation.

type CensusSource added in v1.3.0

type CensusSource struct {
	// Internal integer ID
	ID int `json:"id"`
	// Source file name (e.g. `tl_2024_01_tract.zip`)
	Name string `json:"name"`
	// Description of this source file
	Description *string `json:"description,omitempty"`
	// URL to the original source file
	URL tt.Url `json:"url"`
	// SHA1 checksum of the source file
	Sha1 string `json:"sha1"`
	// Geographic units loaded from this source file
	Geographies []*CensusGeography `json:"geographies,omitempty"`
	// Data tables loaded from this source file
	Tables []*CensusTable `json:"tables,omitempty"`
	// Geographic layers defined by this source file
	Layers    []*CensusLayer `json:"layers,omitempty"`
	DatasetID int            `json:"-"`
}

A specific source file or archive that was imported to populate part of a dataset (e.g. a single state's TIGER/Line shapefile, or one year's ACS data release).

type CensusSourceFilter added in v1.3.0

type CensusSourceFilter struct {
	// Search for sources with this exact name
	Name *string `json:"name,omitempty"`
	// Search for sources matching this string
	Search *string `json:"search,omitempty"`
}

Search options for census source files

type CensusSourceGeographyFilter added in v1.3.0

type CensusSourceGeographyFilter struct {
	// Restrict to geographies with these integer IDs
	Ids []int `json:"ids,omitempty"`
	// Search for geographies matching this string (matches on name)
	Search *string `json:"search,omitempty"`
	// Geographic search options
	Location *CensusDatasetGeographyLocationFilter `json:"location,omitempty"`
}

Search options for census geography sources

Note: please see the CensusDatasetGeographyLocationFilter documentation for details on how spatial searches may return duplicate geographies based on multiple intersections.

type CensusTable

type CensusTable struct {
	// Internal integer ID
	ID int `json:"id"`
	// Table identifier used when querying values (e.g. `b01001`, `service_data_and_operating_expenses_by_mode`)
	TableName string `json:"table_name"`
	// Human-readable title of this table (e.g. `Sex By Age`)
	TableTitle string `json:"table_title"`
	// Grouping category for this table within the dataset
	TableGroup *string `json:"table_group,omitempty"`
	// Additional descriptive details, such as the population universe (e.g. `Total population`)
	TableDetails *string `json:"table_details,omitempty"`
	// Field (column) definitions for this table
	Fields    []*CensusField `json:"fields"`
	DatasetID int            `json:"-"`
}

Schema definition for a data table within a dataset. Describes the available columns and their metadata; the actual data is returned via `CensusValue`.

type CensusTableFilter added in v1.3.0

type CensusTableFilter struct {
	// Search for tables matching this string (matches on table name and title)
	Search *string `json:"search,omitempty"`
}

Search options for census tables

type CensusValue

type CensusValue struct {
	// Name of the dataset this value belongs to (e.g. `acsdt5y2022`)
	DatasetName string `json:"dataset_name"`
	// Name of the source file this value was loaded from
	SourceName string `json:"source_name"`
	// Table definition describing the columns in `values`
	Table *CensusTable `json:"table"`
	// Map of column names to their values for this geography and table
	Values tt.Map `json:"values"`
	// GEOID of the associated geography (FIPS code, NTD ID, etc.)
	Geoid       string `json:"geoid"`
	GeographyID int    `json:"-"`
	TableID     int    `json:"-"`
}

Statistical data values for a specific geography and table row.

The `values` field is an unstructured map of column names to their values for this geography. Column names and types vary by dataset and table — consult the associated `CensusTable` and `CensusField` records for schema information.

Examples: - ACS table `b01001`: `{ "b01001_001": 42381 }` (total population estimate) - NTD table `service_data_and_operating_expenses_by_mode`: `{ "Vehicle Revenue Miles": 1234567, "Operating Expenses": 9876543, "mode": "MB", "ntd_id": "90001" }`

type CensusValueConnection added in v1.3.2

type CensusValueConnection struct {
	Edges    []*CensusValueEdge
	PageInfo *PageInfo
}

CensusValueConnection represents a Relay-style connection for census values

type CensusValueEdge added in v1.3.2

type CensusValueEdge struct {
	Node   *CensusValue
	Cursor string
}

CensusValueEdge represents an edge in the census values connection

type Checker added in v1.3.0

type Checker = authz.Checker

type Config added in v1.3.0

type Config struct {
	Finder     Finder
	RTFinder   RTFinder
	GbfsFinder GbfsFinder
	Checker    Checker
	Actions    Actions
	Jobs       jobs.Backend
	JobRunner  *jobs.Runner
	// JobPolicy gates the synchronous /run endpoint (which doesn't go
	// through a Queue). Nil means no kind-level RBAC on /run.
	JobPolicy                jobs.AccessPolicy
	Clock                    clock.Clock
	Secrets                  []dmfr.Secret
	ValidateLargeFiles       bool
	DisableImage             bool
	UseMaterialized          bool
	UseGeohashFilter         bool
	AllowHTTPFetchUnfiltered bool
	RestPrefix               string
	// JobsPrefix is the public prefix of the jobserver mount (analogue of
	// RestPrefix for the REST mount), used to build absolute artifact download
	// links that are correct behind a path-rewriting ingress. Empty yields
	// host-relative links.
	JobsPrefix      string
	Storage         string
	RTStorage       string
	ArtifactStorage string // job-artifact storage URL; no fallback to Storage
	// ArtifactStoreFactory is the unscoped read/serve side (jobserver) and the
	// producer of per-job scoped handles (see JobArtifacts). The per-job handle
	// is intentionally NOT a Config field: it is execution-scoped, resolved from
	// the job's JobMeta rather than stored on this process-wide struct.
	ArtifactStoreFactory    ArtifactStoreFactory
	LoaderBatchSize         int
	LoaderStopTimeBatchSize int
	MaxRadius               float64
}

func ForContext added in v1.3.0

func ForContext(ctx context.Context) Config

type Cursor added in v1.3.0

type Cursor struct {
	FeedVersionID int
	ID            int
	Valid         bool
}

func NewCursor added in v1.3.0

func NewCursor(fvid int, id int) Cursor

func (Cursor) MarshalGQL added in v1.3.0

func (r Cursor) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface

func (*Cursor) MarshalJSON added in v1.3.0

func (r *Cursor) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.marshaler interface.

func (*Cursor) Scan added in v1.3.0

func (r *Cursor) Scan(value interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface

func (*Cursor) UnmarshalGQL added in v1.3.0

func (r *Cursor) UnmarshalGQL(v interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface

func (*Cursor) UnmarshalJSON added in v1.3.0

func (r *Cursor) UnmarshalJSON(v []byte) error

UnmarshalJSON implements json.Marshaler interface.

type DirectionRequest added in v1.3.0

type DirectionRequest struct {
	// Destination waypoint
	To *WaypointInput `json:"to"`
	// Origin waypoint
	From *WaypointInput `json:"from"`
	// Travel mode: `WALK`, `AUTO`, `BICYCLE`, `TRANSIT`, or `LINE`
	Mode StepMode `json:"mode"`
	// Departure time; treated as arrival time when arrive_by is true. Defaults to now
	DepartAt *time.Time `json:"depart_at,omitempty"`
	// If true, treat depart_at as the desired arrival time rather than departure time. Support depends on the configured routing provider
	ArriveBy *bool `json:"arrive_by,omitempty"`
}

Input parameters for a directions (routing) request.

Specifies an origin, destination, travel mode, and optional departure time. Results are returned as a `Directions` object containing one or more `Itinerary` options.

type Directions added in v1.3.0

type Directions struct {
	// Whether the routing request succeeded
	Success bool `json:"success"`
	// Error message if the request did not succeed
	Exception *string `json:"exception,omitempty"`
	// Identifier for the routing data source or provider
	DataSource *string `json:"data_source,omitempty"`
	// Resolved origin waypoint
	Origin *Waypoint `json:"origin,omitempty"`
	// Resolved destination waypoint
	Destination *Waypoint `json:"destination,omitempty"`
	// Total duration of the first itinerary
	Duration *Duration `json:"duration,omitempty"`
	// Total distance of the first itinerary
	Distance *Distance `json:"distance,omitempty"`
	// Departure time of the first itinerary
	StartTime *time.Time `json:"start_time,omitempty"`
	// Arrival time of the first itinerary
	EndTime *time.Time `json:"end_time,omitempty"`
	// Itineraries as returned by the routing provider, typically in preference order
	Itineraries []*Itinerary `json:"itineraries,omitempty"`
}

Result of a directions (routing) request.

Contains one or more `Itinerary` options from origin to destination, along with summary information for the first (best) itinerary.

type Distance added in v1.3.0

type Distance struct {
	// Numeric distance value
	Distance float64 `json:"distance"`
	// Unit of measurement
	Units DistanceUnit `json:"units"`
}

A distance value with units.

type DistanceUnit added in v1.3.0

type DistanceUnit string

Unit of distance measurement.

const (
	// Distance in kilometers
	DistanceUnitKilometers DistanceUnit = "KILOMETERS"
	// Distance in meters
	DistanceUnitMeters DistanceUnit = "METERS"
	// Distance in miles
	DistanceUnitMiles DistanceUnit = "MILES"
)

func (DistanceUnit) IsValid added in v1.3.0

func (e DistanceUnit) IsValid() bool

func (DistanceUnit) MarshalGQL added in v1.3.0

func (e DistanceUnit) MarshalGQL(w io.Writer)

func (DistanceUnit) MarshalJSON added in v1.3.0

func (e DistanceUnit) MarshalJSON() ([]byte, error)

func (DistanceUnit) String added in v1.3.0

func (e DistanceUnit) String() string

func (*DistanceUnit) UnmarshalGQL added in v1.3.0

func (e *DistanceUnit) UnmarshalGQL(v any) error

func (*DistanceUnit) UnmarshalJSON added in v1.3.0

func (e *DistanceUnit) UnmarshalJSON(b []byte) error

type Duration added in v1.3.0

type Duration struct {
	// Numeric duration value
	Duration float64 `json:"duration"`
	// Unit of measurement
	Units DurationUnit `json:"units"`
}

A duration value with units.

type DurationUnit added in v1.3.0

type DurationUnit string

Unit of time duration.

const (
	// Duration in seconds
	DurationUnitSeconds DurationUnit = "SECONDS"
)

func (DurationUnit) IsValid added in v1.3.0

func (e DurationUnit) IsValid() bool

func (DurationUnit) MarshalGQL added in v1.3.0

func (e DurationUnit) MarshalGQL(w io.Writer)

func (DurationUnit) MarshalJSON added in v1.3.0

func (e DurationUnit) MarshalJSON() ([]byte, error)

func (DurationUnit) String added in v1.3.0

func (e DurationUnit) String() string

func (*DurationUnit) UnmarshalGQL added in v1.3.0

func (e *DurationUnit) UnmarshalGQL(v any) error

func (*DurationUnit) UnmarshalJSON added in v1.3.0

func (e *DurationUnit) UnmarshalJSON(b []byte) error

type EntityDeleteResult added in v1.3.0

type EntityDeleteResult struct {
	// ID of deleted entity
	ID int `json:"id"`
}

Result of entity delete operation

type EntityFinder added in v1.3.0

type EntityFinder interface {
	FindAgencies(context.Context, *int, *Cursor, []int, *AgencyFilter) ([]*Agency, error)
	FindRoutes(context.Context, *int, *Cursor, []int, *RouteFilter) ([]*Route, error)
	FindStops(context.Context, *int, *Cursor, []int, *StopFilter) ([]*Stop, error)
	FindTrips(context.Context, *int, *Cursor, []int, *TripFilter) ([]*Trip, error)
	FindFeedVersions(context.Context, *int, *Cursor, []int, *FeedVersionFilter) ([]*FeedVersion, error)
	FindFeeds(context.Context, *int, *Cursor, []int, *FeedFilter) ([]*Feed, error)
	FindOperators(context.Context, *int, *Cursor, []int, *OperatorFilter) ([]*Operator, error)
	FindPlaces(context.Context, *int, *Cursor, []int, *PlaceAggregationLevel, *PlaceFilter) ([]*Place, error)
	FindCensusDatasets(context.Context, *int, *Cursor, []int, *CensusDatasetFilter) ([]*CensusDataset, error)
	FindCensusValuesByDatasetID(context.Context, *int, CensusCursor, int, *CensusDatasetValueFilter) ([]*CensusValue, error)
	RouteStopBuffer(context.Context, *int, *float64, int) ([]*RouteStopBuffer, error)
	FindFeedVersionServiceWindow(context.Context, int) (*ServiceWindow, error)
	DBX() tldb.Ext // escape hatch, for now
}

Finder handles basic queries

type EntityLoader added in v1.3.0

type EntityLoader interface {
	AgenciesByFeedVersionIDs(ctx context.Context, limit *int, where *AgencyFilter, feedVersionIds []int) ([][]*Agency, error)
	AgenciesByIDs(context.Context, []int) ([]*Agency, []error)
	AgenciesByOnestopIDs(context.Context, *int, *AgencyFilter, []string) ([][]*Agency, error)
	AgencyPlacesByAgencyIDs(context.Context, *int, *AgencyPlaceFilter, []int) ([][]*AgencyPlace, error)
	BookingRulesByFeedVersionIDs(context.Context, *int, *BookingRuleFilter, []int) ([][]*BookingRule, error)
	BookingRulesByIDs(context.Context, []int) ([]*BookingRule, []error)
	CalendarDatesByServiceIDs(context.Context, *int, *CalendarDateFilter, []int) ([][]*CalendarDate, error)
	CalendarsByIDs(context.Context, []int) ([]*Calendar, []error)
	CensusDatasetLayersByDatasetIDs(context.Context, []int) ([][]*CensusLayer, []error)
	CensusFieldsByTableIDs(context.Context, *int, []int) ([][]*CensusField, error)
	CensusGeographiesByDatasetIDs(context.Context, *int, *CensusDatasetGeographyFilter, []int) ([][]*CensusGeography, error)
	CensusGeographiesByEntityIDs(context.Context, *int, *CensusGeographyFilter, string, []int) ([][]*CensusGeography, error)
	CensusGeographiesByLayerIDs(context.Context, *int, *CensusSourceGeographyFilter, []int) ([][]*CensusGeography, error)
	CensusGeographiesBySourceIDs(context.Context, *int, *CensusSourceGeographyFilter, []int) ([][]*CensusGeography, error)
	CensusLayersByIDs(context.Context, []int) ([]*CensusLayer, []error)
	CensusSourcesByIDs(context.Context, []int) ([]*CensusSource, []error)
	CensusSourceLayersBySourceIDs(context.Context, []int) ([][]*CensusLayer, []error)
	CensusSourcesByDatasetIDs(context.Context, *int, *CensusSourceFilter, []int) ([][]*CensusSource, error)
	CensusTablesByDatasetIDs(context.Context, *int, *CensusTableFilter, []int) ([][]*CensusTable, error)
	CensusTableByIDs(context.Context, []int) ([]*CensusTable, []error)
	CensusValuesByGeographyIDs(context.Context, *int, string, []string, []string) ([][]*CensusValue, error)
	FeedFetchesByFeedIDs(context.Context, *int, *FeedFetchFilter, []int) ([][]*FeedFetch, error)
	FeedInfosByFeedVersionIDs(context.Context, *int, []int) ([][]*FeedInfo, error)
	FeedsByIDs(context.Context, []int) ([]*Feed, []error)
	FeedsByOperatorOnestopIDs(context.Context, *int, *FeedFilter, []string) ([][]*Feed, error)
	FeedStatesByFeedIDs(context.Context, []int) ([]*FeedState, []error)
	FeedVersionFileInfosByFeedVersionIDs(context.Context, *int, []int) ([][]*FeedVersionFileInfo, error)
	FeedVersionGeometryByIDs(context.Context, []int) ([]*tt.Polygon, []error)
	FeedVersionGtfsImportByFeedVersionIDs(context.Context, []int) ([]*FeedVersionGtfsImport, []error)
	FeedVersionsByFeedIDs(context.Context, *int, *FeedVersionFilter, []int) ([][]*FeedVersion, error)
	FeedVersionsByIDs(context.Context, []int) ([]*FeedVersion, []error)
	FeedVersionServiceLevelsByFeedVersionIDs(context.Context, *int, *FeedVersionServiceLevelFilter, []int) ([][]*FeedVersionServiceLevel, error)
	FeedVersionServiceWindowByFeedVersionIDs(context.Context, []int) ([]*FeedVersionServiceWindow, []error)
	FlexStopTimesByStopIDs(context.Context, *int, *StopTimeFilter, []FVPair) ([][]*FlexStopTime, error)
	FlexStopTimesByLocationIDs(context.Context, *int, *StopTimeFilter, []FVPair) ([][]*FlexStopTime, error)
	FlexStopTimesByLocationGroupIDs(context.Context, *int, *StopTimeFilter, []FVPair) ([][]*FlexStopTime, error)
	FlexStopTimesByTripIDs(context.Context, *int, *TripStopTimeFilter, []FVPair) ([][]*FlexStopTime, error)
	FrequenciesByTripIDs(context.Context, *int, []int) ([][]*Frequency, error)
	LevelsByIDs(context.Context, []int) ([]*Level, []error)
	LevelsByParentStationIDs(context.Context, *int, []int) ([][]*Level, error)
	LocationGroupsByFeedVersionIDs(context.Context, *int, *LocationGroupFilter, []int) ([][]*LocationGroup, error)
	LocationGroupsByIDs(context.Context, []int) ([]*LocationGroup, []error)
	LocationGroupsByStopIDs(context.Context, *int, []int) ([][]*LocationGroup, error)
	LocationsByFeedVersionIDs(context.Context, *int, *LocationFilter, []int) ([][]*Location, error)
	LocationsByIDs(context.Context, []int) ([]*Location, []error)
	OperatorsByAgencyIDs(context.Context, []int) ([]*Operator, []error)
	OperatorsByCOIFs(context.Context, []int) ([]*Operator, []error)
	OperatorsByFeedIDs(context.Context, *int, *OperatorFilter, []int) ([][]*Operator, error)
	PathwaysByFromStopIDs(context.Context, *int, *PathwayFilter, []int) ([][]*Pathway, error)
	PathwaysByIDs(context.Context, []int) ([]*Pathway, []error)
	PathwaysByToStopIDs(context.Context, *int, *PathwayFilter, []int) ([][]*Pathway, error)
	RouteAttributesByRouteIDs(context.Context, []int) ([]*RouteAttribute, []error)
	RouteGeometriesByRouteIDs(context.Context, *int, []int) ([][]*RouteGeometry, error)
	RouteHeadwaysByRouteIDs(context.Context, *int, []int) ([][]*RouteHeadway, error)
	RoutesByAgencyIDs(context.Context, *int, *RouteFilter, []int) ([][]*Route, error)
	RoutesByFeedVersionIDs(context.Context, *int, *RouteFilter, []int) ([][]*Route, error)
	RoutesByIDs(context.Context, []int) ([]*Route, []error)
	RouteStopPatternsByRouteIDs(context.Context, *int, []int) ([][]*RouteStopPattern, error)
	RouteStopsByRouteIDs(context.Context, *int, []int) ([][]*RouteStop, error)
	RouteStopsByStopIDs(context.Context, *int, []int) ([][]*RouteStop, error)
	SegmentPatternsByRouteIDs(context.Context, *int, *SegmentPatternFilter, []int) ([][]*SegmentPattern, error)
	SegmentPatternsBySegmentIDs(context.Context, *int, *SegmentPatternFilter, []int) ([][]*SegmentPattern, error)
	SegmentsByFeedVersionIDs(context.Context, *int, *SegmentFilter, []int) ([][]*Segment, error)
	SegmentsByIDs(context.Context, []int) ([]*Segment, []error)
	SegmentsByRouteIDs(context.Context, *int, *SegmentFilter, []int) ([][]*Segment, error)
	ShapesByIDs(context.Context, []int) ([]*Shape, []error)
	StopExternalReferencesByStopIDs(context.Context, []int) ([]*StopExternalReference, []error)
	StopObservationsByStopIDs(context.Context, *int, *StopObservationFilter, []int) ([][]*StopObservation, error)
	StopPlacesByStopID(context.Context, []StopPlaceParam) ([]*StopPlace, []error)
	StopsByFeedVersionIDs(context.Context, *int, *StopFilter, []int) ([][]*Stop, error)
	StopsByIDs(context.Context, []int) ([]*Stop, []error)
	StopsByLevelIDs(context.Context, *int, *StopFilter, []int) ([][]*Stop, error)
	StopsByLocationGroupIDs(context.Context, *int, []int) ([][]*Stop, error)
	StopsByParentStopIDs(context.Context, *int, *StopFilter, []int) ([][]*Stop, error)
	StopsByRouteIDs(context.Context, *int, *StopFilter, []int) ([][]*Stop, error)
	StopTimesByStopIDs(context.Context, *int, *StopTimeFilter, []FVPair) ([][]*StopTime, error)
	StopTimesByTripIDs(context.Context, *int, *TripStopTimeFilter, []FVPair) ([][]*StopTime, error)
	TargetStopsByStopIDs(context.Context, []int) ([]*Stop, []error)
	TripsByFeedVersionIDs(context.Context, *int, *TripFilter, []int) ([][]*Trip, error)
	TripsByIDs(context.Context, []int) ([]*Trip, []error)
	TripsByRouteIDs(context.Context, *int, *TripFilter, []FVPair) ([][]*Trip, error)
	ValidationReportErrorExemplarsByValidationReportErrorGroupIDs(context.Context, *int, []int) ([][]*ValidationReportError, error)
	ValidationReportErrorGroupsByValidationReportIDs(context.Context, *int, []int) ([][]*ValidationReportErrorGroup, error)
	ValidationReportsByFeedVersionIDs(context.Context, *int, *ValidationReportFilter, []int) ([][]*ValidationReport, error)
}

type EntityMutator added in v1.3.0

type EntityMutator interface {
	StopCreate(ctx context.Context, input StopSetInput) (int, error)
	StopUpdate(ctx context.Context, input StopSetInput) (int, error)
	StopDelete(ctx context.Context, id int) error
	PathwayCreate(ctx context.Context, input PathwaySetInput) (int, error)
	PathwayUpdate(ctx context.Context, input PathwaySetInput) (int, error)
	PathwayDelete(ctx context.Context, id int) error
	LevelCreate(ctx context.Context, input LevelSetInput) (int, error)
	LevelUpdate(ctx context.Context, input LevelSetInput) (int, error)
	LevelDelete(ctx context.Context, id int) error
}

type FVPair added in v1.3.0

type FVPair struct {
	FeedVersionID int
	EntityID      int
}

type Feature added in v1.3.0

type Feature struct {
	// Caller-supplied identifier echoed back on matched stops
	ID *string `json:"id,omitempty"`
	// Boundary geometry for the feature (GeoJSON)
	Geometry *tt.Geometry `json:"geometry,omitempty"`
	// Arbitrary key/value metadata associated with the feature
	Properties *tt.Map `json:"properties,omitempty"`
	// GeoJSON type, typically `Feature`
	Type *string `json:"type,omitempty"`
}

A GeoJSON-style feature used as a search-area input. Stops contained in the feature are returned with the feature's `id` echoed back via `Stop.within_features`

type Feed

type Feed struct {
	WithOperatorOnestopID tt.String
	SearchRank            *string
	dmfr.Feed
}

type FeedAuthorization

type FeedAuthorization struct {
	dmfr.FeedAuthorization
}

type FeedFetch added in v1.3.0

type FeedFetch struct {
	ResponseSha1 tt.String // confusing but easier than alternative fixes
	dmfr.FeedFetch
}

type FeedFetchFilter added in v1.3.0

type FeedFetchFilter struct {
	// Filter by fetch outcome: true for successful, false for failed
	Success *bool `json:"success,omitempty"`
}

Search options for feed fetches

type FeedFilter

type FeedFilter struct {
	// Search for a feed with this specific Onestop ID
	OnestopID *string `json:"onestop_id,omitempty"`
	// Restrict to feeds matching any of the given data types
	Spec []FeedSpecTypes `json:"spec,omitempty"`
	// Filter by latest-fetch outcome: true for feeds whose most recent fetch failed, false for those whose succeeded
	FetchError *bool `json:"fetch_error,omitempty"`
	// Filter by the import status of the feed's active feed version
	ImportStatus *ImportStatus `json:"import_status,omitempty"`
	// Full text search
	Search *string `json:"search,omitempty"`
	// Search for feeds with a tag
	Tags *tt.Tags `json:"tags,omitempty"`
	// Search for feeds by their source URLs
	SourceURL *FeedSourceURL `json:"source_url,omitempty"`
	// Search for feeds with these license details
	License *LicenseFilter `json:"license,omitempty"`
	// Search for feeds within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for feeds within this geographic polygon
	Within *tt.Polygon `json:"within,omitempty"`
	// Search for feeds within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
}

Search options for feeds

type FeedInfo

type FeedInfo struct {
	gtfs.FeedInfo
}

type FeedLicense

type FeedLicense struct {
	dmfr.FeedLicense
}

type FeedSourceURL added in v1.3.0

type FeedSourceURL struct {
	// URL to match against feed source URLs
	URL *string `json:"url,omitempty"`
	// Restrict the URL match to a specific URL type (e.g. `static_current`)
	Type *FeedSourceURLTypes `json:"type,omitempty"`
	// If true, match the URL case-sensitively; default is case-insensitive
	CaseSensitive *bool `json:"case_sensitive,omitempty"`
}

Search options for searching by source URL

type FeedSourceURLTypes added in v1.3.0

type FeedSourceURLTypes string

Feed source URL types

const (
	// URL to the current static GTFS
	FeedSourceURLTypesStaticCurrent FeedSourceURLTypes = "static_current"
	// URL to a previously used static GTFS
	FeedSourceURLTypesStaticHistoric FeedSourceURLTypes = "static_historic"
	// URL to a planned future static GTFS
	FeedSourceURLTypesStaticPlanned FeedSourceURLTypes = "static_planned"
	// URL to a proposed future static GTFS
	FeedSourceURLTypesStaticHypothetical FeedSourceURLTypes = "static_hypothetical"
	// URL to GTFS-RT vehicle positions
	FeedSourceURLTypesRealtimeVehiclePositions FeedSourceURLTypes = "realtime_vehicle_positions"
	// URL to GTFS-RT trip updates
	FeedSourceURLTypesRealtimeTripUpdates FeedSourceURLTypes = "realtime_trip_updates"
	// URL to GTFS-RT alerts
	FeedSourceURLTypesRealtimeAlerts FeedSourceURLTypes = "realtime_alerts"
	// URL to a GBFS service auto-discovery endpoint
	FeedSourceURLTypesGbfsAutoDiscovery FeedSourceURLTypes = "gbfs_auto_discovery"
	// URL to a MDS data set
	FeedSourceURLTypesMdsProvider FeedSourceURLTypes = "mds_provider"
)

func (FeedSourceURLTypes) IsValid added in v1.3.0

func (e FeedSourceURLTypes) IsValid() bool

func (FeedSourceURLTypes) MarshalGQL added in v1.3.0

func (e FeedSourceURLTypes) MarshalGQL(w io.Writer)

func (FeedSourceURLTypes) MarshalJSON added in v1.3.0

func (e FeedSourceURLTypes) MarshalJSON() ([]byte, error)

func (FeedSourceURLTypes) String added in v1.3.0

func (e FeedSourceURLTypes) String() string

func (*FeedSourceURLTypes) UnmarshalGQL added in v1.3.0

func (e *FeedSourceURLTypes) UnmarshalGQL(v any) error

func (*FeedSourceURLTypes) UnmarshalJSON added in v1.3.0

func (e *FeedSourceURLTypes) UnmarshalJSON(b []byte) error

type FeedSpecTypes added in v1.3.0

type FeedSpecTypes string

Type of data contained in a source feed

const (
	// GTFS Schedule (static)
	FeedSpecTypesGtfs FeedSpecTypes = "GTFS"
	// GTFS Realtime
	FeedSpecTypesGtfsRt FeedSpecTypes = "GTFS_RT"
	// General Bikeshare Feed Specification
	FeedSpecTypesGbfs FeedSpecTypes = "GBFS"
	// Mobility Data Specification
	FeedSpecTypesMds FeedSpecTypes = "MDS"
)

func (FeedSpecTypes) FromDBString added in v1.3.0

func (f FeedSpecTypes) FromDBString(s string) *FeedSpecTypes

func (FeedSpecTypes) IsValid added in v1.3.0

func (e FeedSpecTypes) IsValid() bool

func (FeedSpecTypes) MarshalGQL added in v1.3.0

func (e FeedSpecTypes) MarshalGQL(w io.Writer)

func (FeedSpecTypes) MarshalJSON added in v1.3.0

func (e FeedSpecTypes) MarshalJSON() ([]byte, error)

func (FeedSpecTypes) String added in v1.3.0

func (e FeedSpecTypes) String() string

func (FeedSpecTypes) ToDBString added in v1.3.0

func (f FeedSpecTypes) ToDBString() string

func (*FeedSpecTypes) UnmarshalGQL added in v1.3.0

func (e *FeedSpecTypes) UnmarshalGQL(v any) error

func (*FeedSpecTypes) UnmarshalJSON added in v1.3.0

func (e *FeedSpecTypes) UnmarshalJSON(b []byte) error

type FeedState

type FeedState struct {
	dmfr.FeedState
}

type FeedUrls

type FeedUrls struct {
	dmfr.FeedUrls
}

type FeedVersion

type FeedVersion struct {
	SHA1Dir tt.String `json:"sha1_dir"`
	dmfr.FeedVersion
}

type FeedVersionDeleteResult

type FeedVersionDeleteResult struct {
	// True if the delete succeeded
	Success bool `json:"success"`
}

Result of feed version delete operation

type FeedVersionFetchResult

type FeedVersionFetchResult struct {
	// Details of the fetched feed version, if the fetch succeeded
	FeedVersion *FeedVersion `json:"feed_version,omitempty"`
	// Error message if the fetch failed
	FetchError *string `json:"fetch_error,omitempty"`
	// True if the same zip file is already in the database (matched by SHA1)
	FoundSha1 bool `json:"found_sha1"`
	// True if a zip with identical unpacked contents is already in the database (matched by directory SHA1)
	FoundDirSha1 bool `json:"found_dir_sha1"`
}

Result of a feed fetch operation

type FeedVersionFileInfo

type FeedVersionFileInfo struct {
	dmfr.FeedVersionFileInfo
}

type FeedVersionFilter

type FeedVersionFilter struct {
	// Restrict to specific ids
	Ids []int `json:"ids,omitempty"`
	// Search for feed versions with the specified import status
	ImportStatus *ImportStatus `json:"import_status,omitempty"`
	// Search for feed versions with this feed Onestop ID
	FeedOnestopID *string `json:"feed_onestop_id,omitempty"`
	// Search for feed versions with this SHA1 hash
	Sha1 *string `json:"sha1,omitempty"`
	// Search for feed versions with this file identifier
	File *string `json:"file,omitempty"`
	// Search for feed versions with the specified feed integer IDs
	FeedIds []int `json:"feed_ids,omitempty"`
	// Search for feed versions that cover the specified date range
	Covers *ServiceCoversFilter `json:"covers,omitempty"`
	// Search for feed versions within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for feed versions within this geographic polygon
	Within *tt.Polygon `json:"within,omitempty"`
	// Search for feed versions within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
	// Search for feed versions with these license details
	License *LicenseFilter `json:"license,omitempty"`
}

Search options for feed versions

type FeedVersionGtfsImport

type FeedVersionGtfsImport struct {
	WarningCount             *json.RawMessage `json:"warning_count"`
	EntityCount              *json.RawMessage `json:"entity_count"`
	SkipEntityErrorCount     *json.RawMessage `json:"skip_entity_error_count"`
	SkipEntityReferenceCount *json.RawMessage `json:"skip_entity_reference_count"`
	SkipEntityFilterCount    *json.RawMessage `json:"skip_entity_filter_count"`
	SkipEntityMarkedCount    *json.RawMessage `json:"skip_entity_marked_count"`
	dmfr.FeedVersionImport
}

type FeedVersionImportResult

type FeedVersionImportResult struct {
	// True if the import succeeded
	Success bool `json:"success"`
}

Result of feed version import operation

type FeedVersionInput added in v1.3.0

type FeedVersionInput struct {
	// Integer ID of the feed version
	ID *int `json:"id,omitempty"`
}

Reference to an existing feed version

type FeedVersionServiceLevel

type FeedVersionServiceLevel struct {
	dmfr.FeedVersionServiceLevel
}

type FeedVersionServiceLevelFilter

type FeedVersionServiceLevelFilter struct {
	// Search for service level summaries starting on or after this date
	StartDate *tt.Date `json:"start_date,omitempty"`
	// Search for service level summaries ending on or before this date
	EndDate *tt.Date `json:"end_date,omitempty"`
}

Search options for feed version service level summaries

type FeedVersionServiceWindow added in v1.3.0

type FeedVersionServiceWindow struct {
	// Internal integer ID
	ID int `json:"id"`
	// Feed start date from feed_info.txt, if available
	FeedStartDate *tt.Date `json:"feed_start_date,omitempty"`
	// Feed end date from feed_info.txt, if available
	FeedEndDate *tt.Date `json:"feed_end_date,omitempty"`
	// Earliest calendar date with scheduled service
	EarliestCalendarDate *tt.Date `json:"earliest_calendar_date,omitempty"`
	// Latest calendar date with scheduled service
	LatestCalendarDate *tt.Date `json:"latest_calendar_date,omitempty"`
	// Start date (Monday) of a representative week with full or near-full service; used as a fallback when queries fall outside the regular service window
	FallbackWeek *tt.Date `json:"fallback_week,omitempty"`
	// Default timezone
	DefaultTimezone *string `json:"default_timezone,omitempty"`
	FeedVersionID   int     `json:"-"`
}

Summary details on service dates in a feed version

type FeedVersionSetInput

type FeedVersionSetInput struct {
	// Integer ID of the feed version to update; required
	ID *int `json:"id,omitempty"`
	// New name for the feed version
	Name *string `json:"name,omitempty"`
	// New description for the feed version
	Description *string `json:"description,omitempty"`
}

Update a feed version entity

type FeedVersionUnimportResult

type FeedVersionUnimportResult struct {
	// True if the unimport succeeded
	Success bool `json:"success"`
}

Result of feed version unimport operation

type Finder added in v1.3.0

Finder provides all necessary database methods

type FlexStopTime added in v1.3.0

type FlexStopTime = StopTime

FlexStopTime is an alias for StopTime. Both types represent stop_times records and share the same underlying model (gtfs.StopTime). The separation exists only for GraphQL schema purposes where they have different resolvers.

type FocusPoint added in v1.3.0

type FocusPoint struct {
	// Latitude
	Lat float64 `json:"lat"`
	// Longitude
	Lon float64 `json:"lon"`
}

A point used to bias result ordering by distance, without otherwise filtering results

type Frequency

type Frequency struct {
	gtfs.Frequency
}

type GbfsAlertTime added in v1.3.0

type GbfsAlertTime struct {
	*gbfs.AlertTime
}

type GbfsBikeRequest added in v1.3.0

type GbfsBikeRequest struct {
	// Search for vehicles within this radius of a point
	Near *PointRadius `json:"near,omitempty"`
}

Request parameters for querying nearby free-floating bikes/scooters.

type GbfsBrandAsset added in v1.3.0

type GbfsBrandAsset struct {
	*gbfs.BrandAsset
}

type GbfsDockRequest added in v1.3.0

type GbfsDockRequest struct {
	// Search for stations within this radius of a point
	Near *PointRadius `json:"near,omitempty"`
}

Request parameters for querying nearby docking stations.

type GbfsFeed added in v1.3.0

type GbfsFeed struct {
	*gbfs.GbfsFeed
}

func (*GbfsFeed) Alerts added in v1.3.0

func (g *GbfsFeed) Alerts() []*GbfsSystemAlert

func (*GbfsFeed) Calendars added in v1.3.0

func (g *GbfsFeed) Calendars() []*GbfsSystemCalendar

func (*GbfsFeed) RentalHours added in v1.3.0

func (g *GbfsFeed) RentalHours() []*GbfsSystemHour

func (*GbfsFeed) StationInformation added in v1.3.0

func (g *GbfsFeed) StationInformation() []*GbfsStationInformation

func (*GbfsFeed) SystemInformation added in v1.3.0

func (g *GbfsFeed) SystemInformation() *GbfsSystemInformation

type GbfsFinder added in v1.3.0

type GbfsFinder interface {
	AddData(context.Context, string, gbfs.GbfsFeed) error
	FindBikes(context.Context, *int, *GbfsBikeRequest) ([]*GbfsFreeBikeStatus, error)
	FindDocks(context.Context, *int, *GbfsDockRequest) ([]*GbfsStationInformation, error)
}

GbfsFinder manages and looks up GBFS data

type GbfsFreeBikeStatus added in v1.3.0

type GbfsFreeBikeStatus struct {
	Feed *GbfsFeed
	*gbfs.FreeBikeStatus
}

func (*GbfsFreeBikeStatus) HomeStation added in v1.3.0

func (g *GbfsFreeBikeStatus) HomeStation() *GbfsStationInformation

func (*GbfsFreeBikeStatus) PricingPlan added in v1.3.0

func (g *GbfsFreeBikeStatus) PricingPlan() *GbfsSystemPricingPlan

func (*GbfsFreeBikeStatus) RentalUris added in v1.3.0

func (g *GbfsFreeBikeStatus) RentalUris() *GbfsRentalUris

func (*GbfsFreeBikeStatus) Station added in v1.3.0

func (*GbfsFreeBikeStatus) VehicleType added in v1.3.0

func (g *GbfsFreeBikeStatus) VehicleType() *GbfsVehicleType

type GbfsGeofenceFeature added in v1.3.0

type GbfsGeofenceFeature struct {
	*gbfs.GeofenceFeature
}

func (*GbfsGeofenceFeature) Properties added in v1.3.0

func (g *GbfsGeofenceFeature) Properties() []*GbfsGeofenceProperty

type GbfsGeofenceProperty added in v1.3.0

type GbfsGeofenceProperty struct {
	*gbfs.GeofenceProperty
}

func (*GbfsGeofenceProperty) Rules added in v1.3.0

func (g *GbfsGeofenceProperty) Rules() []*GbfsGeofenceRule

type GbfsGeofenceRule added in v1.3.0

type GbfsGeofenceRule struct {
	*gbfs.GeofenceRule
}

func (*GbfsGeofenceRule) VehicleType added in v1.3.0

func (g *GbfsGeofenceRule) VehicleType() *GbfsVehicleType

type GbfsGeofenceZone added in v1.3.0

type GbfsGeofenceZone struct {
	*gbfs.GeofenceZone
}

func (*GbfsGeofenceZone) Features added in v1.3.0

func (g *GbfsGeofenceZone) Features() []*GbfsGeofenceFeature

type GbfsPlanPrice added in v1.3.0

type GbfsPlanPrice struct {
	*gbfs.PlanPrice
}

type GbfsRentalApp added in v1.3.0

type GbfsRentalApp struct {
	*gbfs.RentalApp
}

type GbfsRentalApps added in v1.3.0

type GbfsRentalApps struct {
	*gbfs.RentalApps
}

func (*GbfsRentalApps) Android added in v1.3.0

func (g *GbfsRentalApps) Android() *GbfsRentalApp

func (*GbfsRentalApps) Ios added in v1.3.0

func (g *GbfsRentalApps) Ios() *GbfsRentalApp

type GbfsRentalUris added in v1.3.0

type GbfsRentalUris struct {
	*gbfs.RentalURIs
}

type GbfsStationInformation added in v1.3.0

type GbfsStationInformation struct {
	Feed *GbfsFeed
	*gbfs.StationInformation
}

func (*GbfsStationInformation) Region added in v1.3.0

func (*GbfsStationInformation) Status added in v1.3.0

type GbfsStationStatus added in v1.3.0

type GbfsStationStatus struct {
	Feed *GbfsFeed
	*gbfs.StationStatus
}

func (*GbfsStationStatus) VehicleDocksAvailable added in v1.3.0

func (g *GbfsStationStatus) VehicleDocksAvailable() []*GbfsVehicleDockAvailable

func (*GbfsStationStatus) VehicleTypesAvailable added in v1.3.0

func (g *GbfsStationStatus) VehicleTypesAvailable() []*GbfsVehicleTypeAvailable

type GbfsSystemAlert added in v1.3.0

type GbfsSystemAlert struct {
	*gbfs.SystemAlert
}

func (*GbfsSystemAlert) Times added in v1.3.0

func (g *GbfsSystemAlert) Times() []*GbfsAlertTime

type GbfsSystemCalendar added in v1.3.0

type GbfsSystemCalendar struct {
	*gbfs.SystemCalendar
}

type GbfsSystemHour added in v1.3.0

type GbfsSystemHour struct {
	*gbfs.SystemHour
}

type GbfsSystemInformation added in v1.3.0

type GbfsSystemInformation struct {
	Feed *GbfsFeed
	*gbfs.SystemInformation
}

func (*GbfsSystemInformation) BrandAssets added in v1.3.0

func (g *GbfsSystemInformation) BrandAssets() *GbfsBrandAsset

func (*GbfsSystemInformation) RentalApps added in v1.3.0

func (g *GbfsSystemInformation) RentalApps() *GbfsRentalApps

type GbfsSystemPricingPlan added in v1.3.0

type GbfsSystemPricingPlan struct {
	*gbfs.SystemPricingPlan
}

func (*GbfsSystemPricingPlan) PerKmPricing added in v1.3.0

func (g *GbfsSystemPricingPlan) PerKmPricing() []*GbfsPlanPrice

func (*GbfsSystemPricingPlan) PerMinPricing added in v1.3.0

func (g *GbfsSystemPricingPlan) PerMinPricing() []*GbfsPlanPrice

type GbfsSystemRegion added in v1.3.0

type GbfsSystemRegion struct {
	*gbfs.SystemRegion
}

type GbfsSystemVersion added in v1.3.0

type GbfsSystemVersion struct {
	*gbfs.SystemVersion
}

type GbfsVehicleAssets added in v1.3.0

type GbfsVehicleAssets struct {
	*gbfs.VehicleAssets
}

type GbfsVehicleDockAvailable added in v1.3.0

type GbfsVehicleDockAvailable struct {
	Feed *GbfsFeed
	*gbfs.VehicleDockAvailable
}

func (*GbfsVehicleDockAvailable) VehicleTypes added in v1.3.0

func (g *GbfsVehicleDockAvailable) VehicleTypes() []*GbfsVehicleType

type GbfsVehicleType added in v1.3.0

type GbfsVehicleType struct {
	Feed *GbfsFeed
	*gbfs.VehicleType
}

func (*GbfsVehicleType) DefaultPricingPlan added in v1.3.0

func (g *GbfsVehicleType) DefaultPricingPlan() *GbfsSystemPricingPlan

func (*GbfsVehicleType) PricingPlans added in v1.3.0

func (g *GbfsVehicleType) PricingPlans() []*GbfsSystemPricingPlan

func (*GbfsVehicleType) RentalUris added in v1.3.0

func (g *GbfsVehicleType) RentalUris() *GbfsRentalUris

func (*GbfsVehicleType) VehicleAssets added in v1.3.0

func (g *GbfsVehicleType) VehicleAssets() *GbfsVehicleAssets

type GbfsVehicleTypeAvailable added in v1.3.0

type GbfsVehicleTypeAvailable struct {
	Feed *GbfsFeed
	*gbfs.VehicleTypeAvailable
}

func (*GbfsVehicleTypeAvailable) VehicleType added in v1.3.0

func (g *GbfsVehicleTypeAvailable) VehicleType() *GbfsVehicleType

type Group added in v1.3.3

type Group struct {
	// Internal integer ID
	ID int `json:"id"`
	// Group name
	Name string `json:"name"`
	// Parent tenant
	Tenant *Tenant `json:"tenant,omitempty"`
	// Feeds assigned to this group
	Feeds []*Feed `json:"feeds"`
	// Authorization permissions for this group
	Permissions *Permissions `json:"permissions,omitempty"`
}

A group that organizes feeds within a tenant

type ImportStatus

type ImportStatus string

Import status for a feed version

const (
	// Imported successfully
	ImportStatusSuccess ImportStatus = "SUCCESS"
	// Did not import successfully
	ImportStatusError ImportStatus = "ERROR"
	// Import is currently in progress
	ImportStatusInProgress ImportStatus = "IN_PROGRESS"
)

func (ImportStatus) IsValid

func (e ImportStatus) IsValid() bool

func (ImportStatus) MarshalGQL

func (e ImportStatus) MarshalGQL(w io.Writer)

func (ImportStatus) MarshalJSON added in v1.3.0

func (e ImportStatus) MarshalJSON() ([]byte, error)

func (ImportStatus) String

func (e ImportStatus) String() string

func (*ImportStatus) UnmarshalGQL

func (e *ImportStatus) UnmarshalGQL(v any) error

func (*ImportStatus) UnmarshalJSON added in v1.3.0

func (e *ImportStatus) UnmarshalJSON(b []byte) error

type Itinerary added in v1.3.0

type Itinerary struct {
	// Total duration of this itinerary
	Duration *Duration `json:"duration"`
	// Total distance of this itinerary
	Distance *Distance `json:"distance"`
	// Departure time of this itinerary
	StartTime time.Time `json:"start_time"`
	// Arrival time of this itinerary
	EndTime time.Time `json:"end_time"`
	// Origin waypoint
	From *Waypoint `json:"from"`
	// Destination waypoint
	To *Waypoint `json:"to"`
	// Ordered list of legs making up this itinerary
	Legs []*Leg `json:"legs,omitempty"`
}

A single trip option from origin to destination, composed of one or more `Leg`s.

type JobArtifact added in v1.3.4

type JobArtifact struct {
	JobID       string `db:"job_id" json:"job_id"`
	JobKind     string `db:"job_kind" json:"job_kind"`
	UserID      string `db:"user_id" json:"-"`
	Filename    string `db:"filename" json:"filename"`
	ContentType string `db:"content_type" json:"content_type"`
	SizeBytes   int64  `db:"size_bytes" json:"size_bytes"`
	SHA1        string `db:"sha1" json:"sha1,omitempty"`
	StorageKey  string `db:"storage_key" json:"-"`
	tt.DatabaseEntity
	tt.Timestamps
}

JobArtifact is a file produced by a background job, for the submitting user to download. It is both the tl_job_artifacts row and the artifact-API DTO.

JobID is opaque: a river_job id, local uuid, or Argo workflow name, never a foreign key. UserID and StorageKey are internal (json:"-") and must not reach API clients.

func (*JobArtifact) TableName added in v1.3.4

func (e *JobArtifact) TableName() string

TableName implements the tldb table-name interface.

type Leg added in v1.3.0

type Leg struct {
	// Duration of this leg
	Duration *Duration `json:"duration"`
	// Distance of this leg
	Distance *Distance `json:"distance"`
	// Start time of this leg
	StartTime time.Time `json:"start_time"`
	// End time of this leg
	EndTime time.Time `json:"end_time"`
	// Origin waypoint for this leg
	From *Waypoint `json:"from,omitempty"`
	// Destination waypoint for this leg
	To *Waypoint `json:"to,omitempty"`
	// Travel mode for this leg
	Mode *StepMode `json:"mode,omitempty"`
	// Turn-by-turn steps for this leg (non-transit modes)
	Steps []*Step `json:"steps,omitempty"`
	// Stops served by this leg, from origin to destination, including any intermediate stops (transit mode only)
	Stops []*WaypointDeparture `json:"stops,omitempty"`
	// Path geometry for this leg as a LineString
	Geometry tt.LineString `json:"geometry"`
	// Transit trip details for this leg (transit mode only)
	Trip *LegTrip `json:"trip,omitempty"`
}

A single segment of an itinerary, traveled by a single mode (e.g. walk, transit vehicle).

A transit leg includes the route, trip, and intermediate stops. A walk leg includes turn-by-turn steps.

type LegRoute added in v1.3.0

type LegRoute struct {
	// GTFS route_id
	RouteID string `json:"route_id"`
	// GTFS route_short_name
	RouteShortName string `json:"route_short_name"`
	// GTFS route_long_name
	RouteLongName string `json:"route_long_name"`
	// Onestop ID for this route
	RouteOnestopID string `json:"route_onestop_id"`
	// GTFS route_type
	RouteType int `json:"route_type"`
	// Route color in hex format (e.g. `FF0000`)
	RouteColor *string `json:"route_color,omitempty"`
	// Route text color in hex format
	RouteTextColor *string `json:"route_text_color,omitempty"`
	// Agency operating this route
	Agency *LegRouteAgency `json:"agency"`
}

Summary of the route used within a leg.

type LegRouteAgency added in v1.3.0

type LegRouteAgency struct {
	// GTFS agency_id
	AgencyID string `json:"agency_id"`
	// Agency name
	AgencyName string `json:"agency_name"`
	// Onestop ID for this agency
	AgencyOnestopID string `json:"agency_onestop_id"`
}

Summary of the agency operating the route within a leg.

type LegTrip added in v1.3.0

type LegTrip struct {
	// GTFS trip_id
	TripID string `json:"trip_id"`
	// GTFS trip_short_name
	TripShortName string `json:"trip_short_name"`
	// Trip headsign
	Headsign string `json:"headsign"`
	// Feed Onestop ID for the source feed
	FeedID string `json:"feed_id"`
	// SHA1 hash of the source feed version
	FeedVersionSha1 string `json:"feed_version_sha1"`
	// Route information for this trip
	Route *LegRoute `json:"route"`
}

Summary of the transit trip used within a leg.

type Level

type Level struct {
	Geometry      tt.MultiPolygon
	ParentStation tt.Key
	gtfs.Level
}

type LevelSetInput added in v1.3.0

type LevelSetInput struct {
	// Integer ID of the level to update; omit when creating a new level
	ID *int `json:"id,omitempty"`
	// Feed version this level belongs to (required when creating a new level)
	FeedVersion *FeedVersionInput `json:"feed_version,omitempty"`
	// Set GTFS level_id
	LevelID *string `json:"level_id,omitempty"`
	// Set GTFS level_name
	LevelName *string `json:"level_name,omitempty"`
	// Set GTFS level_index
	LevelIndex *float64 `json:"level_index,omitempty"`
	// Set level geometry
	Geometry *tt.MultiPolygon `json:"geometry,omitempty"`
	// Reference to an existing parent station; only the `id` is used (the parent must already exist)
	Parent *StopSetInput `json:"parent,omitempty"`
}

Create or update a level entity. For updates, supply `id`. For creation, supply `feed_version`

type LicenseFilter added in v1.3.0

type LicenseFilter struct {
	// Search for entities with this Share Alike license restriction
	ShareAlikeOptional *LicenseValue `json:"share_alike_optional,omitempty"`
	// Search for entities with this Create Derived Product license restriction
	CreateDerivedProduct *LicenseValue `json:"create_derived_product,omitempty"`
	// Search for entities with this Commercial Use Allowed restriction
	CommercialUseAllowed *LicenseValue `json:"commercial_use_allowed,omitempty"`
	// Search for entities with this Use Without Attribution restriction
	UseWithoutAttribution *LicenseValue `json:"use_without_attribution,omitempty"`
	// Search for entities with this Redistribution Allowed restriction
	RedistributionAllowed *LicenseValue `json:"redistribution_allowed,omitempty"`
}

Search for entities with these license requirements. See feed license documentation.

type LicenseValue added in v1.3.0

type LicenseValue string

Permissible and impermissible actions for a given license use

const (
	// Use is allowed
	LicenseValueYes LicenseValue = "YES"
	// Use is not allowed
	LicenseValueNo LicenseValue = "NO"
	// Match any value that is not `NO` (i.e. `YES` or `UNKNOWN`); used in license filters
	LicenseValueExcludeNo LicenseValue = "EXCLUDE_NO"
	// Use is not known
	LicenseValueUnknown LicenseValue = "UNKNOWN"
)

func (LicenseValue) IsValid added in v1.3.0

func (e LicenseValue) IsValid() bool

func (LicenseValue) MarshalGQL added in v1.3.0

func (e LicenseValue) MarshalGQL(w io.Writer)

func (LicenseValue) MarshalJSON added in v1.3.0

func (e LicenseValue) MarshalJSON() ([]byte, error)

func (LicenseValue) String added in v1.3.0

func (e LicenseValue) String() string

func (*LicenseValue) UnmarshalGQL added in v1.3.0

func (e *LicenseValue) UnmarshalGQL(v any) error

func (*LicenseValue) UnmarshalJSON added in v1.3.0

func (e *LicenseValue) UnmarshalJSON(b []byte) error

type Location added in v1.3.0

type Location struct {
	FeedOnestopID   string
	FeedVersionSHA1 string
	gtfs.Location
}

type LocationFilter added in v1.3.0

type LocationFilter struct {
	// Restrict to specific ids
	Ids []int `json:"ids,omitempty"`
	// Search for locations with this location_id
	LocationID *string `json:"location_id,omitempty"`
}

Search options for locations

type LocationGroup added in v1.3.0

type LocationGroup struct {
	FeedOnestopID   string
	FeedVersionSHA1 string
	gtfs.LocationGroup
}

type LocationGroupFilter added in v1.3.0

type LocationGroupFilter struct {
	// Restrict to specific ids
	Ids []int `json:"ids,omitempty"`
	// Search for location groups with this location_group_id
	LocationGroupID *string `json:"location_group_id,omitempty"`
}

Search options for location groups

type LocationGroupStop added in v1.3.0

type LocationGroupStop struct {
	gtfs.LocationGroupStop
}

type Me added in v1.3.0

type Me struct {
	// Internal identifier
	ID string `json:"id"`
	// User name
	Name *string `json:"name,omitempty"`
	// User email
	Email *string `json:"email,omitempty"`
	// Roles assigned to this user
	Roles []string `json:"roles,omitempty"`
	// External identifiers and metadata associated with this user, e.g. metering service IDs
	ExternalData tt.Map `json:"external_data"`
}

Current user metadata

type Mutation added in v1.3.0

type Mutation struct {
}

Root Mutation type.

**Authorization**: Most mutations require specific user roles and permissions (e.g. `editor`, `admin`).

type Operator

type Operator struct {
	ID            int
	Generated     bool
	FeedID        int
	FeedOnestopID *string
	SearchRank    *string // internal
	AgencyID      int     // internal
	dmfr.Operator
}

type OperatorFilter

type OperatorFilter struct {
	// If true, collapse multiple agency-operator associations into a single result per operator
	Merged *bool `json:"merged,omitempty"`
	// Search for operators with this Onestop ID
	OnestopID *string `json:"onestop_id,omitempty"`
	// Search for operators with this feed Onestop ID
	FeedOnestopID *string `json:"feed_onestop_id,omitempty"`
	// Search for operators with agencies having this GTFS agency_id
	AgencyID *string `json:"agency_id,omitempty"`
	// Full-text search string
	Search *string `json:"search,omitempty"`
	// Search for operators matching these tags
	Tags *tt.Tags `json:"tags,omitempty"`
	// Search for operators by city name (provided by Natural Earth)
	CityName *string `json:"city_name,omitempty"`
	// Search for operators by country name (provided by Natural Earth)
	Adm0Name *string `json:"adm0_name,omitempty"`
	// Search for operators by state/province/division name (provided by Natural Earth)
	Adm1Name *string `json:"adm1_name,omitempty"`
	// Search for operators by country 2 letter ISO 3166 code (provided by Natural Earth)
	Adm0Iso *string `json:"adm0_iso,omitempty"`
	// Search for operators by state/province/division ISO 3166-2 code (provided by Natural Earth)
	Adm1Iso *string `json:"adm1_iso,omitempty"`
	// Search for operators with these license details
	License *LicenseFilter `json:"license,omitempty"`
	// Search for operators within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for operators within this geographic polygon
	Within *tt.Polygon `json:"within,omitempty"`
	// Search for operators within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
}

Search options for operators

type PageInfo added in v1.3.2

type PageInfo struct {
	HasNextPage     bool
	HasPreviousPage bool
	StartCursor     *string
	EndCursor       *string
}

PageInfo contains pagination metadata

type Pathway

type Pathway struct {
	gtfs.Pathway
}

type PathwayFilter

type PathwayFilter struct {
	// Search for pathways with this GTFS pathway_mode
	PathwayMode *int `json:"pathway_mode,omitempty"`
}

Search options for pathways

type PathwaySetInput added in v1.3.0

type PathwaySetInput struct {
	// Integer ID of the pathway to update; omit when creating a new pathway
	ID *int `json:"id,omitempty"`
	// Feed version this pathway belongs to (required when creating a new pathway)
	FeedVersion *FeedVersionInput `json:"feed_version,omitempty"`
	// Set GTFS pathway_id
	PathwayID *string `json:"pathway_id,omitempty"`
	// Set GTFS pathway_mode
	PathwayMode *int `json:"pathway_mode,omitempty"`
	// Set GTFS is_bidirectional
	IsBidirectional *int `json:"is_bidirectional,omitempty"`
	// Set GTFS length
	Length *float64 `json:"length,omitempty"`
	// Set GTFS traversal_time
	TraversalTime *int `json:"traversal_time,omitempty"`
	// Set GTFS stair_count
	StairCount *int `json:"stair_count,omitempty"`
	// Set GTFS max_slope
	MaxSlope *float64 `json:"max_slope,omitempty"`
	// Set GTFS min_width
	MinWidth *float64 `json:"min_width,omitempty"`
	// Set GTFS signposted_as
	SignpostedAs *string `json:"signposted_as,omitempty"`
	// Set GTFS reverse_signposted_as
	ReverseSignpostedAs *string `json:"reverse_signposted_as,omitempty"`
	// Reference to an existing origin stop; only the `id` is used (the stop must already exist)
	FromStop *StopSetInput `json:"from_stop,omitempty"`
	// Reference to an existing destination stop; only the `id` is used (the stop must already exist)
	ToStop *StopSetInput `json:"to_stop,omitempty"`
}

Create or update a pathway entity. For updates, supply `id`. For creation, supply `feed_version`

type PermFilter added in v1.3.0

type PermFilter struct {
	AllowedFeeds        []int
	AllowedFeedVersions []int
	IsGlobalAdmin       bool
}

PermFilter holds permission-based filtering criteria for feeds and feed versions. When IsGlobalAdmin is true, no filtering is applied (unrestricted access). Otherwise, access is restricted to the specified AllowedFeeds and AllowedFeedVersions IDs.

func PermsForContext added in v1.3.0

func PermsForContext(ctx context.Context) *PermFilter

PermsForContext retrieves the PermFilter from context. Always returns a non-nil PermFilter. If none is set, returns an empty filter.

func (*PermFilter) GetAllowedFeedVersions added in v1.3.0

func (pf *PermFilter) GetAllowedFeedVersions() []int

func (*PermFilter) GetAllowedFeeds added in v1.3.0

func (pf *PermFilter) GetAllowedFeeds() []int

func (*PermFilter) GetIsGlobalAdmin added in v1.3.2

func (pf *PermFilter) GetIsGlobalAdmin() bool

GetIsGlobalAdmin returns true if the user has global admin privileges (unrestricted access).

type PermFinder added in v1.3.0

type PermFinder interface {
	PermFilter(context.Context) *PermFilter
}

type PermissionRef added in v1.3.3

type PermissionRef struct {
	// Entity type (e.g. tenant, group, feed, feed_version)
	Type string `json:"type"`
	// Entity ID
	ID int `json:"id"`
	// Display name
	Name string `json:"name"`
}

Reference to a related entity in the authorization hierarchy

type PermissionSubject added in v1.3.3

type PermissionSubject struct {
	// Type of subject (e.g. user, tenant, group)
	Type string `json:"type"`
	// Subject identifier
	ID string `json:"id"`
	// Display name
	Name string `json:"name"`
	// Relationship type (e.g. admin, member, viewer, editor, manager)
	Relation string `json:"relation"`
}

A user or group that has been granted access to an entity

type Permissions added in v1.3.3

type Permissions struct {
	// Actions the current user can perform on this entity
	Actions []string `json:"actions"`
	// Users and groups with direct access to this entity
	Subjects []*PermissionSubject `json:"subjects"`
	// Parent entity in the authorization hierarchy
	Parent *PermissionRef `json:"parent,omitempty"`
	// Child entities in the authorization hierarchy
	Children []*PermissionRef `json:"children"`
}

Authorization permissions for an entity

type Place added in v1.3.0

type Place struct {
	// Country name
	Adm0Name *string `json:"adm0_name,omitempty"`
	// State or province name
	Adm1Name *string `json:"adm1_name,omitempty"`
	// City name
	CityName *string `json:"city_name,omitempty"`
	// Number of associated operators
	Count int `json:"count"`
	// Operators associated with this place
	Operators []*Operator `json:"operators,omitempty"`
	AgencyIDs tt.Ints     `db:"agency_ids"`
}

Place name and associated operators.

See [Concepts: Places](https://www.transit.land/documentation/concepts/places).

type PlaceAggregationLevel added in v1.3.0

type PlaceAggregationLevel string

PlaceAggregationLevel controls the level of aggregation in a places query.

const (
	// Aggregate places based on country
	PlaceAggregationLevelAdm0 PlaceAggregationLevel = "ADM0"
	// Aggregate places based on country and state/province
	PlaceAggregationLevelAdm0Adm1 PlaceAggregationLevel = "ADM0_ADM1"
	// Aggregate places based on country, state/province, and city
	PlaceAggregationLevelAdm0Adm1City PlaceAggregationLevel = "ADM0_ADM1_CITY"
	// Aggregate places based on country and city
	PlaceAggregationLevelAdm0City PlaceAggregationLevel = "ADM0_CITY"
	// Aggregate places based on state/province and city
	PlaceAggregationLevelAdm1City PlaceAggregationLevel = "ADM1_CITY"
	// Aggregate places based on city
	PlaceAggregationLevelCity PlaceAggregationLevel = "CITY"
)

func (PlaceAggregationLevel) IsValid added in v1.3.0

func (e PlaceAggregationLevel) IsValid() bool

func (PlaceAggregationLevel) MarshalGQL added in v1.3.0

func (e PlaceAggregationLevel) MarshalGQL(w io.Writer)

func (PlaceAggregationLevel) MarshalJSON added in v1.3.0

func (e PlaceAggregationLevel) MarshalJSON() ([]byte, error)

func (PlaceAggregationLevel) String added in v1.3.0

func (e PlaceAggregationLevel) String() string

func (*PlaceAggregationLevel) UnmarshalGQL added in v1.3.0

func (e *PlaceAggregationLevel) UnmarshalGQL(v any) error

func (*PlaceAggregationLevel) UnmarshalJSON added in v1.3.0

func (e *PlaceAggregationLevel) UnmarshalJSON(b []byte) error

type PlaceFilter added in v1.3.0

type PlaceFilter struct {
	// Search for place associations with at least this rank value
	MinRank *float64 `json:"min_rank,omitempty"`
	// Search for place associations by country name (provided by Natural Earth)
	Adm0Name *string `json:"adm0_name,omitempty"`
	// Search for place associations by state/province/division name (provided by Natural Earth)
	Adm1Name *string `json:"adm1_name,omitempty"`
	// Search for place associations by city name (provided by Natural Earth)
	CityName *string `json:"city_name,omitempty"`
}

Search options for associated places

type PointRadius

type PointRadius struct {
	// Latitude
	Lat float64 `json:"lat"`
	// Longitude
	Lon float64 `json:"lon"`
	// Search radius in meters
	Radius float64 `json:"radius"`
}

Search for entities within specified radius of a point

type Query added in v1.3.0

type Query struct {
}

Root Query type.

**Authorization**: Most queries are available to all callers. A few (e.g. user-specific data) require authentication or specific roles.

type RTFinder added in v1.3.0

type RTFinder interface {
	AddData(context.Context, string, []byte) error
	FindTrip(context.Context, *Trip) *pb.TripUpdate
	MakeTrip(context.Context, *Trip) (*Trip, error)
	FindAlertsForTrip(context.Context, *Trip, *int, *bool) []*Alert
	FindAlertsForStop(context.Context, *Stop, *int, *bool) []*Alert
	FindAlertsForRoute(context.Context, *Route, *int, *bool) []*Alert
	FindAlertsForAgency(context.Context, *Agency, *int, *bool) []*Alert
	GetAddedTripsForStop(context.Context, *Stop) []*pb.TripUpdate
	FindStopTimeUpdate(context.Context, *Trip, *StopTime) (*RTStopTimeUpdate, bool)
	// lookup cache methods
	StopTimezone(context.Context, int, string) (*time.Location, bool)
	FeedVersionTimezone(context.Context, int) (*time.Location, bool)
	GetGtfsTripID(context.Context, int) (string, bool)
	GetMessage(context.Context, string, string) (*pb.FeedMessage, bool)
}

RTFinder manages and looks up RT data

type RTStopTimeUpdate added in v1.3.0

type RTStopTimeUpdate struct {
	LastDelay      *int32
	StopTimeUpdate *pb.TripUpdate_StopTimeUpdate
	TripUpdate     *pb.TripUpdate
}

type RTTimeRange added in v1.3.0

type RTTimeRange struct {
	// Start of the range, in Unix epoch seconds
	Start *int `json:"start,omitempty"`
	// End of the range, in Unix epoch seconds
	End *int `json:"end,omitempty"`
}

A time range expressed as Unix epoch seconds; used for GTFS-RT alert active periods. See https://gtfs.org/reference/realtime/v2/#message-timerange

type RTTranslation added in v1.3.0

type RTTranslation struct {
	// Translated text
	Text string `json:"text"`
	// BCP 47 language tag for this translation
	Language *string `json:"language,omitempty"`
}

A single translation of a string in a GTFS-RT message (e.g. an alert header or description). See https://gtfs.org/reference/realtime/v2/#message-translatedstring

type RTTripDescriptor added in v1.3.0

type RTTripDescriptor struct {
	// GTFS `trip_id` identifying the trip
	TripID *string `json:"trip_id,omitempty"`
	// GTFS `route_id` of the trip's route
	RouteID *string `json:"route_id,omitempty"`
	// GTFS direction_id (0 or 1)
	DirectionID *int `json:"direction_id,omitempty"`
	// Scheduled start time of the trip in local time `HH:MM:SS`
	StartTime *tt.Seconds `json:"start_time,omitempty"`
	// Service date on which this trip runs (local time)
	StartDate *tt.Date `json:"start_date,omitempty"`
	// GTFS-RT schedule_relationship value as a string. See https://gtfs.org/realtime/reference/#enum-schedulerelationship-1
	ScheduleRelationship *string `json:"schedule_relationship,omitempty"`
}

Identification of a trip in a GTFS-RT message, used to match the trip back to the static GTFS schedule. See https://gtfs.org/reference/realtime/v2/#message-tripdescriptor

type RTVehicleDescriptor added in v1.3.0

type RTVehicleDescriptor struct {
	// Vehicle ID
	ID *string `json:"id,omitempty"`
	// Vehicle label
	Label *string `json:"label,omitempty"`
	// Vehicle license plate
	LicensePlate *string `json:"license_plate,omitempty"`
}

Identification information for the vehicle running a trip. See https://gtfs.org/reference/realtime/v2/#message-vehicledescriptor

type RelativeDate added in v1.3.0

type RelativeDate string

RelativeDate specifies a calendar date relative to the current local time.

const (
	// The current date
	RelativeDateToday RelativeDate = "TODAY"
	// Next Monday, or today if it is currently Monday
	RelativeDateMonday RelativeDate = "MONDAY"
	// Next Tuesday, or today if it is currently Tuesday
	RelativeDateTuesday RelativeDate = "TUESDAY"
	// Next Wednesday, or today if it is currently Wednesday
	RelativeDateWednesday RelativeDate = "WEDNESDAY"
	// Next Thursday, or today if it is currently Thursday
	RelativeDateThursday RelativeDate = "THURSDAY"
	// Next Friday, or today if it is currently Friday
	RelativeDateFriday RelativeDate = "FRIDAY"
	// Next Saturday, or today if it is currently Saturday
	RelativeDateSaturday RelativeDate = "SATURDAY"
	// Next Sunday, or today if it is currently Sunday
	RelativeDateSunday RelativeDate = "SUNDAY"
	// Next Monday, not inclusive of today
	RelativeDateNextMonday RelativeDate = "NEXT_MONDAY"
	// Next Tuesday, not inclusive of today
	RelativeDateNextTuesday RelativeDate = "NEXT_TUESDAY"
	// Next Wednesday, not inclusive of today
	RelativeDateNextWednesday RelativeDate = "NEXT_WEDNESDAY"
	// Next Thursday, not inclusive of today
	RelativeDateNextThursday RelativeDate = "NEXT_THURSDAY"
	// Next Friday, not inclusive of today
	RelativeDateNextFriday RelativeDate = "NEXT_FRIDAY"
	// Next Saturday, not inclusive of today
	RelativeDateNextSaturday RelativeDate = "NEXT_SATURDAY"
	// Next Sunday, not inclusive of today
	RelativeDateNextSunday RelativeDate = "NEXT_SUNDAY"
)

func (RelativeDate) IsValid added in v1.3.0

func (e RelativeDate) IsValid() bool

func (RelativeDate) MarshalGQL added in v1.3.0

func (e RelativeDate) MarshalGQL(w io.Writer)

func (RelativeDate) MarshalJSON added in v1.3.0

func (e RelativeDate) MarshalJSON() ([]byte, error)

func (RelativeDate) String added in v1.3.0

func (e RelativeDate) String() string

func (*RelativeDate) UnmarshalGQL added in v1.3.0

func (e *RelativeDate) UnmarshalGQL(v any) error

func (*RelativeDate) UnmarshalJSON added in v1.3.0

func (e *RelativeDate) UnmarshalJSON(b []byte) error

type Route

type Route struct {
	FeedOnestopID                string
	FeedVersionSHA1              string
	OnestopID                    *string
	HeadwaySecondsWeekdayMorning *int
	SearchRank                   *string
	gtfs.Route
}

type RouteAttribute added in v1.3.0

type RouteAttribute struct {
	// Route category code (e.g. service tier such as local, express, rapid)
	Category *int `json:"category,omitempty"`
	// Route subcategory code (further subdivision within `category`)
	Subcategory *int `json:"subcategory,omitempty"`
	// Running-way category code (e.g. dedicated lane, mixed traffic, grade-separated)
	RunningWay *int `json:"running_way,omitempty"`
	RouteID    int  `json:"-"`
}

Extended route metadata from the [MTC GTFS+ extension](https://github.com/MobilityData/gtfs-plus-spec) `route_attributes.txt` file. Values are integer codes defined by the extension; consult that spec for the meaning of each code.

type RouteFilter

type RouteFilter struct {
	// Search for routes with this Onestop ID
	OnestopID *string `json:"onestop_id,omitempty"`
	// Search for routes with these Onestop IDs
	OnestopIds []string `json:"onestop_ids,omitempty"`
	// Include previously used Onestop IDs that match the same (feed,route_id)
	AllowPreviousOnestopIds *bool `json:"allow_previous_onestop_ids,omitempty"`
	// Search for routes with this feed version SHA1 hash
	FeedVersionSha1 *string `json:"feed_version_sha1,omitempty"`
	// Search for routes with this feed Onestop ID
	FeedOnestopID *string `json:"feed_onestop_id,omitempty"`
	// Search for routes with this GTFS route_id
	RouteID *string `json:"route_id,omitempty"`
	// Search for routes with this GTFS route_type
	RouteType *int `json:"route_type,omitempty"`
	// Search for routes with any of these GTFS route_types
	RouteTypes []int `json:"route_types,omitempty"`
	// If true, restrict to routes with at least one trip; false or null returns all routes
	Serviced *bool `json:"serviced,omitempty"`
	// Full text search
	Search *string `json:"search,omitempty"`
	// Search for routes operated by operators with this Onestop ID
	OperatorOnestopID *string `json:"operator_onestop_id,omitempty"`
	// Search for routes that serve a stop with this Onestop ID
	ServesStopOnestopID *string `json:"serves_stop_onestop_id,omitempty"`
	// Search for routes with these license details
	License *LicenseFilter `json:"license,omitempty"`
	// Search for routes operated by these agencies (database integer IDs)
	AgencyIds []int `json:"agency_ids,omitempty"`
	// Geographic search options
	Location *RouteLocationFilter `json:"location,omitempty"`
	// Search for routes within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for routes within this geographic polygon
	Within *tt.Polygon `json:"within,omitempty"`
	// Search for routes within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
}

Search options for routes

type RouteGeometry

type RouteGeometry struct {
	// True if the source feed has no `shapes.txt` and this geometry was generated from straight lines between stop points
	Generated bool `json:"generated"`
	// Single LineString representing the most common shape for this route
	Geometry *tt.LineString `json:"geometry,omitempty"`
	// MultiLineString ensemble combining the most common shape for each direction
	CombinedGeometry *tt.Geometry `json:"combined_geometry,omitempty"`
	// Length of the `geometry` LineString, in meters
	Length *float64 `json:"length,omitempty"`
	// Maximum distance between consecutive points in the geometry, in meters; useful for flagging shapes with large gaps
	MaxSegmentLength *float64 `json:"max_segment_length,omitempty"`
	// Maximum distance from the first point of the geometry to any other point, in meters; small values indicate a loop route
	FirstPointMaxDistance *float64 `json:"first_point_max_distance,omitempty"`
	RouteID               int      `json:"-"`
}

Representative geometry for a route, derived from GTFS shapes (or stop coordinates as a fallback) and ranked by trip frequency.

type RouteHeadway

type RouteHeadway struct {
	// Representative stop used for the headway calculation
	Stop *Stop `json:"stop"`
	// Day of week category; 1=Weekday, 6=Saturday, 7=Sunday
	DowCategory *int `json:"dow_category,omitempty"`
	// GTFS direction_id (0 or 1)
	DirectionID *int `json:"direction_id,omitempty"`
	// Typical seconds between departures at this stop, direction, and day-of-week
	HeadwaySecs *int `json:"headway_secs,omitempty"`
	// Date used for the headway calculation
	ServiceDate *tt.Date `json:"service_date,omitempty"`
	// Number of departures on this stop, day, and direction
	StopTripCount *int `json:"stop_trip_count,omitempty"`
	// Departure times on this stop, day, and direction
	DeparturesUnused []*tt.Seconds `json:"departures,omitempty"`
	DepartureInts    tt.Ints       `db:"departures"`
	RouteID          int           `json:"-"`
	SelectedStopID   int           `json:"-"`
}

Calculated typical service frequency at a representative stop, broken down by day-of-week category and direction.

type RouteLocationFilter added in v1.3.0

type RouteLocationFilter struct {
	// Search for routes within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for routes within this geographic polygon
	Polygon *tt.Polygon `json:"polygon,omitempty"`
	// Search for routes within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
	// Focus search on this point; results will be sorted by distance
	Focus *FocusPoint `json:"focus,omitempty"`
}

Geographic search options for routes

type RouteStop

type RouteStop struct {
	// Internal integer ID
	ID int `json:"id"`
	// Database integer ID of the stop
	StopID int `json:"stop_id"`
	// Database integer ID of the route
	RouteID int `json:"route_id"`
	// Database integer ID of the agency
	AgencyID int `json:"agency_id"`
	// Associated route
	Route *Route `json:"route"`
	// Associated stop
	Stop *Stop `json:"stop"`
	// Associated agency
	Agency *Agency `json:"agency"`
}

Association between a stop, the route that serves it, and the operating agency. Provides the route and agency context alongside each stop on a route.

type RouteStopBuffer

type RouteStopBuffer struct {
	// Buffer polygon constructed by unioning circles of the requested radius around each stop
	StopBuffer *tt.Geometry `json:"stop_buffer,omitempty"`
	// MultiPoint of the route's stop locations used to build the buffer
	StopPoints *tt.Geometry `json:"stop_points,omitempty"`
	// Convex hull of the route's stop locations
	StopConvexhull *tt.Polygon `json:"stop_convexhull,omitempty"`
}

Spatial buffer derived from the stops served by a route, using the requested radius (in meters)

type RouteStopPattern added in v1.3.0

type RouteStopPattern struct {
	// Identifier for this stop pattern; an integer scoped to a single feed version
	StopPatternID int `json:"stop_pattern_id"`
	// GTFS direction_id (0 or 1) of the trips using this pattern
	DirectionID int `json:"direction_id"`
	// Number of trips that operate this stop pattern
	Count int `json:"count"`
	// Representative trips that follow this stop pattern; useful for fetching full stop_times
	Trips   []*Trip `json:"trips,omitempty"`
	RouteID int     `json:"-"`
}

A unique sequence of stops served by trips on a route, in a single direction. Multiple trips may share the same RouteStopPattern.

type ScheduleRelationship added in v1.3.0

type ScheduleRelationship string

GTFS-RT TripUpdate and StopTimeEvent schedule relationship.

This enum combines possible values from both schedule relationship types, plus an additional STATIC value.

See: - ScheduleRelationship(https://gtfs.org/realtime/reference/#enum-schedulerelationship) - ScheduleRelationship(https://gtfs.org/realtime/reference/#enum-schedulerelationship-1)

const (
	// Trip or stop is following the normal schedule with real-time updates applied
	ScheduleRelationshipScheduled ScheduleRelationship = "SCHEDULED"
	// Extra trip that was added in addition to a running schedule (no static counterpart)
	ScheduleRelationshipAdded ScheduleRelationship = "ADDED"
	// Trip is running with no associated static schedule (e.g. unscheduled or on-demand service)
	ScheduleRelationshipUnscheduled ScheduleRelationship = "UNSCHEDULED"
	// Trip has been canceled
	ScheduleRelationshipCanceled ScheduleRelationship = "CANCELED"
	// No GTFS-RT data matched; only the static schedule applies (Transitland-specific, not in the GTFS-RT spec)
	ScheduleRelationshipStatic ScheduleRelationship = "STATIC"
	// Stop is skipped on this trip; the trip itself runs as scheduled
	ScheduleRelationshipSkipped ScheduleRelationship = "SKIPPED"
	// No real-time data is available for this stop; arrival/departure times are unknown
	ScheduleRelationshipNoData ScheduleRelationship = "NO_DATA"
	// Deprecated GTFS-RT value: this trip replaces a different scheduled trip
	ScheduleRelationshipReplacement ScheduleRelationship = "REPLACEMENT"
	// A trip created at runtime from a static schedule trip (e.g. an extra run of a regularly scheduled trip)
	ScheduleRelationshipDuplicated ScheduleRelationship = "DUPLICATED"
	// Trip should be removed; clients that previously received it should drop it
	ScheduleRelationshipDeleted ScheduleRelationship = "DELETED"
)

func (ScheduleRelationship) IsValid added in v1.3.0

func (e ScheduleRelationship) IsValid() bool

func (ScheduleRelationship) MarshalGQL added in v1.3.0

func (e ScheduleRelationship) MarshalGQL(w io.Writer)

func (ScheduleRelationship) MarshalJSON added in v1.3.0

func (e ScheduleRelationship) MarshalJSON() ([]byte, error)

func (ScheduleRelationship) String added in v1.3.0

func (e ScheduleRelationship) String() string

func (*ScheduleRelationship) UnmarshalGQL added in v1.3.0

func (e *ScheduleRelationship) UnmarshalGQL(v any) error

func (*ScheduleRelationship) UnmarshalJSON added in v1.3.0

func (e *ScheduleRelationship) UnmarshalJSON(b []byte) error

type Segment added in v1.3.0

type Segment struct {
	// Internal integer ID
	ID int `json:"id"`
	// OSM Way ID, if the segment was matched to an OpenStreetMap way (0 if unmatched)
	WayID int `json:"way_id"`
	// Path geometry for this segment as a LineString
	Geometry tt.LineString `json:"geometry"`
	// Pattern associations for this segment, each linking it to a route and stop pattern
	SegmentPatterns []*SegmentPattern `json:"segment_patterns,omitempty"`
	FeedVersionID   int               `json:"-"`
	WithRouteID     int               `json:"-"`
}

A normalized, reusable piece of route geometry, optionally aligned with an OpenStreetMap way. Multiple route patterns may reference the same Segment.

type SegmentFilter added in v1.3.0

type SegmentFilter struct {
	// Search for segments associated with this layer name
	Layer *string `json:"layer,omitempty"`
}

Search options for route segments

type SegmentPattern added in v1.3.0

type SegmentPattern struct {
	// Internal integer ID
	ID int `json:"id"`
	// Route this segment pattern belongs to
	Route *Route `json:"route"`
	// Stop pattern ID this segment belongs to; scoped to the feed version
	StopPatternID int `json:"stop_pattern_id"`
	// GTFS direction_id (0 or 1) of trips using this pattern
	DirectionID int `json:"direction_id"`
	// Position of this segment within the full path of the pattern (0-indexed)
	SequenceIdx int `json:"sequence_idx"`
	// Internal integer ID of the source shape
	ShapeID int `json:"shape_id"`
	// OSM Way ID, if the segment was matched to an OpenStreetMap way
	WayID *int `json:"way_id,omitempty"`
	// Shape this segment was derived from
	Shape *Shape `json:"shape"`
	// Normalized segment associated with this pattern
	Segment   *Segment `json:"segment"`
	RouteID   int      `json:"-"`
	SegmentID int      `json:"-"`
}

Association linking a route's stop pattern to a single normalized segment within its full path. Used to assemble route geometries from reusable segment pieces.

type SegmentPatternFilter added in v1.3.0

type SegmentPatternFilter struct {
	// Search for segment patterns associated with this layer name
	Layer *string `json:"layer,omitempty"`
}

Search options for route segment patterns

type ServiceCoversFilter added in v1.3.0

type ServiceCoversFilter struct {
	// Search for feed versions fetched after this time
	FetchedAfter *time.Time `json:"fetched_after,omitempty"`
	// Search for feed versions fetched before this time
	FetchedBefore *time.Time `json:"fetched_before,omitempty"`
	// Lower bound on the feed's `feed_info.feed_start_date`
	FeedStartDate *tt.Date `json:"feed_start_date,omitempty"`
	// Upper bound on the feed's `feed_info.feed_end_date`
	FeedEndDate *tt.Date `json:"feed_end_date,omitempty"`
	// Lower bound, evaluated against `feed_info.feed_start_date` or calculated earliest calendar date
	StartDate *tt.Date `json:"start_date,omitempty"`
	// Upper bound, evaluated against `feed_info.feed_end_date` or calculated latest calendar date
	EndDate *tt.Date `json:"end_date,omitempty"`
	// Lower bound on the calculated earliest calendar service date
	EarliestCalendarDate *tt.Date `json:"earliest_calendar_date,omitempty"`
	// Upper bound on the calculated latest calendar service date
	LatestCalendarDate *tt.Date `json:"latest_calendar_date,omitempty"`
}

Search options for feed version date range coverage

type ServiceWindow added in v1.3.0

type ServiceWindow struct {
	NowLocal     time.Time
	StartDate    time.Time
	EndDate      time.Time
	FallbackWeek time.Time
}

type Shape

type Shape struct {
	service.ShapeLine
}

type Step added in v1.3.0

type Step struct {
	// Duration of this step
	Duration *Duration `json:"duration"`
	// Distance of this step
	Distance *Distance `json:"distance"`
	// Start time of this step
	StartTime time.Time `json:"start_time"`
	// End time of this step
	EndTime time.Time `json:"end_time"`
	// Destination waypoint of this step
	To *Waypoint `json:"to,omitempty"`
	// Travel mode for this step
	Mode StepMode `json:"mode"`
	// Human-readable navigation instruction (e.g. `Turn left on Main St`); may be empty depending on the routing provider
	Instruction string `json:"instruction"`
	// Offset into the parent leg geometry where this step begins
	GeometryOffset int `json:"geometry_offset"`
}

A single turn-by-turn navigation instruction within a walking or cycling leg.

type StepMode added in v1.3.0

type StepMode string

Travel mode for a routing leg or step.

const (
	// On foot
	StepModeWalk StepMode = "WALK"
	// Private vehicle (car)
	StepModeAuto StepMode = "AUTO"
	// Bicycle
	StepModeBicycle StepMode = "BICYCLE"
	// Public transit vehicle
	StepModeTransit StepMode = "TRANSIT"
	// Straight-line connection (e.g. for display purposes)
	StepModeLine StepMode = "LINE"
)

func (StepMode) IsValid added in v1.3.0

func (e StepMode) IsValid() bool

func (StepMode) MarshalGQL added in v1.3.0

func (e StepMode) MarshalGQL(w io.Writer)

func (StepMode) MarshalJSON added in v1.3.0

func (e StepMode) MarshalJSON() ([]byte, error)

func (StepMode) String added in v1.3.0

func (e StepMode) String() string

func (*StepMode) UnmarshalGQL added in v1.3.0

func (e *StepMode) UnmarshalGQL(v any) error

func (*StepMode) UnmarshalJSON added in v1.3.0

func (e *StepMode) UnmarshalJSON(b []byte) error

type Stop

type Stop struct {
	FeedOnestopID   string
	FeedVersionSHA1 string
	OnestopID       *string
	SearchRank      *string
	WithinFeatures  tt.Strings
	WithRouteID     tt.Int
	gtfs.Stop
}

type StopBuffer added in v1.3.0

type StopBuffer struct {
	// Stop integer IDs to buffer around
	StopIds []int `json:"stop_ids,omitempty"`
	// Buffer radius in meters around each stop
	Radius *float64 `json:"radius,omitempty"`
}

A buffer around a set of stops, used to search for census geographies that intersect any stop's buffer

type StopExternalReference added in v1.3.0

type StopExternalReference struct {
	dmfr.StopExternalReference
}

type StopExternalReferenceSetInput added in v1.3.0

type StopExternalReferenceSetInput struct {
	// Onestop ID of the target stop's feed
	TargetFeedOnestopID *string `json:"target_feed_onestop_id,omitempty"`
	// GTFS `stop_id` of the target stop within that feed
	TargetStopID *string `json:"target_stop_id,omitempty"`
}

Set or update a cross-feed stop reference linking this stop to a stop in another feed

type StopFilter

type StopFilter struct {
	// Search for stops with this Onestop ID
	OnestopID *string `json:"onestop_id,omitempty"`
	// Search for stops with these Onestop IDs
	OnestopIds []string `json:"onestop_ids,omitempty"`
	// Include previously used Onestop IDs that match the same (feed, stop_id)
	AllowPreviousOnestopIds *bool `json:"allow_previous_onestop_ids,omitempty"`
	// Search for stops with this feed version SHA1 hash
	FeedVersionSha1 *string `json:"feed_version_sha1,omitempty"`
	// Search for stops with this feed Onestop ID
	FeedOnestopID *string `json:"feed_onestop_id,omitempty"`
	// Search for stops with this GTFS stop_id
	StopID *string `json:"stop_id,omitempty"`
	// Search for stops with this GTFS stop_code
	StopCode *string `json:"stop_code,omitempty"`
	// Search for stops with this GTFS location_type
	LocationType *int `json:"location_type,omitempty"`
	// If true, restrict to stops served by at least one trip; false or null returns all stops
	Serviced *bool `json:"serviced,omitempty"`
	// Full text search
	Search *string `json:"search,omitempty"`
	// Search for stops with these license details
	License *LicenseFilter `json:"license,omitempty"`
	// Search for stops served by routes or operators with any of these Onestop IDs
	ServedByOnestopIds []string `json:"served_by_onestop_ids,omitempty"`
	// Search for stops served by routes with the specified GTFS route_type
	ServedByRouteType *int `json:"served_by_route_type,omitempty"`
	// Search for stops served by routes with any of the specified GTFS route_types
	ServedByRouteTypes []int `json:"served_by_route_types,omitempty"`
	// Search for stops served by these agencies (database integer IDs)
	AgencyIds []int `json:"agency_ids,omitempty"`
	// Geographic search options
	Location *StopLocationFilter `json:"location,omitempty"`
	// Search for stops within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for stops within this geographic polygon
	Within *tt.Polygon `json:"within,omitempty"`
	// Search for stops within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
}

Search options for stops

type StopLocationFilter added in v1.3.0

type StopLocationFilter struct {
	// Search for stops within this bounding box
	Bbox *BoundingBox `json:"bbox,omitempty"`
	// Search for stops within this geographic polygon
	Polygon *tt.Polygon `json:"polygon,omitempty"`
	// Search for stops contained in any of the given features; matching feature `id`s are echoed back via `Stop.within_features`
	Features []*Feature `json:"features,omitempty"`
	// Search for stops within specified radius of a point
	Near *PointRadius `json:"near,omitempty"`
	// Search for stops within any of the given `CensusGeography` integer IDs
	GeographyIds []*int `json:"geography_ids,omitempty"`
	// Focus search on this point; results will be sorted by distance
	Focus *FocusPoint `json:"focus,omitempty"`
}

Geographic search options for stops

type StopObservation added in v1.3.0

type StopObservation struct {
	// GTFS-RT TripUpdate schedule_relationship value (string form: e.g. `SCHEDULED`, `ADDED`, `CANCELED`)
	ScheduleRelationship *string `json:"schedule_relationship,omitempty"`
	// GTFS-RT TripDescriptor.start_date for the observed trip
	TripStartDate *tt.Date `json:"trip_start_date,omitempty"`
	// GTFS-RT TripDescriptor.start_time for the observed trip
	TripStartTime *tt.Seconds `json:"trip_start_time,omitempty"`
	// GTFS stop_id of the previous stop in the trip (origin of the observed segment)
	FromStopID *string `json:"from_stop_id,omitempty"`
	// GTFS stop_id of this stop (destination of the observed segment)
	ToStopID *string `json:"to_stop_id,omitempty"`
	// GTFS agency_id of the agency operating the trip's route
	AgencyID *string `json:"agency_id,omitempty"`
	// GTFS route_id of the trip's route
	RouteID *string `json:"route_id,omitempty"`
	// GTFS trip_id of the observed trip
	TripID *string `json:"trip_id,omitempty"`
	// GTFS stop_times.stop_sequence value for the from_stop
	StopSequence *int `json:"stop_sequence,omitempty"`
	// GTFS-RT message used to derive this observation: `TripUpdate` or `VehiclePosition`
	Source *string `json:"source,omitempty"`
	// Scheduled arrival time at to_stop, from GTFS static `stop_times`
	ScheduledArrivalTime *tt.Seconds `json:"scheduled_arrival_time,omitempty"`
	// Scheduled departure time at to_stop, from GTFS static `stop_times`
	ScheduledDepartureTime *tt.Seconds `json:"scheduled_departure_time,omitempty"`
	// Observed arrival time at to_stop, derived from GTFS-RT
	ObservedArrivalTime *tt.Seconds `json:"observed_arrival_time,omitempty"`
	// Observed departure time at to_stop, derived from GTFS-RT
	ObservedDepartureTime *tt.Seconds `json:"observed_departure_time,omitempty"`
	StopID                int         `json:"-"`
}

An archived real-time arrival/departure measurement at a stop, derived from GTFS-RT TripUpdate or VehiclePosition data. Compare `scheduled_arrival_time`/`scheduled_departure_time` against `observed_arrival_time`/`observed_departure_time` for on-time performance analysis.

type StopObservationFilter added in v1.3.0

type StopObservationFilter struct {
	// Data source to filter by; typically `TripUpdate` or `VehiclePosition`
	Source string `json:"source"`
	// Feed version integer ID to filter by
	FeedVersionID int `json:"feed_version_id"`
	// Trip start date to filter by
	TripStartDate tt.Date `json:"trip_start_date"`
}

Filters for querying archived stop observations. All three fields are required.

type StopPlace added in v1.3.0

type StopPlace struct {
	// Best-matched state or province name
	Adm1Name *string `json:"adm1_name,omitempty"`
	// Best-matched state or province ISO code
	Adm1Iso *string `json:"adm1_iso,omitempty"`
	// Best-matched country name
	Adm0Name *string `json:"adm0_name,omitempty"`
	// Best-matched country ISO code
	Adm0Iso *string `json:"adm0_iso,omitempty"`
}

Place associated with a stop.

type StopPlaceParam added in v1.3.0

type StopPlaceParam struct {
	ID    int
	Point tlxy.Point
}

type StopSetInput added in v1.3.0

type StopSetInput struct {
	// Integer ID of the stop to update; omit when creating a new stop
	ID *int `json:"id,omitempty"`
	// Feed version this stop belongs to (required when creating a new stop)
	FeedVersion *FeedVersionInput `json:"feed_version,omitempty"`
	// Set GTFS location_type
	LocationType *int `json:"location_type,omitempty"`
	// Set GTFS stop_code
	StopCode *string `json:"stop_code,omitempty"`
	// Set GTFS stop_desc
	StopDesc *string `json:"stop_desc,omitempty"`
	// Set GTFS stop_id
	StopID *string `json:"stop_id,omitempty"`
	// Set GTFS stop_name
	StopName *string `json:"stop_name,omitempty"`
	// Set GTFS stop_timezone
	StopTimezone *string `json:"stop_timezone,omitempty"`
	// Set GTFS stop_url
	StopURL *string `json:"stop_url,omitempty"`
	// Set GTFS wheelchair_boarding
	WheelchairBoarding *int `json:"wheelchair_boarding,omitempty"`
	// Set GTFS zone_id
	ZoneID *string `json:"zone_id,omitempty"`
	// Set GTFS platform_code
	PlatformCode *string `json:"platform_code,omitempty"`
	// Set GTFS tts_stop_name
	TtsStopName *string `json:"tts_stop_name,omitempty"`
	// Set stop geometry
	Geometry *tt.Point `json:"geometry,omitempty"`
	// Reference to an existing parent station; only the `id` is used (the parent must already exist)
	Parent *StopSetInput `json:"parent,omitempty"`
	// Reference to an existing level; only the `id` is used (the level must already exist)
	Level *LevelSetInput `json:"level,omitempty"`
	// Set or update the cross-feed external reference for this stop
	ExternalReference *StopExternalReferenceSetInput `json:"external_reference,omitempty"`
}

Create or update a stop entity. For updates, supply `id`. For creation, supply `feed_version`

type StopTime

type StopTime struct {
	ServiceDate      tt.Date
	Date             tt.Date
	RTTripID         string            // internal: for ADDED trips
	RTStopTimeUpdate *RTStopTimeUpdate // internal
	gtfs.StopTime
}

type StopTimeEvent added in v1.3.0

type StopTimeEvent struct {
	// IANA timezone name for this stop, used to interpret the `*_local` fields
	StopTimezone string `json:"stop_timezone"`
	// Estimated time in UTC
	EstimatedUtc *time.Time `json:"estimated_utc,omitempty"`
	// Estimated time in Unix epoch seconds
	EstimatedUnix *int `json:"estimated_unix,omitempty"`
	// Estimated time in the local time zone
	EstimatedLocal *time.Time `json:"estimated_local,omitempty"`
	// Estimated schedule delay, in seconds, based on either a timestamp or overall trip delay.
	//
	// This value can be set directly from a matching GTFS-RT StopTimeUpdate timestamp or delay value, or derived from the trip's overall delay. Values at or beyond ±86,400 seconds (24 hours) are treated as erroneous and returned as null.
	EstimatedDelay *int `json:"estimated_delay,omitempty"`
	// Estimated time in local time HH:MM:SS
	Estimated *tt.Seconds `json:"estimated,omitempty"`
	// Scheduled time in UTC
	ScheduledUtc *time.Time `json:"scheduled_utc,omitempty"`
	// Scheduled time in Unix epoch seconds
	ScheduledUnix *int `json:"scheduled_unix,omitempty"`
	// Scheduled time in the local time zone
	ScheduledLocal *time.Time `json:"scheduled_local,omitempty"`
	// Scheduled time local time HH:MM:SS
	Scheduled *tt.Seconds `json:"scheduled,omitempty"`
	// Time in UTC sourced directly from a matching GTFS-RT StopTimeUpdate (no fallback)
	TimeUtc *time.Time `json:"time_utc,omitempty"`
	// Time in Unix epoch seconds sourced directly from a matching GTFS-RT StopTimeUpdate (no fallback)
	TimeUnix *int `json:"time_unix,omitempty"`
	// Schedule delay in seconds from a matching GTFS-RT StopTimeUpdate, passed through as-is; see `estimated_delay` for the inferred-fallback variant
	Delay *int `json:"delay,omitempty"`
	// Estimation uncertainty in seconds from a matching GTFS-RT StopTimeUpdate, passed through as-is
	Uncertainty *int `json:"uncertainty,omitempty"`
}

StopTimeEvent combines scheduled arrival/departure data with data sourced from GTFS-RT.

Each scheduled StopTime will try to be matched with a relevant GTFS-RT TripUpdate and StopTimeUpdate. If the StopTime has a matching TripUpdate (based on trip_id) and StopTimeUpdate (stop_sequence and/or stop_id), the estimated times will be used directly. If a TripUpdate is matched, but no StopTimeUpdate, the last available delay value in the trip will be applied to later StopTimes in that trip. If the Trip is ADDED and does not match a static schedule StopTime, the scheduled times will be absent.

See https://gtfs.org/realtime/reference/#message-stoptimeevent.

type StopTimeFilter

type StopTimeFilter struct {
	// Calendar date for which to return stop times
	Date *tt.Date `json:"date,omitempty"`
	// Calendar date relative to today (e.g. `MONDAY`, `NEXT_FRIDAY`); see `RelativeDate` for semantics
	RelativeDate *RelativeDate `json:"relative_date,omitempty"`
	// GTFS service date (which may differ from the calendar date for trips that cross midnight)
	ServiceDate *tt.Date `json:"service_date,omitempty"`
	// If true and the requested date falls outside the feed version's normal service window, use the feed version's `fallback_week` instead
	UseServiceWindow *bool `json:"use_service_window,omitempty"`
	// Lower bound for departure time, in seconds since midnight
	StartTime *int `json:"start_time,omitempty"`
	// Upper bound for arrival time, in seconds since midnight
	EndTime *int `json:"end_time,omitempty"`
	// Lower bound for departure time, in local `HH:MM:SS`
	Start *tt.Seconds `json:"start,omitempty"`
	// Upper bound for arrival time, in local `HH:MM:SS`
	End *tt.Seconds `json:"end,omitempty"`
	// Return stop times with departures within the next N seconds from now (local time)
	Next *int `json:"next,omitempty"`
	// Restrict to stop times on routes matching any of these Onestop IDs
	RouteOnestopIds []string `json:"route_onestop_ids,omitempty"`
	// Include previously used route Onestop IDs that map to the same (feed, route_id)
	AllowPreviousRouteOnestopIds *bool `json:"allow_previous_route_onestop_ids,omitempty"`
	// Exclude the first stop_time of each trip
	ExcludeFirst *bool `json:"exclude_first,omitempty"`
	// Exclude the last stop_time of each trip
	ExcludeLast *bool `json:"exclude_last,omitempty"`
}

Search options for stop times, optionally on a given date

type Tenant added in v1.3.3

type Tenant struct {
	// Internal integer ID
	ID int `json:"id"`
	// Tenant name
	Name string `json:"name"`
	// Groups owned by this tenant
	Groups []*Group `json:"groups"`
	// Authorization permissions for this tenant
	Permissions *Permissions `json:"permissions,omitempty"`
}

A tenant organization that owns groups and feeds

type Trip

type Trip struct {
	RTTripID string // internal: for ADDED trips
	gtfs.Trip
}

type TripFilter

type TripFilter struct {
	// GTFS service date on which trips run
	ServiceDate *tt.Date `json:"service_date,omitempty"`
	// Calendar date relative to today; see `RelativeDate`
	RelativeDate *RelativeDate `json:"relative_date,omitempty"`
	// If true and the requested date falls outside the feed version's normal service window, use the feed version's `fallback_week` instead
	UseServiceWindow *bool `json:"use_service_window,omitempty"`
	// Search for trips with this GTFS trip_id
	TripID *string `json:"trip_id,omitempty"`
	// Search for trips with this stop pattern ID (scoped to feed version)
	StopPatternID *int `json:"stop_pattern_id,omitempty"`
	// Search for trips with these license details
	License *LicenseFilter `json:"license,omitempty"`
	// Search for trips on these routes (database integer IDs)
	RouteIds []int `json:"route_ids,omitempty"`
	// Search for trips on routes matching any of these Onestop IDs
	RouteOnestopIds []string `json:"route_onestop_ids,omitempty"`
	// Search for trips with this feed version SHA1 hash
	FeedVersionSha1 *string `json:"feed_version_sha1,omitempty"`
	// Search for trips with this feed Onestop ID
	FeedOnestopID *string `json:"feed_onestop_id,omitempty"`
}

Search options for trips

type TripStopTimeFilter added in v1.3.0

type TripStopTimeFilter struct {
	// Lower bound for departure time, in local `HH:MM:SS`
	Start *tt.Seconds `json:"start,omitempty"`
	// Upper bound for arrival time, in local `HH:MM:SS`
	End *tt.Seconds `json:"end,omitempty"`
}

Search options for stop times within a single trip (no date filter applies, since the parent trip determines the schedule)

type User added in v1.3.3

type User struct {
	// User identifier
	ID string `json:"id"`
	// Display name
	Name string `json:"name"`
	// Email address
	Email string `json:"email"`
}

A user in the authorization system

type UserFilter added in v1.3.3

type UserFilter struct {
	// Search for a user by ID
	ID *string `json:"id,omitempty"`
	// Full text search
	Q *string `json:"q,omitempty"`
}

Search options for users

type ValidationRealtimeResult added in v1.3.0

type ValidationRealtimeResult struct {
	// URL the GTFS-RT message was fetched from
	URL string `json:"url"`
	// JSON-decoded representation of the GTFS-RT message
	JSON tt.Map `json:"json"`
}

Source URL and JSON representation of GTFS-RT data used for validation

type ValidationReport added in v1.3.0

type ValidationReport struct {
	// Internal integer ID
	ID int `json:"id"`
	// Time the report was generated, in UTC
	ReportedAt *time.Time `json:"reported_at,omitempty"`
	// Time the report was generated, in the feed's local time
	ReportedAtLocal *time.Time `json:"reported_at_local,omitempty"`
	// IANA timezone name corresponding to `reported_at_local`
	ReportedAtLocalTimezone *string `json:"reported_at_local_timezone,omitempty"`
	// True if validation completed successfully
	Success bool `json:"success"`
	// Error message if the feed failed to validate
	FailureReason *string `json:"failure_reason,omitempty"`
	// True if the report includes GTFS static validation results
	IncludesStatic *bool `json:"includes_static,omitempty"`
	// True if the report includes GTFS-RT validation results
	IncludesRt *bool `json:"includes_rt,omitempty"`
	// Validator name
	Validator *string `json:"validator,omitempty"`
	// Validator version
	ValidatorVersion *string `json:"validator_version,omitempty"`
	// Validation errors, grouped by filename, if present
	Errors []*ValidationReportErrorGroup `json:"errors"`
	// Validation warnings, grouped by filename, if present
	Warnings []*ValidationReportErrorGroup `json:"warnings"`
	// Details about the validated feed
	Details       *ValidationReportDetails `json:"details,omitempty"`
	FeedVersionID int                      `json:"-"`
}

Validation report for GTFS static and/or GTFS-RT data

type ValidationReportDetails added in v1.3.0

type ValidationReportDetails struct {
	// SHA1 hash of the validated feed
	Sha1 string `json:"sha1"`
	// Earliest calendar date with scheduled service
	EarliestCalendarDate *tt.Date `json:"earliest_calendar_date,omitempty"`
	// Latest calendar date with scheduled service
	LatestCalendarDate *tt.Date `json:"latest_calendar_date,omitempty"`
	// Details for each file contained in the feed
	Files []*FeedVersionFileInfo `json:"files"`
	// Calculated weekly service levels
	ServiceLevels []*FeedVersionServiceLevel `json:"service_levels"`
	// Sample of agencies in the feed (truncated; not a complete list)
	Agencies []*Agency `json:"agencies"`
	// Sample of routes in the feed (truncated; not a complete list)
	Routes []*Route `json:"routes"`
	// Sample of stops in the feed (truncated; not a complete list)
	Stops []*Stop `json:"stops"`
	// Records from `feed_info.txt`
	FeedInfos []*FeedInfo `json:"feed_infos"`
	// Detailed information about GTFS-RT sources used in validation
	Realtime []*ValidationRealtimeResult `json:"realtime,omitempty"`
}

Details about the validated feed, including selected entities, metadata of contained files, calendar extent, etc.

type ValidationReportError added in v1.3.0

type ValidationReportError struct {
	// Source filename (e.g. `stops.txt`, or the GTFS-RT URL for realtime issues)
	Filename string `json:"filename"`
	// Validation rule or error class identifier (e.g. `MissingRequiredFieldError`)
	ErrorType string `json:"error_type"`
	// GTFS-RT error code (set only for realtime validation errors)
	ErrorCode string `json:"error_code"`
	// Stable grouping key shared with the parent `ValidationReportErrorGroup`
	GroupKey string `json:"group_key"`
	// Identifier of the affected entity (e.g. the `stop_id` or `trip_id`)
	EntityID string `json:"entity_id"`
	// Field name on which the error was raised
	Field string `json:"field"`
	// Line number in the source CSV file where the error occurred (static validation only; 0 for realtime)
	Line int `json:"line"`
	// Value of the affected field
	Value string `json:"value"`
	// Human-readable message describing the problem
	Message string `json:"message"`
	// Geometry of the affected entity, if available
	Geometry *tt.Geometry `json:"geometry,omitempty"`
	// JSON representation of the affected entity (empty map if not available)
	EntityJSON                   tt.Map `json:"entity_json"`
	ID                           int    `json:"-"`
	ValidationReportErrorGroupID int    `json:"-"`
}

An individual validation error or warning.

type ValidationReportErrorGroup added in v1.3.0

type ValidationReportErrorGroup struct {
	// Source filename for this group (e.g. `stops.txt`, or the GTFS-RT URL for realtime issues)
	Filename string `json:"filename"`
	// Validation rule or error class identifier (e.g. `MissingRequiredFieldError`)
	ErrorType string `json:"error_type"`
	// GTFS-RT error code (set only for realtime validation errors)
	ErrorCode string `json:"error_code"`
	// Stable grouping key used to aggregate equivalent errors
	GroupKey string `json:"group_key"`
	// Field name on which the error was raised
	Field string `json:"field"`
	// Total number of errors in this group
	Count int `json:"count"`
	// Sample of individual errors from this group
	Errors             []*ValidationReportError `json:"errors"`
	ID                 int                      `json:"-"`
	ValidationReportID int                      `json:"-"`
}

Group of validation errors or warnings sharing the same file, type, and grouping key; useful for summarizing repeated issues

type ValidationReportFilter added in v1.3.0

type ValidationReportFilter struct {
	// Restrict to validation reports with these integer IDs
	ReportIds []int `json:"report_ids,omitempty"`
	// Filter by success: true for successful reports, false for failed
	Success *bool `json:"success,omitempty"`
	// Filter by validator name
	Validator *string `json:"validator,omitempty"`
	// Filter by validator version
	ValidatorVersion *string `json:"validator_version,omitempty"`
	// Filter by `includes_rt`: true for reports that include GTFS-RT validation, false for those that don't
	IncludesRt *bool `json:"includes_rt,omitempty"`
	// Filter by `includes_static`: true for reports that include GTFS static validation, false for those that don't
	IncludesStatic *bool `json:"includes_static,omitempty"`
}

Search options for validation reports

type VehiclePosition added in v1.3.0

type VehiclePosition struct {
	// Vehicle descriptor from the GTFS-RT VehiclePosition
	Vehicle *RTVehicleDescriptor `json:"vehicle,omitempty"`
	// Current vehicle position
	Position *tt.Point `json:"position,omitempty"`
	// Sequence index of the stop the vehicle is approaching or stopped at, within the trip
	CurrentStopSequence *int `json:"current_stop_sequence,omitempty"`
	// Stop the vehicle is approaching or stopped at; despite the field name, returns the resolved `Stop` entity
	StopID *Stop `json:"stop_id,omitempty"`
	// Vehicle status relative to `stop_id`: `INCOMING_AT`, `STOPPED_AT`, or `IN_TRANSIT_TO`
	CurrentStatus *string `json:"current_status,omitempty"`
	// Timestamp of this vehicle position update
	Timestamp *time.Time `json:"timestamp,omitempty"`
	// Estimated congestion level: `UNKNOWN_CONGESTION_LEVEL`, `RUNNING_SMOOTHLY`, `STOP_AND_GO`, `CONGESTION`, or `SEVERE_CONGESTION`
	CongestionLevel *string `json:"congestion_level,omitempty"`
}

[Vehicle Position](https://gtfs.org/reference/realtime/v2/#message-vehicleposition) message provided by a source GTFS Realtime feed.

type Waypoint added in v1.3.0

type Waypoint struct {
	// Longitude of the waypoint
	Lon float64 `json:"lon"`
	// Latitude of the waypoint
	Lat float64 `json:"lat"`
	// Display name for the waypoint
	Name *string `json:"name,omitempty"`
	// Matched transit stop at this waypoint, if any
	Stop *WaypointStop `json:"stop,omitempty"`
}

A resolved waypoint in a routing response, including optional matched stop information.

type WaypointDeparture added in v1.3.0

type WaypointDeparture struct {
	// Longitude of the stop
	Lon float64 `json:"lon"`
	// Latitude of the stop
	Lat float64 `json:"lat"`
	// Scheduled departure time at this stop
	Departure time.Time `json:"departure"`
	// GTFS stop_id
	StopID string `json:"stop_id"`
	// Stop name
	StopName string `json:"stop_name"`
	// Stop code
	StopCode string `json:"stop_code"`
	// Onestop ID for this stop
	StopOnestopID string `json:"stop_onestop_id"`
	// Index of this stop within the leg
	StopIndex *int `json:"stop_index,omitempty"`
	// GTFS stop_sequence value
	StopSequence *int `json:"stop_sequence,omitempty"`
}

A transit stop with departure information within a leg, including sequence details.

type WaypointInput added in v1.3.0

type WaypointInput struct {
	// Longitude of the waypoint
	Lon float64 `json:"lon"`
	// Latitude of the waypoint
	Lat float64 `json:"lat"`
	// Optional display name for the waypoint
	Name *string `json:"name,omitempty"`
}

A geographic waypoint used as an origin or destination in a routing request.

type WaypointStop added in v1.3.0

type WaypointStop struct {
	// Longitude of the stop
	Lon float64 `json:"lon"`
	// Latitude of the stop
	Lat float64 `json:"lat"`
	// Scheduled departure time at this stop
	Departure time.Time `json:"departure"`
	// GTFS stop_id
	StopID string `json:"stop_id"`
	// Stop name
	StopName string `json:"stop_name"`
	// Stop code
	StopCode string `json:"stop_code"`
	// Onestop ID for this stop
	StopOnestopID string `json:"stop_onestop_id"`
}

A transit stop matched to a waypoint, with departure information.

Jump to

Keyboard shortcuts

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