Orchestration

Principles

OneStock orchestration rules are shown and can be modified directly in the backoffice of OneStock.

Here is a video to introduce these pages in the backoffice:

For more information on orchestration :

Ruleset Chainings

In this page, you will be able to create and modify ruleset chainings.

The ruleset chaining consists in a sequence of rulesets, which consist themselves in a sequence of orchestration rules. It allows calling multiple times the same ruleset, or calling rulesets that are using different stock requests.

It also allows specifying and forcing the check of the delivery promise during the orchestration. If you decide to do so, OneStock will check if each candidate selected by an orchestration rule is able to deliver on time to the destination, based on the configuration of the delivery promise. If a candidate is not able to deliver on time, it will be automatically discarded by the orchestration engine.

To manage delays that may occur, it is possible to configure a delay authorized to deliver the order. This tolerance is configured in the ruleset chaining.

For example, you may define a ruleset chaining that:

  1. execute a ruleset and tries to match the promised delivery date

  2. then, if the order couldn’t be allocated after the execution of the first ruleset, execute the same ruleset with a tolerance of 2 days of delay on the promised delivery date

  3. finally, execute another ruleset with a tolerance of 5 days of delay.

Rulesets

The orchestration rules of each ruleset can be modified in the OneStock backoffice, if the user is authorised. The orchestration section shows a list of existing rulesets. You can click on the pen button on the right side to open and modify the ruleset.

It is strongly recommended to test a modification of the orchestration rules on the qualification environment before applying the modification in production.

A change to the orchestration rules will not apply immediately. The new rules will not be applied until midnight CET. It is still possible to delete the change or modify the new configured rules before they apply.

You can see pending modifications on the Orchestration page:

The trash button will delete the modification (and keep the current version). The pen button allows modifying the new version before it applies. The check allows to force applying the new version immediately rather than waiting for midnight.

Each ruleset has an ID (that cannot be modified), a name and is associated to a stock request for unified stock and a stock request for detailed stock. These requests are optional but default requests will be used if not specified. These stock requests define what stocks will be considered during orchestration.

The user can add, modify or delete each rule in the ruleset, and change the order and therefore the priority of the rules.

The modification of rules impacts all existing orders. Thus, all current orders being orchestrated by the modified ruleset will be impacted. Their current rule is identified by its number (the number displayed on the left in the ruleset list) and remains the same after the modification, even if the rule in question has been moved.
If rules are removed from the ruleset, a current order in a rule whose number no longer exists will be in “rules over” (see below about “rules over”).

When an order enters in the orchestration ruleset, OneStock will first check if all items to be orchestrated are available in stock, using the unified stock request associated to it. If there is no stock, specific action can be taken, usually the missing item(s) will be cancelled.

How the rules work

The orchestrator works at the order level, not order line by order line. It therefore always evaluates all items in the order (minus items already shipped or cancelled). If the order has multiple items, the orchestrator will run through the set of rules until it can serve all of them (from one or more stock locations, depending on the configured rules and the stock availability).

Each rule has a name to describe it briefly and explicitly. The name has no impact on the application of the rule.

The rule consists of :

  • a filter which determines which stock locations are eligible for the rule, based on the items in the order and the stocks in these stock locations,

  • a timeout which allows you to manage exceptions by determining the maximum time to wait in this rule before switching to the next rule if there are candidates but they do not claim the order,

  • additional options, detailed below.

Each candidate of a rule is a set of one or more stock location(s) that can serve an order. For example: for an order containing 3 items A, B and C, a candidate will be the allocation of items A and B to warehouse 1 and item C to warehouse 2.
The execution of a rule can return:

  • 0 candidate: in this case, the orchestrator immediately switches to the next rule (without waiting),

  • 1 or more candidates:

    • For each candidate, the stock location(s) corresponding to the candidate are assigned the order or the parts of the order they can process.
      The order is therefore offered to all candidates simultaneously.

If a stock location picks up the part of the order that has been assigned to it, the orchestrator will reapply the current rule to update the candidates for the rest of the order.

If the order has not been fully claimed after the defined timeout, the orchestrator will switch to the next rule.

Rule definition

Filters

