/rest/predicted_occupancy - Occupancy Prediction API

The /rest/predicted_occupancy API allows the user to interact with occupancy and capacity prediction data.

See also: Occupancy API tutorial

Base url: https://{agency_name}.prediction.cit.io/

Endpoints

Actions

/rest/predicted_occupancy

Represents the predicted occupancy and capacity according to a specific GET payload.

Predicted occupancy

The API returns predicted occupancy, expressed as a number of passengers, and vehicle capacity, per line, direction (represented by terminus stop), stop, and time (1/4 of an hour).

The type of occupancy (whether it's based on ticketing data, counting_cells, unified occupancy...) is defined upstream by your Operations manager in the agency's configuration.

Methods

  • GET /predicted_occupancy : request predicted occupancy according to GET payload

Request syntax

# No granularity parameter
https://{base_url}/rest/predicted_occupancy?service_date={YYYY-MM-DD}

# With a granularity parameter
https://{base_url}/rest/predicted_occupancy?service_date={YYYY-MM-DD}&granularity={granularity}

Request Parameters

Parameter

Type

Value

service_date

(Required)

str

The day you wish to see the predicted occupancy and capacity for.

The format is YYYY-MM-DD.

If the query date is not available in prediction data, the closest similar weekday in prediction data will be returned.

If there is no data for the corresponding weekday, then the first service date with data will be returned.

granularity

Optional, default value is 15_minutes

str

The required granularity level of the prediction.

The format is T_minutes where T can be equal to 5 or any multiple of 15.

Any another value will return an error message.

Examples:

&granularity=5_minutes

&granularity=15_minutes

&granularity=30_minutes

&granularity=60_minutes

Fields

The response comprises of two parts:

  • info: describes what type of occupancy is selected for each line of the network
  • data: the actual prediction data, detailed below

Name

Description

service_date

Datetime

time

Time (granularity interval, default is 15_minutes) at which the occupancy is predicted for the given stop

line_short_name

The GTFS line short name

gtfs_stop_id

The GTFS stop_id

terminus_gtfs_stop_id

The last GTFS stop id of that line and direction. Used to identify the direction.

If a line is circular, the last non-identical stop is displayed.

capacity

Predicted capacity, in number of passengers

occupancy

Predicted occupancy, in number of passengers

Response

{ 
"service_date": datetime (ISO 8601),
"time": time ("%H:%M:%S"),
"line_short_name": str,
"gtfs_stop_id": int,
"terminus_gtfs_stop_id": int,
"capacity": int,
"occupancy": int,
}

Sample requests

# No granularity parameter
https://orleansmetropole.prediction.cit.io/rest/predicted_occupancy?service_date=2021-02-25

# With granularity parameter
https://orleansmetropole.prediction.cit.io/rest/predicted_occupancy?service_date=2021-02-25&granularity=5_minutes

Sample response

[
{
"service_date": 1711584000000,
"time": "11:00:00",
"line_short_name": "01",
"gtfs_stop_id": "ORLEANS:StopArea:00001400",
"terminus_gtfs_stop_id": "ORLEANS:StopArea:00046300",
"capacity": 84,
"occupancy": 9,
},
{
"service_date": 1711584000000,
"time": "11:30:00",
"line_short_name": "01",
"gtfs_stop_id": "ORLEANS:StopArea:00001400",
"terminus_gtfs_stop_id": "ORLEANS:StopArea:00046300",
"capacity": 104,
"occupancy": 4,
}
]

Avez-vous trouvé ce que vous cherchiez ?

/api/login - Login

Release note (Occupancy API)

Contact