Rules 📋

In order to obtain the route followed by a shipment and calculate the emissions emitted we need to create rules, these rules have different characteristics:

Types

  • There are two type of rules, incoming and outgoing:
    • Incoming rules define which logistics center will "pick up the shipment" at the origin address. collect
    • Outgoing rules, can define a transfer frome one logistic center to another or delivery from the current logistic center to the delivery address.transfero deliver

Characteristics

The rules are based on priority, a group of conditions and one action.

  • Priority is what tell us which rules should be evaluated first. They are sorted in ascending order, so a rule with priority 1 has a higher priority than a rule with priority 10.
❗️

Two rules can't have the same priority for the same logistic center.

  • Rules can have the following conditions:
    • Origin zip code
    • Origin country
    • Destination zip code
    • Destination country
    • Service
    • Total weight
    • Number of parcels
  • The actions allowed depend on the type of rule and are as follows:
    • collect: pick-up at the customer's address.
    • transfer: transfer from one center to another.
    • deliver: delivery to the addressee's address.
  • The transfer rules can also define intermediate steps, for example, if to go from one hub to another you first go by truck to an airport, then by plane to another airport and finally from the airport to the destination hub. This allows you to define different emission factors for each of these legs. To define it, you define in the field steps of the action, which is an ordered array of objects that has:
    • step: step order
    • alias: alias: name by which to identify the step
    • factorId: factor identifier
    • coordinates: coordinates of the destination point.
  • Each of the rules defines an emission factor that has to be applied to the movement it defines.
  • Rules can be activated and deactivated.
  • In the event that a shipment cannot be routed, an error response is returned.