The filter of a rule is a set of conditions combined with ANDs and ORs to determine the candidates eligible for the rule.
Each of these can be a condition on:

  • Number - Defines the maximum number of “Sources”, or stock locations, needed to serve the entire order. This corresponds to the number of shipments if the order is a home delivery.
    If the number of sources is set to 1, this means that no splits are allowed for the order, i.e. the whole order must be shipped from a single stock location.

  • Number of shipments - Defines the maximum number of “Shipments”: same as the number of “Sources”, except that the collection store is not counted for Click&Collect scenario.

  • Average source price - The number of sources will be limited so that the average source price stays greater or equal than the set average price.

    Ex : If average source price is set to 3.5 €, a 10 € order will be provided by a maximum of 2 sources.

  • Items never shipped alone - This filter prevents additional items (such as gift boxes or free samples) from being sent alone in a package. There are two ways to declare these items:

    • Identifier - You can give a list of item ids separated by commas, no spaces. This list is fixed, it does not evolve if the items properties are modified (Ex: item_1,item2,item3)

    • Item feature - You can give the feature name on which the filter should be based, an operator (equal, nor equal) and its value. (Ex: "shipped_alone" "equal" "false", all items with the field shipped_alone = false will not be shipped alone)

Then, several filters are available:

  • Distance - a minimum and maximum distance between the candidate location and the delivery address is defined. This distance is as the crow flies (straight line).

  • Tag - filter on a property of the stock location (property tab in Stock location page). You can then select the Tag to filter and then either compare it with:

    • Specific value: “stock location type” = “store”.

    • Tag of the preferred stock location the tag of a specific stock location indicated on the order: “franchisee group” = same as the one of the preferred location specified on the order (indicated on the field delivery.origin.endpoint_id)

    • Tag of collection store the tag of the store where the order will be collected (only for Click&Collect and Reserve & Collect): “franchisee group” = same as the one of the collection store.

    • Tag of ordering store the tag of the store that placed the order (only for orders placed in store).

    • Order Field a value specified on the order: “region” = the one specified on the order. It must be specified on the order in the field candidate_tags; for example candidate_tags.region.

  • Dynamic tag - filter on the tags calculated automatically by OneStock (visible in the property tab in Stock location page). See paragraph below. You can use an operator to compare the actual value of the tag of the candidate with a specific value. Some stock locations may not have any value calculated for the dynamic tag (for example, no preparation time will be calculated if no order has been prepared by the store). A default value must be specified to apply to these locations. Certain dynamic tags cannot be used as filters, but only for sorting and comparing values.

  • Order destination - the destination location, aka collection store of the order, in the case of Click&Collect order.

  • Order preferred location - a specific location indicated on the order. For example: store where the customer created his loyalty card.

  • Has not already claimed this order - this filter eliminate stock locations that are currently preparing part of the order. They can’t be proposed again as candidates in this rule.

Filter configuration border cases

  • No filters. Orchestration is done using the chaos mode. There is no notion of candidate (so no skipping to the next rule if no candidates for the entire order are found), all endpoints are proposed to claim whatever they can, there is no esurance that the order will be entirely fulfilled, high probability of partial fulfillement.

    • Not recommended in a scenario without a custom action as the order will be proposed to all stock locations which might result in a very elevated number of splits and possible performance issues.

  • Filters but no source filter. The orchestrator is eco-friendly, so a maximum of 5 sources is applied. If we want to consider more, we must apply a source filter greater than 5.

Dynamic tags

OneStock can automatically calculate several different dynamic tags.

Dynamic tags are designed to provide real-time data and insights to prioritize stores and orders, encourage reliability, and optimize the fulfillment process.

Here are examples of tags that can be calculated by OneStock (they are not activated by default, an additional configuration is required to turn them on):

The objective of this dynamic tag is to measure the reliability of the store. A store will be penalised if it unclaims a lot, or if it has a lot of orders claimed but not yet packed / bagged.

It allows prioritizing fulfillment from stores with the highest reliability to increase the overall quality and to encourage the stores to be reliable and not unclaim orders, in order to get more orders.

This ratio is a percentage expressed with a value between 0 and 100% (exceptionally higher than 100%, see note below).

Example: 97% means that an average of 97 items out of 100 were packaged. So 3 out of 100 items have been unclaimed or not yet packed/bagged.

Period considered: the period considered is configurable. The default value is 14 days, which means that we will consider the statistics between D-14 (at the beginning of the day, on the endpoint timezone) and D (at the beginning of the day on the endpoint timezone). We do not consider the statistics of the current day (so no need to calculate in real time).

