Task Assigment Model
Here the schema is explained with all its fields and meaning
The task assignment model used to store the logic of how the orders are going to be assigned based in different rules and configurations. Here some properties used:
Field | type | Description |
---|---|---|
_id | ObjectId | Identifier of the model |
attempts | Object | This field contains the logic and which services are going to participate in the different kind of attempts actually are only two "external" and "internal" |
branches | Array | Array of branches (ids) allowed to participate in this assignment |
businessUnits | Array | Array of business units (ids) allowed to participate in this assignment |
isActive | Boolean | Flag to turn on/off the assignment |
workspace | ObjectId | Id of the workspace owner of this record |
There are more properties but they're not being use at the moment. Actually only one field is more depth in his use and is divided in 2 properties one is the route to assign all active orders making routes using the drivers active in the workspace, and the second takes all the orders dropped (not assigned) to be assigned to a partner or external service
Internal Assignment
This version of the assignment introduces two modes: "Base Mode" and "Floating Mode."
In "Base Mode," drivers stay and work within a single branch. In "Floating Mode," drivers operate flexibly, working at various points within a business unit and attending to multiple branches. This assignment accounts for all available drivers, orders that meet the cooking or waiting time requirements (as configured per branch), and the dispatch date set in the settings.
When an order surpasses the dispatch time, all other orders that have met the waiting time are considered. The system then attempts to generate optimal routes for all drivers and orders, taking into account (if configured) skills, vehicle types, geofences, business units, distances, route times, and other relevant rules.
The internal property in attempts includes the following attributes:
Field | Parent Field | Type | Description |
---|---|---|---|
rules | Object | All configurations of the core/local assignment are configured here | |
minimumTries | rules | Integer | Number of minimum tries passed to be run the internal assignment, if has no values default value is 0 |
vrpRules | rules | Object | This property contains all the rules to be used in the vrp assignment |
maxDistance | rules.vrpRules | Integer | The max distance of the routes to be assigned |
maxTime | rules.vrpRules | Integer | The max time of the route to be assigned |
validateSkillsPerNode | rules.vrpRules | Boolean | This property ensures the skills are supported, the skills are configured in the userGroups and assigned manually to every user. |
useTimeWindows | rules.vrpRules | Boolean | This property ensures the use of time windows but is in beta and can cause some error or the drop of multiple orders because of this time windows, the time window is took from desiredExpectedTime field |
basePenalty | rules.vrpRules | Integer | This property adds penalty to all orders, this can be handy because if all orders has a low penalty can cause all orders to be dropped |
External Assignment
When the internal assignment drops a node or is bypassed due to another rule (such as the minimum number of attempts), all rules configured within the external property are triggered to assign the task to another service (partner or external). Currently, the external property contains only one attribute, partnerships, which is an array of various providers.
Each partnership includes the following properties:
Field | Parent Field | Type | Description |
---|---|---|---|
name | String | Name of the provider just to make it easy to identify | |
priority | Integer | The priority number to consider when competing among multiple providers, where 1 represents the highest priority | |
partnership | ObjectId | Id of the partnership | |
workspacePartnership | ObjectId | Id of the workspacePartnership | |
cancelation | Object | The object has the properties and actions to cancel or remove a service automatically | |
time | cancelation | Integer | Time in minutes to wait before cancel a service if not assigned (accepted) |
action | cancelation | String | Here is a enum of actions or different actions the values are: NONE, TRY_OTHER_SERVICE, CANCEL, CANCEL_AND_TRY_OTHER_SERVICE |
workingHours | Array | An array of objects with the day, begin and end time to make the provider available (actually not implemented) | |
customRules | Array | An array of all custom rules available for partnerships (all this rules are available here too) |
Un ejemplo del registro:
{
"_id": "664662722836c264dbdac668",
"branches": [],
"businessUnits": [],
"workspace": "626982cfe05c621abba3e382",
"isActive": true,
"attempts": {
"external": {
"partnerships": [
{
"priority": 1,
"name": "Uber Cash",
"partnership": "664e6444b27041eff660781c",
"customRules": [],
"workspacePartnership": "664e6850b27041eff660781e",
"workingHours": [
{
"day": 3,
"dayText": "Miercoles",
"beginTime": "00:00",
"endTime": "12:00"
}
],
"cancelation": {
"time": 5,
"action": "TRY_OTHER_SERVICE"
}
},
{
"priority": 1,
"name": "Uber",
"partnership": "62aba4ecd32695e52493c97c",
"customRules": [],
"workspacePartnership": "6646580e2836c264dbdac666",
"cancelation": {
"time": 5,
"action": "CANCEL_AND_TRY_OTHER_SERVICE"
},
"workingHours": [
{
"day": 3,
"dayText": "Miercoles",
"beginTime": "00:00",
"endTime": "12:00"
}
]
},
{
"priority": 2,
"name": "Rappi",
"partnership": "65b9952d49bf08eddc71af44",
"customRules": [],
"workspacePartnership": "664658832836c264dbdac667",
"workingHours": [
{
"day": 5,
"dayText": "Miercoles",
"beginTime": "00:00",
"endTime": "12:00"
}
],
"cancelation": {
"time": 5,
"action": "CANCEL"
}
},
{
"priority": 2,
"name": "Rappi Cash",
"partnership": "664e66b8b27041eff660781d",
"customRules": [],
"workspacePartnership": "664e6a93b27041eff6607820",
"workingHours": [
{
"day": 3,
"dayText": "Miercoles",
"beginTime": "00:00",
"endTime": "12:00"
}
],
"cancelation": {
"time": 5,
"action": "TRY_OTHER_SERVICE"
}
}
]
},
"internal": {
"type": "VRP",
"rules": {
"vrpRules": {
"maxDistance": 25000,
"maxTime": 50,
"validateSkillsPerNode": true
},
"minimumTries": 0
}
}
},
}
Updated 4 months ago