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:

FieldtypeDescription
_idObjectIdIdentifier of the model
attemptsObjectThis field contains the logic and which services are going to participate in the different kind of attempts actually are only two "external" and "internal"
branchesArrayArray of branches (ids) allowed to participate in this assignment
businessUnitsArrayArray of business units (ids) allowed to participate in this assignment
isActiveBooleanFlag to turn on/off the assignment
workspaceObjectIdId 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:

FieldParent FieldTypeDescription
rulesObjectAll configurations of the core/local assignment are configured here
minimumTriesrulesIntegerNumber of minimum tries passed to be run the internal assignment, if has no values default value is 0
vrpRulesrulesObjectThis property contains all the rules to be used in the vrp assignment
maxDistancerules.vrpRulesIntegerThe max distance of the routes to be assigned
maxTimerules.vrpRulesIntegerThe max time of the route to be assigned
validateSkillsPerNoderules.vrpRulesBooleanThis property ensures the skills are supported, the skills are configured in the userGroups and assigned manually to every user.
useTimeWindowsrules.vrpRulesBooleanThis 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
basePenaltyrules.vrpRulesIntegerThis 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:

FieldParent FieldTypeDescription
nameStringName of the provider just to make it easy to identify
priorityIntegerThe priority number to consider when competing among multiple providers, where 1 represents the highest priority
partnershipObjectIdId of the partnership
workspacePartnershipObjectIdId of the workspacePartnership
cancelationObjectThe object has the properties and actions to cancel or remove a service automatically
timecancelationIntegerTime in minutes to wait before cancel a service if not assigned (accepted)
actioncancelationStringHere is a enum of actions or different actions the values are: NONE, TRY_OTHER_SERVICE, CANCEL, CANCEL_AND_TRY_OTHER_SERVICE
workingHoursArrayAn array of objects with the day, begin and end time to make the provider available (actually not implemented)
customRulesArrayAn 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
      }
    }
  },
}