Data Format

If you use JSON schemas, see https://raw.githubusercontent.com/MRT-Map/gatelogue/dist/schema.json.

If you use Typescript, see https://github.com/MRT-Map/gatelogue/blob/main/gatelogue-client/src/stores/schema.ts for Typescript types.

Specification

  • All links below reference their entries in the full reference page. These classes are here for convenience’s sake.

  • Do not hardcode any IDs in your project! They change with every update. If you need to reference a specific object, find it by its code/name/something unique to the object.

  • Check the version field in the GatelogueData object for the data format version. We will try our best to maintain backwards-compatibility, but we cannot guarantee.

  • The JSON file at data.json is of base type GatelogueData.

  • If you are using data_no_sources.json, all instances of Sourced[T] below are replaced with just the encapsulated type T.

    • If you are using gatelogue-types (Python), each object has a No-Source equivalent. The types for these objects have an NS suffix.

    • If you are using the Typescript types referenced above, the type for the JSON of the no-source version is GatelogueData<false> instead of simply GatelogueData or GatelogueData<true>.

  • tuple and set serialise to a list.

  • None serialises to null.

The current data format version is

v8
class gatelogue_types.GatelogueData(*, nodes: dict[ID, Nodes], timestamp: str = <factory>, version: int = 8)

Bases: Struct

nodes: dict[ID, Nodes]

List of all nodes, along with their connections to other nodes

timestamp: str

Time that the aggregation of the data was done

version: int

Version number of the database format

class gatelogue_types.Node(*, i: ID = None, source: set[str] = <factory>)

Bases: Struct

i: ID

The ID of the node

source: set[str]

All sources that prove the node’s existence

class gatelogue_types.LocatedNode(*, i: ID = None, source: set[str] = <factory>, coordinates: ~gatelogue_types.Sourced[tuple[float, float]] | None = None, world: ~gatelogue_types.Sourced[World] | None = None, proximity: dict[ID, ~gatelogue_types.Sourced[~gatelogue_types.Proximity]] = <factory>, shared_facility: list[~gatelogue_types.Sourced[ID]] = <factory>)

Bases: Node

coordinates: Sourced[tuple[float, float]] | None

Coordinates of the object

proximity: dict[ID, Sourced[Proximity]]

References all objects that are near (within walking distance of) this object. It is represented as an inner mapping of object IDs to proximity data (Proximity). For example, {1234: <proximity>} means that there is an object with ID 1234 near this object, and <proximity> is a Proximity object.

shared_facility: list[Sourced[ID]]

References all objects that this object shares the same facility with (same building, station, hub etc)

world: Sourced[World] | None

Whether the object is in the New or Old world

Air Nodes

class gatelogue_types.AirFlight(*, i: ID = None, source: set[str] = <factory>, codes: set[str], mode: ~gatelogue_types.Sourced[PlaneMode] | None = None, gates: list[~gatelogue_types.Sourced[ID]] = <factory>, airline: ~gatelogue_types.Sourced[ID] = None)

Bases: Node

airline: Sourced[ID]

ID of the AirAirline the flight is operated by

codes: set[str]

Unique flight code(s). 2-letter airline prefix not included

gates: list[Sourced[ID]]

List of IDs of AirGate s that the flight goes to. Should be of length 2 in most cases

mode: Sourced[PlaneMode] | None

Type of air vehicle or technology used on the flight

class gatelogue_types.AirAirport(*, i: ID = None, source: set[str] = <factory>, coordinates: ~gatelogue_types.Sourced[tuple[float, float]] | None = None, world: ~gatelogue_types.Sourced[World] | None = None, proximity: dict[ID, ~gatelogue_types.Sourced[~gatelogue_types.Proximity]] = <factory>, shared_facility: list[~gatelogue_types.Sourced[ID]] = <factory>, code: str, name: ~gatelogue_types.Sourced[str] | None = None, link: ~gatelogue_types.Sourced[str] | None = None, modes: ~gatelogue_types.Sourced[set[PlaneMode]] | None = None, gates: list[~gatelogue_types.Sourced[ID]] = <factory>)

