Skip to content

SLA Detection

Identifies sessions where food or drink delivery exceeded acceptable thresholds, and collects the specific items from the first order that were delayed.


Thresholds

Category Metric Used SLA Threshold Default
Food M-11 (food_delivery_from_first_main_dish_order_seconds) > 1200s 20 minutes
Drink M-10 (drink_delivery_from_first_drink_order_seconds) > 480s 8 minutes

Comparison: Strict greater-than. A value exactly at the threshold is NOT a delay.

Thresholds are configurable via MetricsSettings:

SESSION_METRICS_FOOD_DELIVERY_SLA_SECONDS=1200
SESSION_METRICS_DRINK_DELIVERY_SLA_SECONDS=480


Decision Logic

flowchart TD
    A["M-11: food delivery from<br/>first main dish order"] --> B{"M-11 > 1200s?"}
    B -->|Yes| C["FOOD DELAY"]
    B -->|No| D["No food delay"]
    C --> E["Collect first-order<br/>main_plate item names"]

    F["M-10: drink delivery from<br/>first drink order"] --> G{"M-10 > 480s?"}
    G -->|Yes| H["DRINK DELAY"]
    G -->|No| I["No drink delay"]
    H --> J["Collect first-order<br/>drink item names"]

First-Order Items Only

When a delay is detected, only items from the first order of that category are listed. This matches the metric's reference point (M-10 measures from the first drink order, M-11 from the first main dish order).

"First order" = all items sharing the minimum timestamp for that category:

Items: [
  {name: "Beer",    category: "drink", timestamp: "10:00"},
  {name: "Wine",    category: "drink", timestamp: "10:00"},
  {name: "Cocktail", category: "drink", timestamp: "11:30"}
]

First drink order items: ["Beer", "Wine"]  (both at 10:00)

Output Fields

Field Type Description
delayed_food_items list[str] Names of main_plate items from first order. Empty list if no delay.
delayed_drink_items list[str] Names of drink items from first order. Empty list if no delay.

Metrics NOT Used for Delay Detection

Only M-10 and M-11 are used. Other delivery metrics are not checked:

  • M-7 (food_delivery_from_first_pos_item_seconds) — reference point is first item of ANY category, not specific
  • M-9 (drink_delivery_from_first_pos_item_seconds) — same reason
  • M-3 (time_from_session_start_to_drink_arrival_seconds) — measures from annotation, not POS order
  • M-12, M-13 — from order-taken annotation, not POS timestamp

The rationale: M-10 and M-11 measure from the exact moment the POS system registered the specific category order, giving the most accurate delivery time.