About the research
Interactive demo · MSc research method

Late-order early warning

Measure the wait. Explain the delay. Predict the risk. Warn early.

The method of my MSc thesis, run end to end on synthetic order data. Every chart below reads one export from tested Python code.

Synthetic data for a fictional company. These are not thesis results.

111 tests passingpytest, last run 22 November 2026Northwind Assembly is a made-up configure-to-order equipment maker: it builds each product from options the customer picks. Its ⁦6,091⁩ order lines from ⁦2018⁩ to ⁦2024⁩ come from a seeded generator, with patterns planted on purpose.

Measure: where does the time go?

Five stages from order date to full delivery. The solid bar is the median. The light bar runs on to P90, the slowest one in ten.

Synthetic data

  • Order handling and engineering164669%Median 16 days, P90 46 days, Share of spread 69%
  • Planning361%Median 3 days, P90 6 days, Share of spread 1%
  • Production queue112619%Median 11 days, P90 26 days, Share of spread 19%
  • Production13229%Median 13 days, P90 22 days, Share of spread 9%
  • Post-production6111%Median 6 days, P90 11 days, Share of spread 1%

The customer’s wait, by configuration

Median wait from order to delivery, against the median promised interval.

  • Standard⁦61%⁩ on timeWait 47Promised 51
  • Modified⁦47%⁩ on timeWait 61Promised 59
  • Engineered⁦24%⁩ on timeWait 83Promised 63

Explain: which stages cause the delay?

Excess late days are the days a stage ran past its usual length, on lines that arrived late. Sorted from most to least, as a Pareto chart: a few causes usually carry most of the effect.

Synthetic data

⁦2⁩ stages carry ⁦80%⁩ of the excess late days.

  1. Order handling and engineering54%Running total 54%
  2. Production queue26%Running total 80%
  3. Production11%Running total 91%
  4. Post-production6%Running total 97%
  5. Planning3%Running total 100%

Reliability: is the promise kept?

The first promised date against the day the line was fully delivered.

Synthetic data

50.7%On time against the first promise
15Median days late, when late
51P90 days late, when late

Days early or late against the first promise

15+ early1,100, 18.1%
8 to 14 early1,001, 16.4%
0 to 7 early986, 16.2%
1 to 7 late808, 13.3%
8 to 14 late647, 10.6%
15 to 30 late846, 13.9%
31 to 60 late506, 8.3%
60+ late197, 3.2%

The promise against the customer’s wait

  • Standard tableClearance to ex-factory46
  • Promised intervalOrder date to first promise56
  • Customer waitOrder date to delivery, median and P90Median 55P90 93

⁦49%⁩ of lines waited longer than promised.

Every date change is a warning sign

Date changesLinesLateMedian days late
02,7000%−10
11,82880%+6
276597%+18
3798100%+36

Predict: enter an order

The decision tree sees only what is known on the day the order is entered. Change the order and watch it walk the tree.

Synthetic data

New order

Configuration

The tree uses the configuration, the order month, the factory load and the standard days. Family and item group set the standard days. Quantity and lines are here for realism: the tree does not use them, and the random forest uses them only a little.

Late risk82%High
Late risk82%HighAbove the ⁦50%⁩ alert line. The agent would flag it.
Typical wait for orders like thisMean of ⁦596⁩ training lines in this leaf, order date to delivery79 days
Standard-table promise⁦57⁩ standard days plus ⁦5⁩ dispatch days, counted from clearance62 days

The two clocks start on different days. The table starts at clearance, after order handling. The customer counts from the order date.

The path through the tree

The whole tree: 31 nodes, 16 leaves. The lit line is this order’s path.
  1. Question 1: Factory load at or below ⁦1.04⁩?No50% → 68%
  2. Question 2: Ordered outside the peak months, March to June?No68% → 75%
  3. Question 3: Configuration is Standard?No75% → 85%
  4. Question 4: Configuration is Modified?Yes85% → 82%
  5. Leaf ⁦27⁩: ⁦596⁩ training lines, ⁦82%⁩ of them late.

What drives the prediction

Forest, late risk

  • Factory load32%
  • Peak season18%
  • Configuration16%
  • Order month13%
  • Standard days5%
  • Quantity4%
  • Lines on the order4%
  • Item group4%
  • Product family3%

Forest, delivery days

  • Configuration40%
  • Factory load22%
  • Peak season13%
  • Standard days6%
  • Order month6%
  • Lines on the order4%
  • Quantity4%
  • Item group3%
  • Product family3%

Tree, late risk

  • Factory load62%
  • Configuration22%
  • Peak season10%
  • Standard days6%
  • Order month0%
  • Product family0%
  • Item group0%
  • Quantity0%
  • Lines on the order0%

Tree, forest and today’s promise