Bases: LocatedNode

code: str

Unique 3 (sometimes 4)-letter code

gates: list[Sourced[ID]]

List of IDs of AirGate s

link: Sourced[str] | None

Link to the MRT Wiki page for the airport

modes: Sourced[set[PlaneMode]] | None

Modes offered by the airport

name: Sourced[str] | None

Name of the airport

class gatelogue_types.AirGate(*, i: ID = None, source: set[str] = <factory>, code: str | None, size: ~gatelogue_types.Sourced[str] | None = None, flights: list[~gatelogue_types.Sourced[ID]] = <factory>, airport: ~gatelogue_types.Sourced[ID] = None, airline: ~gatelogue_types.Sourced[ID] | None = None)

Bases: Node

airline: Sourced[ID] | None

ID of the AirAirline that owns the gate

airport: Sourced[ID]

ID of the AirAirport

code: str | None

Unique gate code. If None, all flights under this gate do not have gate information at this airport

flights: list[Sourced[ID]]

List of IDs of AirFlight s that stop at this gate. If code==None, all flights under this gate do not have gate information at this airport

size: Sourced[str] | None

Abbreviated size of the gate (eg. S, M)

class gatelogue_types.AirAirline(*, i: ID = None, source: set[str] = <factory>, name: str, link: ~gatelogue_types.Sourced[str] | None = None, flights: list[~gatelogue_types.Sourced[ID]] = <factory>, gates: list[~gatelogue_types.Sourced[ID]] = <factory>)

Bases: Node

flights: list[Sourced[ID]]

List of IDs of all AirFlight s the airline operates

gates: list[Sourced[ID]]

List of IDs of all AirGate s the airline owns or operates

link: Sourced[str] | None

Link to the MRT Wiki page for the airline

name: str

Name of the airline

Rail Nodes

class gatelogue_types.RailCompany(*, i: ID = None, source: set[str] = <factory>, name: str, lines: list[~gatelogue_types.Sourced[ID]] = <factory>, stations: list[~gatelogue_types.Sourced[ID]] = <factory>, local: bool = False)

Bases: Node

lines: list[Sourced[ID]]

List of IDs of all RailLine s the company operates

local: bool

Whether the company operates within the city, e.g. a metro system

name: str

Name of the Rail company

stations: list[Sourced[ID]]

List of all RailStation s the company’s lines stop at

class gatelogue_types.RailLine(*, i: ID = None, source: set[str] = <factory>, code: str, name: ~gatelogue_types.Sourced[str] | None = None, colour: ~gatelogue_types.Sourced[str] | None = None, mode: ~gatelogue_types.Sourced[RailMode] | None = None, company: ~gatelogue_types.Sourced[ID] = None, ref_station: ~gatelogue_types.Sourced[ID] | None = None)

Bases: Node

code: str

Unique code identifying the Rail line

colour: Sourced[str] | None

Colour of the line (on a map)

company: Sourced[ID]

ID of the RailCompany that operates the line

mode: Sourced[RailMode] | None

Type of rail or rail technology used on the line

name: Sourced[str] | None

Name of the line

ref_station: Sourced[ID] | None

ID of one RailStation on the line, typically a terminus

class gatelogue_types.RailStation(*, i: ID = None, source: set[str] = <factory>, coordinates: ~gatelogue_types.Sourced[tuple[float, float]] | None = None, world: ~gatelogue_types.Sourced[World] | None = None, proximity: dict[ID, ~gatelogue_types.Sourced[~gatelogue_types.Proximity]] = <factory>, shared_facility: list[~gatelogue_types.Sourced[ID]] = <factory>, codes: set[str], name: ~gatelogue_types.Sourced[str] | None = None, company: ~gatelogue_types.Sourced[ID] = None, connections: dict[ID, list[~gatelogue_types.Sourced[~gatelogue_types.Connection]]] = <factory>)