Measurement:

  • Division of the number of packed items by the number of claimed items:

    • number of claimed items, counting the items claimed and then unclaimed. If the same order is claimed, unclaimed then re-claimed, it will be counted as claimed once (so the store is penalized for the unclaim that was made).

    • number of items packed/bagged.

  • If no items were claimed during the period, the dynamic tag will be considered undefined. (In this case, the sorting will be favorable to the endpoint)

Note: the rate could potentially be higher than 100% if items were packed/bagged over the period, but had been captured before the period.

The objective of this dynamic tag is to measure the average stock-location preparation time for both ship from store and click&collect. It considers the time in working hours, between the moment the store becomes a candidate and the moment the items are packed/bagged. A store will thus be penalised if it takes too long to prepare an order.

It allows prioritizing fulfillment from the fastest stores, thus encouraging stores to be fast to get more orders.

This property will be the time (working hours) expressed in minutes: 136.10 will therefore mean 2 hours 16 minutes 6 seconds.

Period considered: the period considered must be configurable. The default value will be 14 days, which means that we will consider statistics between D-14 (at the beginning of the day, on the endpoint's timezone) and D (at the beginning of the day on the endpoint's timezone). We therefore do not consider the statistics of the current day (so no need to calculate in real time).

Measurement:

  • Addition of claim time and pack or bag time:

    • Average, per claimed item, of the time in working hours between the time the store is a candidate and the time of the claim,

    • Average, per item packed or bagged, of the time in working hours between the time the store claims and the time the store makes the pack or bag.

  • If no orders have been claimed over the period or no orders have been packed or bagged, the tag will be considered undefined. (in this case the sorting will be favourable to the endpoint)

The objective of this dynamic tag is to evaluate the period of time during which stock will be enough to cover the store sales for the items in the order being orchestrated. For example, if item A has 3 quantity in stock in store 1 and that this store sells an average of 2 units of item A per week, the stock coverage will be 1.5 weeks.

Stock coverage is not able to be used as a filter, but as a sorting mechanism for stores. It allows prioritizing fulfillment from stores with the highest stock coverage.

Additional data required: The sales forecast for the next period of time must be provided to OneStock for each combination of item and store to be able to calculate it (another possibility is to use the average sales per period of time).

This property will be the coverage expressed in a given period of time (days, week or other): items A and B are estimated having a stock coverage of 2.5 weeks.

Measurement:

  • Average of the stock coverage of all the items in the order being orchestrated:

    • The stock coverage is calculated by dividing the stock of the item in the store and the average sales per period of time for this item and this store.

    • If the sales per period are 0, the stock coverage will be considered as being the stock quantity (equivalent of having 1 unit sold per period of time).

    • This calculation formula can be customized, so that you can change it according to your needs. It is an Advanced configuration available in the Configuration > Orchestration page in the Order Management Centre. As it may impact performance and server load, the access is restricted to administrators. Get in touch with OneStock to change this formula.

Timeout

The timeout applies if all or part of the order has not yet been claimed and the current rule has candidates. Once the timeout has elapsed, the orchestrator will move to the next rule and the current candidates will no longer be able to claim the order (unless they are still valid candidates in the next rule).

The timeout only takes into account the working hours defined in the rule timetable (section “Timetable” at the bottom of the screen). You can define several schedules, but only one will be taken into account in the timeout of a given rule.

If no timeout is defined in the rule, OneStock will consider a timeout of 7 days.

The timeout of the rule is defined in 2 ways:

  • Rule: this is the time spent in the rule,

    • If the items of the order are all claimed and are unclaimed later on, the total time spent on the rule takes into account the time while it was claimed.
      For example: if you set a timeout of 2 hours on your rule and you enter in this rule at 8am. If the order is fully claimed at 9am and then unclaimed at 11am, (3 hours after entering the orchestration rule), it will immediately move to the next rule.

  • Order: this is the time elapsed since the order was imported into OneStock.
    As soon as the two timeouts have both elapsed, if all or part of the order has not yet been claimed, the orchestrator moves on to the next rule.

Stock

You can define here what stock type(s) must be considered to find candidates. The stock are always stocks coming from the unified and detailed stock requests of the ruleset, so you must make sure that the stock type you select is included in the stock request as well.

By default, only the stock type “on_hand” is considered.

In addition to selecting stock types, you can define the date range to consider for future stocks.

Number of candidates