Tested on ⁦2023⁩ to ⁦2024⁩ orders the models never saw: ⁦1,818⁩ lines.

MeasureDecision treeRandom forestStandard-table promise
Precision: share of alerts that were really late0.690.730.00
Recall: share of late lines that got an alert0.690.690.00
ROC area: 0.5 is a coin toss, 1.0 is perfect0.780.800.50
Mean error, delivery days13.513.216.2

The promise rule never predicts a late line, so beating it on late risk is a low bar. Tree against forest is the useful comparison.

Warn: replay 2024

The agent wakes each morning, sees only what was on file that day, and flags lines likely to be late. Press play to replay the year.

Synthetic data

⁦40⁩ of ⁦40⁩ sample alerts so far

Template-generated. In the study, an LLM phrases these messages from the same scores.

  1. 30 Dec 2024MCS-24-0341/4Late risk at entry 9%

    Order MCS-24-0341 line 4 may slip. Engineering has held it 1.5x longer than usual. Late risk at entry was 9%.

    Now in: Order handling and engineering18 days in stage⁦1.5⁩x usual

    What happened: On time, 7 days early

  2. 17 Dec 2024MCS-24-0306/1Late risk at entry 9%

    Order MCS-24-0306 may slip. Production has held it 1.5x longer than usual. Late risk at entry was 9%.

    Now in: Production21 days in stage⁦1.5⁩x usual

    What happened: On time, 15 days early

  3. 4 Dec 2024MCS-24-0316/2Late risk at entry 17%

    Order MCS-24-0316 line 2 may slip. Engineering has held it 1.5x longer than usual. Late risk at entry was 17%.

    Now in: Order handling and engineering18 days in stage⁦1.5⁩x usual

    What happened: On time, on the promised day

  4. 14 Nov 2024MCS-24-0301/3Late risk at entry 9%

    Order MCS-24-0301 line 3 may slip. Engineering has held it 1.5x longer than usual. Late risk at entry was 9%.

    Now in: Order handling and engineering18 days in stage⁦1.5⁩x usual

    What happened: On time, 1 day early

  5. 15 Oct 2024MCS-24-0291/3Late risk at entry 17%

    Order MCS-24-0291 line 3 may slip. Planning has held it 1.7x longer than usual. Late risk at entry was 17%.

    Now in: Planning5 days in stage⁦1.7⁩x usual

    What happened: On time, 25 days early

  6. 14 Oct 2024MCS-24-0294/2Late risk at entry 81%

    Order MCS-24-0294 line 2 is likely late. No stage is overdue yet. Late risk at entry is 81% because configuration is Engineered and factory load is above 0.81.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 42 days late

  7. 20 Sep 2024MCS-24-0255/2Late risk at entry 23%

    Order MCS-24-0255 line 2 is already 2 days past its first promised date. Post-production has held it 1.5x longer than usual. Late risk at entry was 23%.

    Now in: Post-production9 days in stage⁦1.5⁩x usual

    What happened: Arrived 8 days late

  8. 4 Sep 2024MCS-24-0264/1Late risk at entry 23%

    Order MCS-24-0264 may slip. Engineering has held it 1.5x longer than usual. Late risk at entry was 23%.

    Now in: Order handling and engineering18 days in stage⁦1.5⁩x usual

    What happened: Arrived 10 days late

  9. 20 Aug 2024MCS-24-0254/3Late risk at entry 38%

    Order MCS-24-0254 line 3 may slip. Planning has held it 1.7x longer than usual. Late risk at entry was 38%.

    Now in: Planning5 days in stage⁦1.7⁩x usual

    What happened: On time, 13 days early

  10. 4 Aug 2024MCS-24-0235/1Late risk at entry 23%

    Order MCS-24-0235 may slip. Planning has held it 1.7x longer than usual. Late risk at entry was 23%.

    Now in: Planning5 days in stage⁦1.7⁩x usual

    What happened: Arrived 1 day late

  11. 16 Jul 2024MCS-24-0234/3Late risk at entry 69%

    Order MCS-24-0234 line 3 is likely late. No stage is overdue yet. Late risk at entry is 69% because configuration is Engineered and factory load is above 0.81.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 34 days late

  12. 24 Jun 2024MCS-24-0213/1Late risk at entry 56%

    Order MCS-24-0213 is likely late. No stage is overdue yet. Late risk at entry is 56% because factory load is above 1.04 and entered in a peak month.

    Now in: Order handling and engineeringEntered this stage today

    What happened: On time, 9 days early

  13. 18 Jun 2024MCS-24-0205/1Late risk at entry 82%

    Order MCS-24-0205 is likely late. No stage is overdue yet. Late risk at entry is 82% because factory load is above 1.04 and configuration is not Standard.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 49 days late

  14. 9 Jun 2024MCS-24-0193/2Late risk at entry 82%

    Order MCS-24-0193 line 2 is likely late. No stage is overdue yet. Late risk at entry is 82% because factory load is above 1.04 and configuration is not Standard.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 34 days late

  15. 3 Jun 2024MCS-24-0183/1Late risk at entry 80%

    Order MCS-24-0183 is likely late. No stage is overdue yet. Late risk at entry is 80% because factory load is above 1.04 and standard-table time is 37 days or less.

    Now in: Order handling and engineeringEntered this stage today

    What happened: On time, 1 day early

  16. 28 May 2024MCS-24-0174/3Late risk at entry 56%

    Order MCS-24-0174 line 3 is likely late. No stage is overdue yet. Late risk at entry is 56% because factory load is above 1.04 and entered in a peak month.

    Now in: Order handling and engineeringEntered this stage today

    What happened: On time, 6 days early

  17. 18 May 2024MCS-24-0165/4Late risk at entry 82%

    Order MCS-24-0165 line 4 is likely late. No stage is overdue yet. Late risk at entry is 82% because factory load is above 1.04 and configuration is not Standard.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 8 days late

  18. 14 May 2024MCS-24-0158/1Late risk at entry 80%

    Order MCS-24-0158 is likely late. No stage is overdue yet. Late risk at entry is 80% because factory load is above 1.04 and standard-table time is 37 days or less.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 7 days late

  19. 5 May 2024MCS-24-0149/2Late risk at entry 56%

    Order MCS-24-0149 line 2 is likely late. No stage is overdue yet. Late risk at entry is 56% because factory load is above 1.04 and entered in a peak month.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 4 days late

  20. 23 Apr 2024MCS-24-0136/2Late risk at entry 56%

    Order MCS-24-0136 line 2 is likely late. No stage is overdue yet. Late risk at entry is 56% because factory load is above 1.04 and entered in a peak month.

    Now in: Order handling and engineeringEntered this stage today

    What happened: On time, 1 day early

  21. 15 Apr 2024MCS-24-0029/1Late risk at entry 41%

    Order MCS-24-0029 is already 6 days past its first promised date. Post-production has held it 1.5x longer than usual. Late risk at entry was 41%.

    Now in: Post-production9 days in stage⁦1.5⁩x usual

    What happened: Arrived 8 days late

  22. 14 Apr 2024MCS-24-0125/1Late risk at entry 56%

    Order MCS-24-0125 is likely late. No stage is overdue yet. Late risk at entry is 56% because factory load is above 1.04 and entered in a peak month.

    Now in: Order handling and engineeringEntered this stage today

    What happened: On time, 2 days early

  23. 8 Apr 2024MCS-24-0116/1Late risk at entry 82%

    Order MCS-24-0116 is likely late. No stage is overdue yet. Late risk at entry is 82% because factory load is above 1.04 and configuration is not Standard.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 44 days late

  24. 6 Apr 2024MCS-24-0110/1Late risk at entry 80%

    Order MCS-24-0110 is likely late. No stage is overdue yet. Late risk at entry is 80% because factory load is above 1.04 and standard-table time is 37 days or less.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 20 days late

  25. 31 Mar 2024MCS-24-0052/3Late risk at entry 41%

    Order MCS-24-0052 line 3 may slip. Post-production has held it 1.5x longer than usual. Late risk at entry was 41%.

    Now in: Post-production9 days in stage⁦1.5⁩x usual

    What happened: On time, 12 days early

  26. 23 Mar 2024MCS-24-0097/1Late risk at entry 80%

    Order MCS-24-0097 is likely late. No stage is overdue yet. Late risk at entry is 80% because factory load is above 1.04 and standard-table time is 37 days or less.

    Now in: Order handling and engineeringEntered this stage today

    What happened: On time, 2 days early

  27. 22 Mar 2024MCS-24-0050/3Late risk at entry 41%

    Order MCS-24-0050 line 3 may slip. The production queue has held it 1.7x longer than usual. Late risk at entry was 41%.

    Now in: Production queue19 days in stage⁦1.7⁩x usual

    What happened: Arrived 26 days late

  28. 13 Mar 2024MCS-24-0064/3Late risk at entry 41%

    Order MCS-24-0064 line 3 may slip. Planning has held it 1.7x longer than usual. Late risk at entry was 41%.

    Now in: Planning5 days in stage⁦1.7⁩x usual

    What happened: Arrived 9 days late

  29. 12 Mar 2024MCS-24-0089/1Late risk at entry 80%

    Order MCS-24-0089 is likely late. No stage is overdue yet. Late risk at entry is 80% because factory load is above 1.04 and standard-table time is 37 days or less.

    Now in: Order handling and engineeringEntered this stage today

    What happened: On time, 3 days early

  30. 8 Mar 2024MCS-24-0079/2Late risk at entry 82%

    Order MCS-24-0079 line 2 is likely late. No stage is overdue yet. Late risk at entry is 82% because factory load is above 1.04 and configuration is not Standard.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 55 days late

  31. 8 Mar 2024MCS-24-0034/1Late risk at entry 41%

    Order MCS-24-0034 may slip. Engineering has held it 1.5x longer than usual. Late risk at entry was 41%.

    Now in: Order handling and engineering34 days in stage⁦1.6⁩x usual

    What happened: Arrived 44 days late

  32. 3 Mar 2024MCS-24-0071/2Late risk at entry 80%

    Order MCS-24-0071 line 2 is likely late. No stage is overdue yet. Late risk at entry is 80% because factory load is above 1.04 and standard-table time is 37 days or less.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 20 days late

  33. 28 Feb 2024MCS-24-0012/2Late risk at entry 23%

    Order MCS-24-0012 line 2 may slip. Post-production has held it 1.5x longer than usual. Late risk at entry was 23%.

    Now in: Post-production9 days in stage⁦1.5⁩x usual

    What happened: Arrived 3 days late

  34. 15 Feb 2024MCS-24-0023/2Late risk at entry 41%

    Order MCS-24-0023 line 2 may slip. Planning has held it 1.7x longer than usual. Late risk at entry was 41%.

    Now in: Planning5 days in stage⁦1.7⁩x usual

    What happened: On time, 11 days early

  35. 13 Feb 2024MCS-24-0045/2Late risk at entry 69%

    Order MCS-24-0045 line 2 is likely late. No stage is overdue yet. Late risk at entry is 69% because configuration is Engineered and factory load is above 1.04.

    Now in: Order handling and engineeringEntered this stage today

    What happened: Arrived 29 days late

  36. 6 Feb 2024MCS-24-0004/2Late risk at entry 17%

    Order MCS-24-0004 line 2 may slip. Production has held it 1.5x longer than usual. Late risk at entry was 17%.

    Now in: Production17 days in stage⁦1.6⁩x usual

    What happened: On time, 7 days early

  37. 27 Jan 2024MCS-23-0304/1Late risk at entry 9%

    Order MCS-23-0304 is already 2 days past its first promised date. Post-production has held it 1.5x longer than usual. Late risk at entry was 9%.

    Now in: Post-production9 days in stage⁦1.5⁩x usual

    What happened: Arrived 9 days late

  38. 12 Jan 2024MCS-23-0311/1Late risk at entry 9%

    Order MCS-23-0311 may slip. Post-production has held it 1.5x longer than usual. Late risk at entry was 9%.

    Now in: Post-production9 days in stage⁦1.5⁩x usual

    What happened: On time, 12 days early

  39. 1 Jan 2024MCS-23-0290/3Late risk at entry 81%

    Order MCS-23-0290 line 3 is already 8 days past its first promised date. Engineering has held it 1.7x longer than usual. Late risk at entry is 81% because configuration is Engineered and factory load is above 0.81.

    Now in: Order handling and engineering68 days in stage⁦1.7⁩x usual

    What happened: Arrived 48 days late

  40. 1 Jan 2024MCS-23-0191/1Late risk at entry 94%

    Order MCS-23-0191 is already 129 days past its first promised date. No stage is overdue yet. Late risk at entry is 94% because factory load is above 1.04 and configuration is not Standard.

    Now in: Production12 days in stage

    What happened: Arrived 137 days late

What-if: two levers

A Monte Carlo simulation reruns every synthetic line many times with random draws, with one change. Pick a lever and a level.

Synthetic data

On time51.4%Baseline ⁦51.4%⁩
Median wait55 daysBaseline ⁦55 days⁩
P90 wait92 daysBaseline ⁦92 days⁩
Late lines saved per year0Peak capacity

Checked first: the simulated baseline gives ⁦51.4%⁩ on time against ⁦50.7%⁩ in the synthetic data, and a median of ⁦55⁩ days against ⁦55⁩.

Monte Carlo with common random numbers: every scenario reuses the same random draws, so a difference comes from the change alone. 5 runs of every line per scenario. Direction and rough size only, not cost.

How this demo is built

  • Seeded generatorAbout 6,000 synthetic order lines with planted patterns. The same seed gives the same numbers.
  • Python and scikit-learnStage analysis, a depth-4 tree and a random forest, an agent replay and a simulation. Covered by pytest.
  • One export, walked hereThe page reads one JSON export. Your browser walks the same tree the Python code trained.

Honest limits: the models find the patterns because the generator planted them. This shows the method works end to end. It does not show what the real data will say.