Bases: LocatedNode

codes: set[str]

Unique code(s) identifying the Rail station. May also be the same as the name

company: Sourced[ID]

ID of the RailCompany that stops here

connections: dict[ID, list[Sourced[Connection]]]

References all next stations on the lines serving this station. It is represented as a mapping of station IDs to a list of connection data (RailConnection), each encoding line and route information. For example, {1234: [<conn1>, <conn2>]} means that the station with ID 1234 is the next station from here on two lines.

name: Sourced[str] | None

Name of the station

Sea Nodes

class gatelogue_types.SeaCompany(*, i: ID = None, source: set[str] = <factory>, name: str, lines: list[~gatelogue_types.Sourced[ID]] = <factory>, stops: list[~gatelogue_types.Sourced[ID]] = <factory>, local: bool = False)

Bases: Node

lines: list[Sourced[ID]]

List of IDs of all SeaLine s the company operates

local: bool

Whether the company operates within the city, e.g. a local ferry line

name: str

Name of the Sea company

stops: list[Sourced[ID]]

List of all SeaStop s the company’s lines stop at

class gatelogue_types.SeaLine(*, i: ID = None, source: set[str] = <factory>, code: str, name: ~gatelogue_types.Sourced[str] | None = None, colour: ~gatelogue_types.Sourced[str] | None = None, mode: ~gatelogue_types.Sourced[SeaMode] | None = None, company: ~gatelogue_types.Sourced[ID] = None, ref_stop: ~gatelogue_types.Sourced[ID] | None = None)

Bases: Node

code: str

Unique code identifying the Sea line

colour: Sourced[str] | None

Colour of the line (on a map)

company: Sourced[ID]

ID of the SeaCompany that operates the line

mode: Sourced[SeaMode] | None

Type of boat used on the line

name: Sourced[str] | None

Name of the line

ref_stop: Sourced[ID] | None

ID of one SeaStop on the line, typically a terminus

class gatelogue_types.SeaStop(*, i: ID = None, source: set[str] = <factory>, coordinates: ~gatelogue_types.Sourced[tuple[float, float]] | None = None, world: ~gatelogue_types.Sourced[World] | None = None, proximity: dict[ID, ~gatelogue_types.Sourced[~gatelogue_types.Proximity]] = <factory>, shared_facility: list[~gatelogue_types.Sourced[ID]] = <factory>, codes: set[str], name: ~gatelogue_types.Sourced[str] | None = None, company: ~gatelogue_types.Sourced[ID] = None, connections: dict[ID, list[~gatelogue_types.Sourced[~gatelogue_types.Connection]]] = <factory>)

Bases: LocatedNode

codes: set[str]

Unique code(s) identifying the Sea stop. May also be the same as the name

company: Sourced[ID]

ID of the SeaCompany that stops here

connections: dict[ID, list[Sourced[Connection]]]

References all next stops on the lines serving this stop. It is represented as a mapping of stop IDs to a list of connection data (SeaConnection), each encoding line and route information. For example, {1234: [<conn1>, <conn2>]} means that the stop with ID 1234 is the next stop from here on two lines.

name: Sourced[str] | None

Name of the stop

Bus Nodes

class gatelogue_types.BusCompany(*, i: ID = None, source: set[str] = <factory>, name: str, lines: list[~gatelogue_types.Sourced[ID]] = <factory>, stops: list[~gatelogue_types.Sourced[ID]] = <factory>, local: bool = False)

Bases: Node

lines: list[Sourced[ID]]

List of IDs of all BusLine s the company operates

local: bool

Whether the company operates within the city, e.g. a city bus network

name: str

Name of the bus company

stops: list[Sourced[ID]]

List of all BusStop s the company’s lines stop at