You can define a minimum and maximum number of candidates applicable for this rule.

  • Minimum number of candidates: if the filters of the rule found less candidates than this minimum number, the orchestration will move immediately to the next rule. It ensures that there will be enough candidates to have some competition and multiple candidates to fulfil the order.

  • Maximum number of candidates: it the filters of the rule found more candidates than this maximum number, only the best candidates will be selected to have no more candidates than this maximum.

    • To select the best candidates, you need to define sorting criteria. OneStock orchestration engine will sort the candidates accordingly and keep the first ones.

    • You can define a first sort criteria, which is a dynamic tag (see paragraph above with their descriptions), a sort order (ascending or descending) and a threshold.

    • This threshold allows to consider close values as equal and to switch to the following sorting criteria. If you define a threshold n, every values between 0 and n are considered equal, between n and 2 x n as well, and so on. For example, if you define a threshold of 10 minutes on the preparation time and the next sorting criteria is on the reliability, it means that if one store has a preparation time of 42 minutes and another one has 48 minutes, they will be considered as equivalent in terms of preparation time and they will be sorted according to the next criteria, the reliability.

Automatic claiming

This option allows the order to be claimed directly by the chosen candidate.

For warehouses

  • Automatic claiming of warehouse

Placed Claimed_warehouse

This option is mandatory if the warehouse preparation process is not done on OneStock interfaces. In the line item workflow, the state claimed_warehouse should exists.

The orchestrator evaluates the candidates that meet the filter conditions. However it is preferable not to set a filter or only on the number of sources since the filter will be applied on warehouses anyway.

If one or more warehouses are candidates, the candidate warehouse with the most items will automatically claim the items it has. The line item will move from “placed” to “claimed_warehouse”.

Unlike the option "Automatic claiming and dispatch from warehouse", the items will not be marked as being dispatched from the warehouse. In this case, a confirmation of the dispatch from the warehouse is expected.
Depending on the integration in place to communicate with the warehouse, a message will be sent to it informing of the items to be prepared. The warehouse will then need to confirm that the items have been shipped.

The orchestrator then moves directly to the next rule, even if other stock locations (stores or warehouses) are valid candidates. If no warehouses are candidates, the orchestrator moves directly to the next rule.

  • Automatic claiming and dispatch from warehouse

Placed FULFILLED

This option acts exactly like the previous one, unlike line items will be automatically dispatched from the warehouse. This option should only be used if no confirmation of shipment is expected from the warehouse.
Depending on the integration set up to communicate with the warehouse, a message will be sent to the warehouse to inform it of the items to be prepared and shipped.

The orchestrator then moves directly to the next rule, even if other stock locations (stores or warehouses) are valid candidates. If no warehouses are candidates, the orchestrator moves directly to the next rule.

For stores

  • Automatic claiming of destination store

Placed Claimed

This option force the orchestrator to only take into account the destination store of the order. This option should only be used on Click&Collect or Reserve&Collect orders. Note that it is not necessary and not recommended for Reserve&Collect orders.

If this store is a candidate, the corresponding items are automatically claimed. They will appear on the store's “Bag” page for Click&Collect orders or on the “Reserve” page for e-bookings (this may vary depending on the store configuration).

The orchestrator then moves directly to the next rule, even if other stock locations (stores or warehouses) are valid candidates. If the destination store is not a candidate, the orchestrator goes directly to the next rule.

  • Automatic claiming of preferred stock location

Placed Claimed

This option force the orchestrator to only take into account the customer’s preferred store.

If this store is a candidate, the corresponding items are automatically claimed.

The orchestrator then moves directly to the next rule, even if other stock locations (stores or warehouses) are valid candidates. If the preferred store is not a candidate, the orchestrator goes directly to the next rule.

For stores or warehouses

  • Automatic claiming of a specific stock location

Placed ANY STATUS

This option force the orchestrator to only take into account stock locations that meet the chosen parameter, so that it automatically claims the order. Four parameters can be set :

ID : refers to the id of the stock location in the database.

Preferred stock location : This parameter acts exactly like the “Automatic claiming of preferred stock location” one, except that the order line status after claiming can be chosen.

Order destination : For Click&Collect and Reserve&Collect orders only. This parameter acts exactly like the “Automatic claiming of destination store” one, except that the order line status after claiming can be chosen.

Tag : refers to any tag visible in the detailed “Stock locations” page. The nomenclature of the tag is in json format and must be filled in as follows: [{"tag":[["specific_value"]]}]. See example below.

Rule progression

