Core Statistics

This interface allows for access to statistics data. The base url for this interface is at:

/api/statistics/

A JSON file with OpenAPI data about all core-related statistics APIs can be downloaded here.

A valid JWT is required for all statistics access.

Status Data

Status data can be obtained from the /v1/status/ endpoint:

GET /v1/status/users

Returns statistics about recent user activity and registrations

Status Codes

with a response like this:

{
  RegisteredLastMonth: 0,
  ActiveLastMont: 2,
  ActiveLastWeek: 1,
  ActiveToday: 1,
  DocumentsToCheck: 3
}

All data are integer numbers.

RegisteredLastMonth represents the number of active users registered in the last 30 days.

ActiveLastMonth represents the number of users that created a transportation request in the last 30 days. Similarly, ActiveLastWeek and ActiveToday represents the users that created a transportation request respectively in the last 7 days and in the current day.

DocumentsToCheck represents the number of license documents waiting to be validated by an administrator.

GET /v1/status/production

Returns statistics about recent production (reservations and trips)

Status Codes

with a response like this:

{
  NextMonthDueReservations: 2,
  TodayReservations: 3,
  TodayTrips: 2,
  OngoingTrips: 1
}

All data are integer numbers.

NextMonthDueReservations and TodayReservations represents the number of reservations due to start respectively in the next 30 days and in the current day.

TodayTrips represents the number of trips started in the current day, while OngoingTrips represents the number of trips still open.

GET /v1/status/trips-trend-today

Returns statistics about trip trends during the day, compared with recent history

Status Codes

with a response like this:

{
  HistoryHours: [
    0: 0,
    1: 0,
    ...
    23: 0
  ],
  TodayHours: [
    0: 0,
    1: 0,
    ...
    23: 0
  ],
  FailedHours: [
    0: 0,
    1: 0,
    ...
    23: 0
  ]
}

All data are arrays of 23 integer numbers, and are calculated over the trips done in the last 14 days.

Each data in HistoryHours represents the average number of trips started in the hour represented by the name of the data. I.e. a value of 2 in the 1 data means that an average of 2 trips were started between 1:00 AM and 1:59 AM every day in the last 14 days.

Each data in TodayHours represents the number of trips started in the current day in the hour represented by the name of the data. I.e. a value of 1 in the 13 data means that one trip has been started between 1:00 PM and 1:59 PM in the current day.

Each data in FailedHours represents the number of trips that should have started in the hour represented by the name of the data, but no trip was started. I.e. a value of 4 in the 13 data means that in all the platform history 4 reservation should have been started between 1:00 PM and 1:59 PM, but no trip was started for that reservations.

GET /v1/status/reservations-last-24h

Returns statistics about recent reservation status

Status Codes

with a response like this:

{
  UsedReservations: 3,
  ExpiredReservations: 1
  CanceledReservations: 0
}

All data are integer numbers.

UsedReservations represents the number of reservation started in the last 24 hours.

CanceledReservations represents the number of reservations that should have been started in the last 24 hours but were revoked.

ExpiredReservations represents the number of reservations that should have been started in the last 24 hours but were not started nor revoked.

Historical Data

Analysis on historical data can be obtained from the /v1/analysis/ endpoint:

Every APIs accept an input Json body like this:

{
  StartDate: "2020-01-01T00:00:00Z"'  // Date
  EndDate: "2020-01-02T00:00:00Z"     // Date
}

and will return a plain Json error if one of the two values is not valorized, if EndDate is a less than StartData or if the two dates are apart more than a number of days specified in the configuration variable MAX_STATISTICS_DAYS.

POST /v1/analysis/trip-minutes-per-day

Calculates total trip minutes (from start to end) per day.

Trip minute calculation may require using per-module computation rules. This calculation can be performed on a maximum of 180 days.

Status Codes

with a response like this:

{
  [
    {
      Day: "2020-01-01T00:00:00Z",    // Date
      Measure: 0.5                    // Decimal
    },
    ...
  ]
}

The data are calculated on the closed trip that started in the time period defined in the Json input, and grouped by the day in which the trip started.

The Measure data represents the sum of the lengths in minutes of every trip that occurred that day.

POST /v1/analysis/trip-count-per-day

Calculates the number of trips per day in the given interval

This calculation can be performed on a maximum of 180 days.

Status Codes

with a response like this:

{
  [
    {
      Day: "2020-01-01T00:00:00Z",    // Date
      Measure: 1                      // Decimal
    },
    ...
  ]
}

The data are calculated on the closed trip that started in the time period defined in the Json input, and grouped by the day in which the trip started.

The Measure data represents the number of trip that started in that day.

POST /v1/analysis/trip-customers-per-day

Calculates the average number of trips per customers in a day.

Status Codes

with a response like this:

{
  [
    {
      Day: "2020-01-01T00:00:00Z",    // Date
      Measure: 1                      // Decimal
    },
    ...
  ]
}

The data are calculated on the closed trip that started in the time period defined in the Json input, and grouped by the day in which the trip started.

The Measure data represents how many user started a trip in that day. If a user started two trips, it will count only once.

POST /v1/analysis/trip-customers-monthly-average

Calculates the average number of daily users in a month.

Status Codes

with a response like this:

{
  [
    {
      Day: "2020-01-01T00:00:00Z",    // Date
      Measure: 1                      // Decimal
    },
    ...
  ]
}

The data are calculated on the closed trip that started in the time period defined in the Json input, and grouped by the month in which the trip started.

The Measure data represents the average number of users that started a trip in each day of the month.

POST /v1/analysis/trip-monthly-average

Calculates the average number of daily trips in a month.

Status Codes

with a response like this:

{
  [
    {
      Day: "2020-01-01T00:00:00Z",    // Date
      Measure: 1                      // Decimal
    },
    ...
  ]
}

The data are calculated on the closed trip that started in the time period defined in the Json input, and grouped by the month in which the trip started.

The Measure data represents the average number of trips started in each day of the month.

POST /v1/analysis/trip-per-customer-monthly-average

Calculates the average number of daily trips per customer in a month.

Status Codes

with a response like this:

{
  [
    {
      Day: "2020-01-01T00:00:00Z",    // Date
      Measure: 1                      // Decimal
    },
    ...
  ]
}

The data are calculated on the closed trip that started in the time period defined in the Json input, and grouped by the month in which the trip started.

The Measure data represents the average number of trips started by a customer in each day of the month.