class gatelogue_types.BusLine(*, i: ID = None, source: set[str] = <factory>, code: str, name: ~gatelogue_types.Sourced[str] | None = None, colour: ~gatelogue_types.Sourced[str] | None = None, company: ~gatelogue_types.Sourced[ID] = None, ref_stop: ~gatelogue_types.Sourced[ID] | None = None)

Bases: Node

code: str

Unique code identifying the bus line

colour: Sourced[str] | None

Colour of the line (on a map)

company: Sourced[ID]

ID of the BusCompany that operates the line

name: Sourced[str] | None

Name of the line

ref_stop: Sourced[ID] | None

ID of one BusStop on the line, typically a terminus

class gatelogue_types.BusStop(*, i: ID = None, source: set[str] = <factory>, coordinates: ~gatelogue_types.Sourced[tuple[float, float]] | None = None, world: ~gatelogue_types.Sourced[World] | None = None, proximity: dict[ID, ~gatelogue_types.Sourced[~gatelogue_types.Proximity]] = <factory>, shared_facility: list[~gatelogue_types.Sourced[ID]] = <factory>, codes: set[str], name: ~gatelogue_types.Sourced[str] | None = None, company: ~gatelogue_types.Sourced[ID] = None, connections: dict[ID, list[~gatelogue_types.Sourced[~gatelogue_types.Connection]]] = <factory>)

Bases: LocatedNode

codes: set[str]

Unique code(s) identifying the bus stop. May also be the same as the name

company: Sourced[ID]

ID of the BusCompany that stops here

connections: dict[ID, list[Sourced[Connection]]]

References all next stops on the lines serving this stop. It is represented as a mapping of stop IDs to a list of connection data (BusConnection), each encoding line and route information. For example, {1234: [<conn1>, <conn2>]} means that the stop with ID 1234 is the next stop from here on two lines.

name: Sourced[str] | None

Name of the stop

Town Nodes

class gatelogue_types.Town(*, i: ID = None, source: set[str] = <factory>, coordinates: ~gatelogue_types.Sourced[tuple[float, float]] | None = None, world: ~gatelogue_types.Sourced[World] | None = None, proximity: dict[ID, ~gatelogue_types.Sourced[~gatelogue_types.Proximity]] = <factory>, shared_facility: list[~gatelogue_types.Sourced[ID]] = <factory>, name: str, rank: ~gatelogue_types.Sourced[Rank], mayor: ~gatelogue_types.Sourced[str], deputy_mayor: ~gatelogue_types.Sourced[str | None])

Bases: LocatedNode

deputy_mayor: Sourced[str | None]

Deputy Mayor of the town

mayor: Sourced[str]

Mayor of the town

name: str

Name of the town

rank: Sourced[Rank]

Rank of the town

Miscellaneous

class gatelogue_types.Sourced(v: ~gatelogue_types.T, s: set[str] = <factory>)

Bases: Struct, Generic[T]

s: set[str]

List of sources that support the value

v: T

Actual value

class gatelogue_types.Connection(line: ID, direction: Direction | None = None)

Bases: Struct

direction: Direction | None

Direction information

line: ID

Reference to or ID of the line that the connection is made on

class gatelogue_types.Direction(direction: ID, forward_label: str | None, backward_label: str | None, one_way: bool | Sourced[bool] = False)

Bases: Struct

backward_label: str | None

Describes the direction taken when travelling from the station/stop in forward_towards_code

direction: ID

Reference to or ID of the station/stop that the other fields take with respect to. Should be either node of the connection

forward_label: str | None

Describes the direction taken when travelling towards the station/stop in forward_towards_code

one_way: bool | Sourced[bool]

Whether the connection is one-way, ie. travel towards the station/stop in forward_towards_code is possible but not the other way

class gatelogue_types.Proximity(distance: float, explicit: bool = False)

Bases: Struct

distance: float

Distance between the two objects in blocks

explicit: bool

Whether this relation is explicitly recognised by the company/ies of the stations. Used mostly for local services