lumnik. / scenarios All scenarios · Français

Auditing how long orders stay in each status

Goal Know how long each order stays in each status, and which ones stop moving.

The ERP keeps only today's status: In progress yesterday, Delivered today. Nothing on the wait in between. The ERP cannot be changed.

orders-night1.csv
order_id;customer;agency;status
C-01;CLI-003;Lyon;Saisie
C-02;CLI-004;Grenoble;SAI
C-03;CLI-005;Valence;En cours
C-04;CLI-006;Lyon;EC
C-05;CLI-007;Grenoble;encours
C-06;CLI-008;Valence;EN COURS
C-07;CLI-009;Lyon;Livrée
C-08;CLI-010;Grenoble;EN ATT
C-09;CLI-011;Valence;EN ATT
C-10;CLI-012;Lyon;Saisie
C-11;CLI-013;Grenoble;EC
C-12;CLI-014;Valence;Annulée
manifests/20-order-watch.yaml
apiVersion: apps.lumnik.io/v1kind: Workflowmetadata:  name: scenario-order-sleep-dspec:  scope: order-desk  provenance: declared  on:    table: connector.t_scenario_sleep_orders_d    column: status    key: order_id  dormancy:    after: 25m  states:    - code: SAISIE      label: "Saisie"      aliases: ["SAI"]      initial: true    - code: EN_COURS      label: "En cours"      aliases: ["En cours", "encours", "EC"]    - code: LIVREE      label: "Livrée"      aliases: ["Livrée", "Livré", "LIV"]      terminal: true    - code: ANNULEE      label: "Annulée"      aliases: ["Annulée", "ANNUL"]      terminal: true
orders-night2.csv
order_id;customer;agency;status
C-01;CLI-003;Lyon;En cours
C-02;CLI-004;Grenoble;SAI
C-03;CLI-005;Valence;Livrée
C-04;CLI-006;Lyon;LIV
C-05;CLI-007;Grenoble;encours
C-06;CLI-008;Valence;EN COURS
C-07;CLI-009;Lyon;Livrée
C-08;CLI-010;Grenoble;EN ATT
C-09;CLI-011;Valence;EN ATT
C-10;CLI-012;Lyon;EC
C-11;CLI-013;Grenoble;EC
C-12;CLI-014;Valence;Annulée
orders-night3.csv
order_id;customer;agency;status
C-01;CLI-003;Lyon;Livrée
C-02;CLI-004;Grenoble;ANNUL
C-03;CLI-005;Valence;Livrée
C-04;CLI-006;Lyon;LIV
C-05;CLI-007;Grenoble;Livré
C-06;CLI-008;Valence;EN COURS
C-07;CLI-009;Lyon;Livrée
C-08;CLI-010;Grenoble;EN ATT
C-09;CLI-011;Valence;EN ATT
C-10;CLI-012;Lyon;EC
C-11;CLI-013;Grenoble;EC
C-12;CLI-014;Valence;Annulée
$ lm observations list --workflow scenario-order-sleep-e
WORKFLOW                DOC   STATE     SINCE             ALERTED
scenario-order-sleep-e  C-06  EN_COURS  2026-10-28 21:31  2026-10-28 22:01
scenario-order-sleep-e  C-07  LIVREE    2026-10-28 21:31  
scenario-order-sleep-e  C-08  EN ATT    2026-10-28 21:31  2026-10-28 22:01
scenario-order-sleep-e  C-09  EN ATT    2026-10-28 21:31  2026-10-28 22:01
scenario-order-sleep-e  C-11  EN_COURS  2026-10-28 21:31  2026-10-28 22:01
scenario-order-sleep-e  C-12  ANNULEE   2026-10-28 21:31  
scenario-order-sleep-e  C-03  LIVREE    2026-10-28 21:46  
scenario-order-sleep-e  C-04  LIVREE    2026-10-28 21:46  
scenario-order-sleep-e  C-10  EN_COURS  2026-10-28 21:46  
scenario-order-sleep-e  C-01  LIVREE    2026-10-28 22:01  
scenario-order-sleep-e  C-02  ANNULEE   2026-10-28 22:01  
scenario-order-sleep-e  C-05  LIVREE    2026-10-28 22:01  

