Booking (order) data model
Data model representing a booking (or order) in the system. A booking consists of at least two nodes: one for drop-off and one for pickup.
Setting the Time Window
There are three options to specify applicable time windows (for either pickup or drop-off; the following example is for pickup windows) for a booking:
- Set a single time window explicitly through the
min_pickup_timeandmax_pickup_timefields. - Set multiple time windows in the
pickup_time_windowsproperty. - Infer multiple time windows from a referenced operations location for a pickup via
pickup_operations_location.
A booking must have at least one pickup window set with one of these options. If the booking model does not have any time window set, the request to modify or upload the booking will fail.
If time windows are set with min_pickup_time and max_pickup_time or with pickup_time_windows, then pickup_operations_location time windows are ignored.
Note that time windows in pickup_operations_location are nullable fields.
If pickup_operations_location time windows are not set, then min_pickup_time and max_pickup_time or pickup_time_windows are applied following the rules of the pickup_time_windows property.
This logic is often used when fixed time windows are commonly used from the master location (operations locations list), but for operational reasons, those values need to be overridden by setting explicit time windows at the booking level.
Setting Locations
There are three options to specify locations for the booking. In the following example, the pickup location will be used:
- Set latitude and longitude in
pickup_location_latandpickup_location_lon. - Set an address for automatic geocoding in the
data.pickup_addressfield. - Use
pickup_operations_locationwith the set coordinates of the location. If Operations location hasexternal_idthenbooking.pickup_operations_location_external_idand\orbooking.dropoff_operations_location_external_idwill automatically apply information such as location, timewindows and metada from the related Operations Location. This happens only once on booking creation.
The booking must have at least one location set; if none of the options are used, the booking upload or modification request will fail.
If multiple locations are specified, they are applied in the following priority order (highest priority overrides lower priority):
- Explicitly set latitude and longitude from the
pickup_location_latandpickup_location_lonproperties. - Address for automatic geocoding in the
data.pickup_addressfield. pickup_operations_locationwith the set coordinates of the location.
Unique identifier for the booking. It can be an arbitrary string, however we recommend using UUID instead. It has to be unique for a simulation.
Name of the pickup location. In SWAT Routes, it is mapped to pickup address
Latitude of the pickup location.
Longitude of the pickup location.
Earliest possible pickup time.
Latest possible pickup time.
Duration of service at the pickup location (in seconds).
Name of the dropoff location. In SWAT routes, it is mapped to drop off address
Latitude of the dropoff location.
Longitude of the dropoff location.
Earliest possible dropoff time.
Latest possible dropoff time.
Duration of service at the dropoff location (in seconds).
data object
Additional data associated with the booking. If coordinates of the pickup and drop off locations are not known, postal address has to be specispecified in this property.
Aribtrary identifier that can be used for tracking by the consumer
Mapped in SWAT Route to name of the pickup customer
Mapped in SWAT Route to name of the dropoff customer
If geographical coordinates are unknown, the address must be provided here. It will be geocoded automatically.
Remarks for the driver
If geographical coordinates are unknown, the address must be provided here. It will be geocoded automatically.
Optional pickup country to improve quality of geocoding
Optional pickup city to improve quality of geocoding
Optional drop off country to improve quality of geocoding
Optional drop off country to improve quality of geocoding
Postal code of the pickup address, can be used for automatic geocoding
Postal code of the dropoff address, can be used for automatic geocoding
Second part for drop off customer name (i.e. last name)
Second part of the pickup customer name (i.e. last name)
Phone for pickup location.
Phone for dropoff location.
vehicle_characteristics object
Required characteristics of the vehicle for this booking.
property name* object
- number
- Ranged characteristic
- boolean
Value of the characteristic, for example:
{
"manpower": 3
}
Minimum value of the characteristic
Maximum value of the characteristic
Vehicle labels contain constraints, represented as dicts, that may contain string labels or sub-constraints. A constraint is a dict, containing only one entry with keys: "and", "or" or "not". Keys "and" and "or" define the AND or OR logic functions. Values for these keys should be a list of either string labels or dicts, containing sub-constraints. The key "not" defines the NOT logic function. Value for this key can be a single string or single sub-constraint. Example of vehicle labels constraints:
'1' AND ('2' OR '3') AND NOT ('4' AND '5') as
{"and": [{"or: ["2", "3"]}, {"not": {"and": ["4", "5"]}}]}
Groups that this booking belongs to
geofence_definition_strategy object
- By Dropoff
- By Pickup
- Independent
- Mixed
By dropoff location. Both pickup and dropoff nodes will be labeled with same geofence Defined by dropoff point
by_dropoffBy pickup location. Both pickup and dropoff nodes will be labeled with same geofence Defined by pickup point
by_pickupBoth pickup and dropoff nodes may be labeled with different geofences Defined by corresponding locations
independentWorks like independent but if geofences are different, then Nodes are labeled with both geofences.
mixedEnables or disables the LIFO order logic for this booking. LIFO logic is a soft constraint that forces pickups and drop-offs to happen in a LIFO sequence relative to the vehicles (the last picked-up order is prioritized for drop-off).
Penalty for the broken LIFO order. If not present, the LIFO order is required as lifo_order_check is true
Booking-level trip cost parameter
0demand object
Demand associated with the booking.
Reference to a pickup location derived from a static list of Operations Locations
Reference to a dropoff location derived from a static list of Operations Locations
Current state of the booking. Supported states include:
new: The booking has been created but is not yet ready for optimization.prepared: The booking has been created with all required nodes and settings and is ready to be optimized. This is the default state for a booking created via the logistics or passenger pipeline.queued: The booking is queued for calculation.calculation: The booking is being optimized. Once optimization is triggered, the booking can remain in this state for an extended period.cancelled_in_calc: The booking has been canceled by the calculation pipeline.assigned: The booking has been successfully optimized and has a vehicle assigned to it.rejected_by_system: The optimization engine was not able to allocate a vehicle to fulfill the booking.enroute: The booking is currently being serviced by the vehicle (a vehicle has completed pickup for the booking).sent_offer: In the case of on-demand operations, this indicates that an offer to accept the booking has been sent to the passenger.cancelled_by_user: In the case of passenger service, this indicates that a passenger has canceled the booking.pooling: In the case of JIT service, this indicates that the booking is awaiting passenger pooling to be completed.fail_to_board: Indicates that a vehicle was not able to pick up goods or a passenger failed to board. This usually means the booking is ignored during subsequent calculations.fail_to_deliver: Indicates that the booking has been picked up, but the vehicle couldn't deliver the goods or passengers. The booking is not ignored in subsequent calculations since the vehicle still carries the goods or passengers.
Possible values: [new, prepared, queued, calculation, cancelled_in_calc, assigned, rejected_by_system, enroute, completed, sent_offer, cancelled_by_user, pooling, fail_to_board, fail_to deliver, linked]
Reference the booking handover object if the booking was used to create a new booking through the driver handover process.
Calculated air distance between drop off and pick up nodes in a booking
Soft deletion flag for the booking. This flag cannot be set by a PATCH or POST request.
falseURI of the simulation this booking belongs to
Constraint limiting allowed maximum trip duration for the booking
Penalty as a cost function for this booking for not providing an offer during optimization. The higher the bigger the penalty is.
10000000Group UID this booking belongs to
falseProject ID this booking belongs to
Used to set the operations mode for JIT route optimization. depart_at forces the algorithm to ensure an accurate departure time for the passenger in this booking, while arrive_by ensures an accurate arrival time.
Possible values: [depart_at, arrive_by]
depart_atcustomerdropoff_stops object
pickup_stops object
pickup_time_windows object[]
Allows setting multiple time windows for a booking at a pickup location. If both this field and max_pickup_time along with min_pickup_time are set, the resulting set of time windows will be a combination of all time windows. For example, if there is one additional time window set in this field, the resulting time window will have two elements: one from the booking itself and the other from this field.
This field can be thought of as an "additional" time window. If time windows are set in this field, as well as with min/max_pickup/dropoff_time, the algorithm will consider all time windows (as a combination of all fields with merging logic for overlapping time windows applied).
Set time windows may overlap; however, this may result in less efficient routes.
dropoff_time_windows object[]
Allows setting multiple time windows for a booking at a drop-off location. If both this field and min_dropoff_time along with max_dropoff_time are set, the resulting set of time windows will be a combination of all time windows. For example, if there is one additional time window set in this field, the resulting time window will have two elements: one from the booking itself and the other from this field. Time windows may overlap; however, this may result in less efficient routes.
This field can be thought of as an "additional" time window. If time windows are set in this field, as well as with min/max_pickup/dropoff_time, the algorithm will consider all time windows (as a combination of all fields with merging logic for overlapping time windows applied).
In the case of a Singapore location, this postal code can uniquely identify the address for pickup.
In the case of a Singapore location, this postal code can uniquely identify the address for drop-off.
Instead of using the pickup_operations_location URI, you can conveniently specify the Operations Location for a new booking by providing its external_id. This allows you to use your own identifier, and the system will automatically populate the booking with the corresponding location data during creation.
Important: Once the booking is created, changes to the original Operations Location record will not automatically update the booking details.
Instead of using the dropoff_operations_location URI, you can conveniently specify the Operations Location for a new booking by providing its external_id. This allows you to use your own identifier, and the system will automatically populate the booking with the corresponding location data during creation.
Important: Once the booking is created, changes to the original Operations Location record will not automatically update the booking details.
Flag indicating if the booking has any other bookings associated with it.
falseEnables prioritization of thie booking during the optimization. first_in_trip means that the booking has to be the first one to drop, last_in_trip means that the bookings has to be the
Possible values: [null, last_in_trip, first_in_trip]
Describes the type or category of the product associated with the booking (e.g., "AMBIENT"). This field is used to calculate the dynamic service time for the order in case the drop-off location is an operations location.
If the booking has a shipment model associated with it, this contains a URI link to it.
If the booking has a shipment model assoviated with it, contains an extenarl_id of the shipment.
Timestamp indicating when payment failed for the booking.
Creation timestamp of an object
id object
Identifier of the object
- integer
- uuid
Can be integer
Can be UUID
Last modification timestampo of the object
URI of the object instance
{
"uid": "string",
"pickup_location_name": "string",
"pickup_location_lat": 0,
"pickup_location_lon": 0,
"min_pickup_time": "2024-07-29T15:51:28.071Z",
"max_pickup_time": "2024-07-29T15:51:28.071Z",
"pickup_service_time": 0,
"dropoff_location_name": "string",
"dropoff_location_lat": 0,
"dropoff_location_lon": 0,
"min_dropoff_time": "2024-07-29T15:51:28.071Z",
"max_dropoff_time": "2024-07-29T15:51:28.071Z",
"dropoff_service_time": 0,
"data": {
"external_id": "string",
"customer_name": "string",
"customer_phone": "string",
"pickup_customer_name": "string",
"dropoff_customer_name": "string",
"dropoff_address": "string",
"remarks": "string",
"pickup_address": "string",
"dropoff_country": "string",
"dropoff_city": "string",
"pickup_country": "string",
"pickup_city": "string",
"pickup_postal_code": "string",
"dropoff_postal_code": "string",
"dropoff_customer_name2": "string",
"pickup_customer_name2": "string",
"pickup_customer_phone": "string",
"dropoff_customer_phone": "string"
},
"vehicle_characteristics": {},
"vehicle_labels": "Unknown Type: object,null",
"groups": [
"string"
],
"lifo_order_check": true,
"lifo_order_penalty": 0,
"trip_cost": 0,
"demand": {},
"pickup_operations_location": "string",
"dropoff_operations_location": "string",
"state": "new",
"booking_handover": "string",
"air_distance": 0,
"is_invalidated": false,
"service_time": 0,
"simulation": "string",
"max_trip_duration": 0,
"min_trip_duration": 0,
"penalty": 10000000,
"actual_dropoff_time": "string",
"actual_journey_duration": "string",
"actual_pickup_time": "string",
"cancellation_time": "string",
"fail_to_board_time": "string",
"failed_to_deliver_at_ts": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"group_uid": "string",
"offer_should_be_auto_accepted": false,
"planned_dropoff_time": "2024-07-29T15:51:28.071Z",
"planned_journey_duration": "string",
"planned_pickup_time": "string",
"project": "string",
"requested_at": "2024-07-29T15:51:28.071Z",
"sim_tier": 0,
"user_accepted_offer_at": "string",
"customer_id": "string",
"completed_by": "string",
"created_by": "string",
"group_booking_id": 0,
"passenger_payment_method_id": "string",
"payment_method_type": "string",
"transfer_type": "depart_at",
"booking_type": "customer",
"fixed_journey_duration": "string",
"fixed_route_type": "string",
"fixed_waiting_time": "string",
"journey_duration_difference": "string",
"odbs_waiting_time": "string",
"public_transit_transport": "string",
"ready_to_board_at": "string",
"requested_tickets": {},
"ticket": "string",
"tickets": [
"string"
],
"waiting_time_difference": "string",
"dropoff_stops": {
"points": [
{}
]
},
"pickup_stops": {
"points": [
{}
]
},
"pickup_time_windows": [
{
"open_time_ts": "2024-07-29T15:51:28.071Z",
"close_time_ts": "2024-07-29T15:51:28.071Z",
"clost_time_ts_dynamic": "2024-07-29T15:51:28.071Z"
}
],
"dropoff_time_windows": [
{
"open_time_ts": "2024-07-29T15:51:28.071Z",
"close_time_ts": "2024-07-29T15:51:28.071Z",
"close_time_ts_dynamic": "2024-07-29T15:51:28.071Z"
}
],
"pickup_postal_code": "string",
"dropoff_postal_code": "string",
"pickup_operations_location_external_id": "string",
"dropoff_operations_location_external_id": "string",
"has_linked_bookings": false,
"order_position": "null",
"product_kind": "string",
"shipment": "string",
"shipment_external_id": "string",
"failed_to_pay_at": "string",
"created_at": "2024-07-29T15:51:28.071Z",
"id": 0,
"modified_at": "2024-07-29T15:51:28.071Z",
"resource_uri": "string"
}