For a given order, the orchestrator executes one rule at a time. When it moves to the next rule, it will impact all future orchestrations of the order.
For example: if a store picks up part of the order while on rule 1, the orchestrator will continue to run for the rest of the order. It can then move on to rule 2 in the event of a timeout. If the store leaves the part of the order it had claimed, the order will be re-orchestrated by applying rule 2 and not rule 1.

When the orchestrator exits the last rule of the ruleset without having been able to orchestrate the whole order, it goes into "Rules over". A notification is triggered and, depending on the implementation, it can trigger specific actions: sending an email, cancelling unorchestrated items, etc. These actions are not configurable in the DIY backoffice interface.

When the entire order has been captured, the orchestrator pauses for that order. If the order is then unclaimed, the orchestrator takes over and checks if the timeout of the rule that was running has been exceeded (by counting the total time between the entry in the rule and the time the order was left). If this time is exceeded, the orchestrator moves on to the next rule and will then start counting down the time for that rule.

Rules calendars

The Rules Calendars section is located at the top right of the orchestration page. This section allows to define the time slots during which the orchestration rules will run.

On the first page you can see the list of existing calendars. By clicking on one of them, you can see a weekly view of the calendar. You have the possibility to add or modify any time slot. You can also create a new calendar from scratch after defining its name and timezone.

 

Our recommendations:

You should create at least 1 timetable for your stores, and 1 timetable for your warehouses:

  • Stores: The calendar should be as close as possible to the store's opening hours, for e.g. Monday to Saturday - 9.00am to 8.00pm. This avoids that the rules are scrolled during the night, which would be unproductive because the salespeople in stores cannot claim them.

  • Warehouses: If the orchestration rules doesn’t allow warehouses to claim automatically, then you should create an active calendar 7 days a week, 24 hours a day. When the rule is executed, the order will be directly assigned to the warehouse regardless of the time.

If you manage several countries with different time zones, you should create at least 1 calendar per country.

Ruleset stock requests

Stock is retrieved during orchestration at a unified and detailed level. Unified stock is checked before each orchestration attempt, if no stock is available, out of stock lines are transitioned to the set out of stock state and remaining lines are orchestrated. Once unified stock has been checked, detailed stock is retrieved.

Setting stock requests

Requests can be set per ruleset.

Unified stock

Stock location filtering

Unified stock will be retrieved using the unified stock request. In the case of Click & Collect order (order.type contains ckc), the orchestrator will apply a stock location filter to recover only stock of the destination (collection store). As a result, only destination’s stock will be recovered for stock aggregates containing "endpoint_filter.use_requested_ids" : true. During orchestration of other order types, unified stock is recovered without filtering by stock locations.

Item filtering

Also, in some scenarios, stock to be considered in different stock locations is dependant of the dispatch method. A store might be able to ship and fulfil for collect a tea set but in the case of a fridge only be able to fulfil for collect. To answer this type of requirements, we must take advantage of stock requests item filters, by setting an item request. Item request allow to apply filters to items when retrieving their stock. If the item does not match the filters, it’s stock won’t be returned.

  • item_filter.use_requested_ids : true

Detailed stock

Detailed stock will be retrieved using the detailed stock request. Considered stock locations are those which match the rule filters and have the ship from store module active (ffs). In the case of a click & collect order, the destination is also considered.

Default stock requests

By default, the orchestrator uses the requests named "detailed" and "unified". The "default" value triggers the use of this requests.

 

Automatic re-orchestration upon available stock

Out of stock lines can be automatically re-orchestrated once stock becomes available. All stock changes are monitored (imports by API and file, cancelled reservations, cancelled dispositions, etc). Stock will be consideres as available if the stock becomes greater than 0 when requesting stock with the unified request of the order's current orchestration ruleset.

For a line item to be automatically reorchestrated, it must be in an out-of-stock destination state and the order must be flagged as auto orchestrable (order field on_available_stock.auto_orchestrable :  true).

The workflow must contain the following transition for auto orchestration upon available stock to work

not_in_stock: transitions: global_reservation_attempt: # Can either be triggered manually or when stock becomes available if the order is auto-orchestrable actions_after: - type: update_reserved_stock # Increase the reserved stock parameters: creation: true - type: update_line_items_state global_reservation_attempt: transitions: not_in_stock: # Returns to not_in_stock auto: true conditions: - type: "!has_global_reservation" # If the stock increase has failed placed: auto: true conditions: - type: "has_global_reservation" # If the reserved stock is ok actions_after: - type: orchestrate # We can reorchestrate