$ lm inbox --process workflow:scenario-order-sleep-e
ID     WHEN      PROCESS                          MESSAGE                                                                                                                               ENTITY_KEY
20332  just now  workflow:scenario-order-sleep-e  C-11: observed unmoved in "EN_COURS" since 2026-10-28 (first observed 2026-10-28) — declared threshold 25m in scenario-order-sleep-e  C-11
20331  just now  workflow:scenario-order-sleep-e  C-09: observed unmoved in "EN ATT" since 2026-10-28 (first observed 2026-10-28) — declared threshold 25m in scenario-order-sleep-e    C-09
20330  just now  workflow:scenario-order-sleep-e  C-08: observed unmoved in "EN ATT" since 2026-10-28 (first observed 2026-10-28) — declared threshold 25m in scenario-order-sleep-e    C-08
20329  just now  workflow:scenario-order-sleep-e  C-06: observed unmoved in "EN_COURS" since 2026-10-28 (first observed 2026-10-28) — declared threshold 25m in scenario-order-sleep-e  C-06
manifests/30-order-watch-en-att.yaml
apiVersion: apps.lumnik.io/v1kind: Workflowmetadata:  name: scenario-order-sleep-dspec:  scope: order-desk  provenance: declared  on:    table: connector.t_scenario_sleep_orders_d    column: status    key: order_id  dormancy:    after: 25m  states:    - code: SAISIE      label: "Saisie"      aliases: ["SAI"]      initial: true    - code: EN_COURS      label: "En cours"      aliases: ["En cours", "encours", "EC", "EN ATT"]    - code: LIVREE      label: "Livrée"      aliases: ["Livrée", "Livré", "LIV"]      terminal: true    - code: ANNULEE      label: "Annulée"      aliases: ["Annulée", "ANNUL"]      terminal: true
$ lm observations transitions --workflow scenario-order-sleep-e
WORKFLOW                DOC   FROM      TO        ENTERED           OBSERVED          IN_FROM_S
scenario-order-sleep-e  C-05  EN_COURS  LIVREE    2026-10-28 21:31  2026-10-28 22:01  1799
scenario-order-sleep-e  C-02  SAISIE    ANNULEE   2026-10-28 21:31  2026-10-28 22:01  1799
scenario-order-sleep-e  C-01  EN_COURS  LIVREE    2026-10-28 21:46  2026-10-28 22:01  899
scenario-order-sleep-e  C-10  SAISIE    EN_COURS  2026-10-28 21:31  2026-10-28 21:46  899
scenario-order-sleep-e  C-04  EN_COURS  LIVREE    2026-10-28 21:31  2026-10-28 21:46  899
scenario-order-sleep-e  C-03  EN_COURS  LIVREE    2026-10-28 21:31  2026-10-28 21:46  899
scenario-order-sleep-e  C-01  SAISIE    EN_COURS  2026-10-28 21:31  2026-10-28 21:46  899

Limits

  • Moves seen at the sweep's pace: a duration is a multiple of the tick, and two moves between two ticks show as one.
  • For an order's first move, the time counts from its first observation: a lower bound.
  • The replay compresses nights into 15-minute ticks. Durations are minutes.
  • Synthetic data.

Orders · ERP

An order drags on. In which state?

The ERP keeps only today's status.

In progress yesterday, Delivered today. Nothing on the wait in between.

Fictional orders · synthetic data

The problem

The status has no history.

  • Tonight's export replaces yesterday's.
  • The time spent in a state is lost.
  • The ERP cannot be changed.

Nothing is changed

lumnik compares each night with the previous one.

  • Each order is followed by its number.
  • Each status change enters a journal, dated.
  • Nothing is written to the ERP.

What had to be written

key: order_id
dormancy:
  after: 25m

One order followed, one alert if it stops moving.

The whole scenario fits in 3 declaration files, 73 lines.

The journal

7 moves, each with its waiting time.

  • C-01: entered, then in progress, then delivered.
  • C-02: cancelled.
  • Each line gives the time spent in the state left.

Real values, replay of 28 October 2026.

The orders that stand still

4 orders did not move. They alert.

  • C-06, C-08, C-09, C-11.
  • One alert per stall, not at every tick.

The business decides

EN ATT means in progress. It is not a move.

  • The business declares EN ATT as an alias.
  • C-08 and C-09 are renamed.
  • Their clock and their alert stay.

Try it

The scenario replays end to end.

Three nights, a declaration, the journal: each step is published with its output.

This scenario runs on lumnik Open, free and open source.

Try lumnik Open →