traffic.git

ref: master

./traffic.bare


enum Direction {
	THERE
	BACK
}

type Translation {
	language: string
	value: string
}

type Trip {
	id: string
	headsign: string
	translatedHeadsigns: []Translation
	direction: Direction
	lineID: string
	scheduleID: string
	shapeID: string
	departures: []Departure
}

type Vehicle {
	id: string
	capabilities: uint16  # sum of VehicleCapabilities values
}

enum VehicleCapabilities {
	RAMP = 1
	LOW_FLOOR = 2
	AIR_CONDITIONING = 4
	BICYCLE = 8
	VOICE_ANNOUNCEMENTS = 16
	TICKET_MACHINE = 32
	TICKET_SOLD_DRIVER = 64
	USB_CHARGING = 128
	LOW_FLOOR_PARTIAL = 256
}

enum Boarding {
	REGULAR
	NONE
	BY_PHONE
	BY_DRIVER
}

type Departure {
	stopSequence: int
	time: uint
	pickup: Boarding
	dropoff: Boarding
	stopOffset: uint
}

type Stop {
	id: string
	code: string
	name: string
	translatedNames: []Translation
	nodeName: string
	translatedNodeNames: []Translation
	changeOptions: []ChangeOption
	zone: string
	position: Position
	order: map[string]StopOrder
	timezone: string
}

type ChangeOption {
	lineName: string
	headsign: string
	translatedHeadsigns: []Translation
}

type Position {
	lat: float64
	lon: float64
}

type LineGraph {
	stopCodes: []string
	nextNodes: map[int][]int
}

type StopOrder {
	tripOffset: uint
	sequence: int
}

type Colour {
	r: uint8
	g: uint8
	b: uint8
	a: uint8
}

enum LineType {
	TRAM
	METRO
	RAIL
	BUS
	FERRY
	CABLE_TRAM
	CABLE_CAR
	FUNICULAR
	TROLLEYBUS = 11
	MONORAIL = 12
}

type Line {
	id: string
	name: string
	colour: Colour
	kind: LineType
	agencyID: string
	headsigns: [][]string
	translatedHeadsigns: [][][]Translation
	graphs: []LineGraph
}

type FeedInfo {
	name: string
	website: string
	language: string
	validSince: string
	validTill: string
	qrHost:	string
	qrLocation: QRLocation
	qrSelector: string
	attributions: map[string]string  # []Translation?
	descriptions: map[string]string  # []Translation?
	realtimeFeeds: map[RealtimeFeedType]string
	timezone: string
}

enum RealtimeFeedType {
	TRIP_UPDATES
	VEHICLE_POSITIONS
	ALERTS
}

enum QRLocation {
	QRLocationUnknown
	QRLocationNone
	QRLocationPath
	QRLocationQuery
}

type Agency {
	id: string
	name: string
	translatedNames: []Translation
	website: string
	translatedWebsites: []Translation
	timezone: string
	phoneNumber: string
	translatedPhoneNumbers: []Translation
	language: string
	email: string
	translatedEmails: []Translation
	fareWebsite: string
	translatedFareWebsites: []Translation
}

type NameOffset {
	name: string
	offsets: []uint
}

type CodeIndex map[string]uint

type Schedule {
	id: string
	dateRanges: []DateRange
}

type DateRange {
	start: string
	end: string
	weekdays: uint8  # bitmap
}

# realtime

type TimeRange {
	startDate: string  # YYYY-mm-ddTHH:MM:SS.sssZ07:00
	endDate: string  # YYYY-mm-ddTHH:MM:SS.sssZ07:00
}

type AlertLua {
	timeRanges: []TimeRange
	headers: map[string]string
	descriptions: map[string]string
	urls: map[string]string
	cause: int
	effect: int
}

type LuaUpdates {
	areTripsInTimetable: bool
	updates: map[string]Update
	alerts: map[string][]AlertLua
}

type LuaError {
	httpResponseCode: int
	message: string
	willNextRequestFail: bool
}

type Update {
	time: string # HHmmss
	timeUTC: string # HHmmss
	stopSequence: uint32
	stopID: string
	delay: int32 # seconds
	timetableRelationship: TimetableRelationship # TODO better name?
	vehicleStatus: VehicleStatus
}

enum TimetableRelationship {
	NOT_REALTIME
	TRIP_SCHEDULED
	TRIP_CANCELED
	TRIP_DELETED
	TRIP_ADDED
	STOP_SKIPPED
	NO_TRIP_DATA
}

type VehicleStatus {
	status: DepartureStatus
	congestionLevel: CongestionLevel
	occupancyStatus: OccupancyStatus
	vehicleID: string
	latitude: float64
	longitude: float64
	speed: float32  # m/s
	bearing: float64  # radians clockwise from north  # TODO maybe (-π, π)
	lineID: string
	lineName: string
	headsign: string
	tripID: string
	wheelchairAccessibility: WheelchairAccessibility
}

enum CongestionLevel {
	CONGESTION_UNKNOWN
	CONGESTION_SMOOTH
	CONGESTION_STOP_AND_GO
	CONGESTION_SIGNIFICANT
	CONGESTION_SEVERE
}

enum OccupancyStatus {
	OCCUPANCY_UNKNOWN
	OCCUPANCY_EMPTY
	OCCUPANCY_MANY_AVAILABLE
	OCCUPANCY_FEW_AVAILABLE
	OCCUPANCY_STANDING_ONLY
	OCCUPANCY_CRUSHED
	OCCUPANCY_FULL
	OCCUPANCY_NOT_ACCEPTING
}

enum WheelchairAccessibility {
	WHEELCHAIR_NO_DATA
	WHEELCHAIR_UNKNOWN
	WHHELCHAIR_ACCESSIBLE
	WHEELCHAIR_INACCESSIBLE
}

enum DepartureStatus {
	IN_TRANSIT
	AT_STOP
	INCOMING
}