Tool · built by Consigliere · November 8, 2026
Supplier notice triage
Reads a supplier delay notice, sorts it as slip, short, quality or on track, and checks any revised date against the need date. Sample data, in the browser.
His notes on this demo
# Supplier notice triage (portfolio demo)
**Goal (one sentence):** read a supplier's delay, shortage or quality notice, name what kind of
problem it is, pull out the new promised date, and say how many days that date sits past the date
the line needs the goods, all in the browser with no model call.
## What it shows
Supply chain: a buyer gets a stream of supplier emails and has to sort them into "late",
"short", "on hold" and "on track" (the code labels are `slip`, `short`, `quality` and `on_track`),
then check each late one against the date the line needs.
AI: a naive Bayes text classifier (classical machine learning, not an LLM) learns which words
go with which kind of notice from 32 labeled examples, eight per label. A fixed rule reads the
date. The page shows the classifier's confidence, and a call under 0.6 goes to a person as
"REVIEW" rather than being trusted.
The page scores itself on 12 holdout notices the model never trained on. The first run got 10 of
12 labels right. The two misses are H1 ("the machining cell needs repair so completion slides to
December 4"), read as quality at 0.32, and H6 ("Half the order will go out now. The other half
needs more stock from our supplier."), read as on track at 0.46. H5 was right (short) at 0.54.
H1, H5 and H6 are under the 0.6 bar, so the page shows REVIEW on each rather than a verdict.
H10, H11 and H12 are on-track notices with no readable date. They clear the bar, but the page
shows REVIEW on them ("on track, but no readable date to check") instead of a silent OK. So six
of the 12 show REVIEW, and the other six (H2, H3, H4, H7, H8, H9) clear the bar and do not. I did
not tune the model to remove the misses, because tuning on that list would make the score
meaningless.
## How to open it
Open `index.html` in any browser (double-click the file). No server, no build, no network.
`model.js` and `sample-data.js` must sit beside it. Paste a notice into the box, pick the PO it
answers, and press Read notice. The year box sets the year for a date written without one, such as
"Nov 24". It is not the year of the need date: a PO that needs January 2027, with the box at 2026,
reads "Jan 5" as 2026-01-05.
The date rule reads the last date-like token in the notice, and that token decides even when it
cannot be read. It reads three forms: month first ("Nov 24", "Nov 24th", "December 3"), day first
("24 Nov", "3rd December"), and ISO ("2026-11-24"). A year written after the day ("Nov 24 2027",
"24 Nov 2027") is used; without one, the year box sets it. Because the last one wins, "was due
Nov 10, now 24 Nov" gives 2026-11-24, and "was due Nov 10, now Dec 2" gives Dec 2. The same rule can
also mislead: "new date Dec 4 (was Nov 30)" gives Nov 30, because the old date comes last. An
unreadable newer date gives no date, not the older one before it: "was due Nov 10, now 31 Nov"
gives no date. Numeric dates other than ISO ("24/11/2026", "24-11-2026", "24.11.2026") are not
read, but they are still the newest token, so they give no date either.
Three more cases were found by probing and are not fixed. When an older date comes last, the older
date is read: "Revised ETA 24 Nov, previously 18 Nov, delayed." gives 2026-11-18, which the page
reads as "SLIP, still in time (2 days spare)" against a 20 Nov need. The supplier's revised date is
24 Nov, 4 days late, so this is a wrong verdict. A numeric token after the real date blocks it too:
"Revised ETA Nov 24, see PO 3-11-2026." gives no date. A dotted number with two-digit parts blocks
it: "Revised ETA Nov 24. Shipped 14.30." gives no date, while "Ref 14.30 hrs." does not. A no-date
result fails safe, because the verdict asks the supplier. The 18 Nov case does not fail safe. None
of the three is in the test file.
Dates that do not exist ("Nov 31", "2026-02-30") are unreadable in the same way. A range such as
"24-25 Nov" reads its last day, 25 Nov, and so does "Nov 24-Dec 3", which reads 3 Dec. In "was due
Nov 10, now Nov/24" the month-slash form gives no date, not the older Nov 10. A notice that gives
only a vague time ("late December") gives no date, and the verdict says to ask the supplier.
"May" reads as a month only with a capital M, in both forms: "ETA 24 May" gives 2026-05-24 and
"ETA May 2" gives 2026-05-02. A lower-case "may" is a verb and is not read. So "we may 2 shifts
late" gives no date. The trade-off is in the other direction too: "was due Nov 10, now may 24"
gives 2026-11-10 and says SLIP, still in time (10 days spare), with no warning that a newer date
was not read.
Check: the notice "Regret to advise the order will slip. Vessel rolled to the next sailing,
revised ETA Nov 24." against PO-1001 (need 2026-11-20) should read slip, new date 2026-11-24, and
LATE by 4 days vs need date.
## Tests
The test file `test.mjs` (node only) is kept with the project source, not in this download. It runs
11 test groups against known answers: the sample shape, tokenizing,
training errors, classifying known notices, empty text, the holdout result, two date-rule groups, day counts,
every verdict branch, and one end-to-end notice. The holdout check pins each item, not just the
count: H1, H5 and H6 must show REVIEW, H10, H11 and H12 must show REVIEW for no readable date, and
H1 and H6 must stay misses.
Passing run (exit 0):
```
ok sample: eight training notices per label, twelve holdout, five POs
ok tokens: lower-case words, no digits, no stop words
ok train rejects empty input, an unknown label and a missing label
ok classify: known notices get their known label, with probabilities summing to 1
ok classify: text with no words gives no label, not the most common class
H1 want slip got quality (0.32)
H2 want slip got slip (0.78)
H3 want slip got slip (0.97)
H4 want short got short (0.94)
H5 want short got short (0.54)
H6 want short got on_track (0.46)
H7 want quality got quality (0.87)
H8 want quality got quality (0.68)
H9 want quality got quality (0.96)
H10 want on_track got on_track (0.67)
H11 want on_track got on_track (0.83)
H12 want on_track got on_track (0.63)
ok holdout: first-run result is 10 of 12 labels matched, with the same two misses and six REVIEW verdicts
ok extractDate: ISO, month-day with refYear, last date-like token decides, invalid and vague
ok extractDate: separators, two-part numbers, vague months, and what a unit word does
ok daysBetween: signed whole days
ok verdict: each branch, from fabricated classify results
ok assess: a real notice against its PO, end to end
11 test groups passed
```
Deliberate breaks, each made in a copy of the demo outside the project, with the change confirmed in
the copy before the test ran. The repo's `model.js` was not changed by these runs. Each break went
red (exit 1) in the first test that covers the rule it changes:
- Confidence bar 0.6 changed to 0.5: 5 groups pass, then the holdout test fails on H5 ("H5 should
show REVIEW").
- Confidence bar 0.6 changed to 0.45: the same result.
- Date rule changed to "first valid date wins": 6 pass, then the ISO date test fails (actual
2026-11-10, expected 2026-12-02).
- Month pattern changed to read any word followed by a number as a month: 6 pass, then the ISO date
test fails (actual 2026-09-10, expected null).
- Day-first date pass switched off: 6 pass, then the ISO date test fails (actual 2026-11-10,
expected 2026-11-24).
- Day-first range guard reverted (the lookahead that stops "Nov 24-Dec 3" reading 24 Dec removed):
7 pass, then the separators test fails (actual 2026-12-24, expected 2026-12-03).
- Explicit year ignored (a year after the day is dropped, refYear used; the edit matched 3 places):
6 pass, then the ISO date test fails (actual 2026-11-24, expected 2027-11-24).
- Numeric pass switched off (slash and dash dates not counted): 6 pass, then the ISO date test
fails (actual 2026-11-10, expected null).
- Capital-May month-first pass switched off: 6 pass, then the ISO date test fails (actual
2026-11-10, expected 2026-05-02).
- Dotted-date lookahead reverted (a one-digit pair now counts as a date): 7 pass, then the
separators test fails (actual null, expected 2026-11-24).
- Month-slash null pass switched off (so "Nov/24" falls back to Nov 10): 7 pass, then the separators
test fails (actual 2026-11-10, expected null).
- On-track with no date reverted to a silent OK: 5 pass, then the holdout test fails ("H10 should
show REVIEW for no date").
## Review rounds
### Earlier review round
- The holdout check pinned only the count, so a threshold change could move a verdict with no red
test. It now pins each item, and the holdout test goes red when the bar is 0.5 or 0.45.
- The month pattern matched ordinary words followed by a number: "ship in separate 3 lots" read as
September 3, "junction 4" as June 4, "Mark 3" as March 3. The pattern now needs a month name or a
standard abbreviation before the day number. The test covers all three phrases.
- Day-first and ordinal dates were missed. "was due Nov 10, now 24 Nov" returned Nov 10, with no
warning, and "Nov 24th" was not read at all. The reviewer's case was reproduced by running the
parser before the fix. The day-first form and the ordinal suffix are now read, and the test pins
both.
- An explicit year in the notice ("Nov 24 2027") was ignored and the year box used. It is read now,
in the month-first and day-first forms, and the test pins both.
- An unreadable newer date fell back to an older one before it: "was due 10 Nov, now 31 Nov"
returned Nov 10. The rule now stops at the newest token, so an unreadable one gives no date. The
test pins "31 Nov", "24/11/2026" and "24-11-2026".
- A slash or dash date ("24/11/2026") was not counted, so "was due 10 Nov, now 24/11/2026" returned
Nov 10. The numeric pass now counts it, and the test pins it.
- A day-first "May" ("24 May") was not read, so "was due 10 Nov, now 24 May" returned Nov 10. The
capital form now reads; lowercase "may" stays a verb.
- The year box accepted any number, so a value like -5 was not refused. It now refuses years
outside 1900 to 2999. That check is in `index.html`, and no test covers it, so it is checked by
reading the code, not by a run.
### Round 2, after a probe
- An on-track notice with no readable date was a silent OK. It now shows REVIEW: "on track, but no
readable date to check". The holdout test pins H10, H11 and H12 to that verdict.
- "Revised ETA Nov 24. Short by 3.5." returned no date, because "3.5." was read as a dotted date and
blocked the real one. The dotted pass now needs a day, month and year shape, and the test pins the
notice at 2026-11-24.
- "Material ships Nov 26 as planned, see part 3/4 spec." returned no date, because "3/4" was read as
a numeric date. The numeric pass now needs a full date shape, so a bare fraction is ignored. The
test pins the notice at 2026-11-26.
- "was due Nov 10, we may 2 shifts late" gave 2026-05-02 with "still in time", because "may 2" was
read as May 2. Only a capital "May" reads as a month now. The test pins that notice at 2026-11-10,
and "we may 2 shifts late" alone at no date.
## What it is not
- Not accurate beyond this sample. The 32 training notices and 12 holdout notices are invented.
The 10 of 12 holdout result is a small sample, and a different set of notices could move it a lot.
- Not a live feed. It reads notices you paste; it does not read email or a supplier portal.
- Not a source of supplier names or prices. Every supplier, PO and notice is labeled SAMPLE DATA
on the page.
- Not a claim that the demo "works with" any real supplier's wording.
## What I am unsure of
- Whether the 0.6 confidence bar is right. It is a judgment, not measured against real notices.
- How the model does on notices in other languages or with heavy jargon. It has seen only the
English of the sample.
- The "last date-like token decides" rule is wrong on some real wording. "new date Dec 4 (was Nov 30)"
gives Nov 30, because the old date comes last. The rule is written down so a reader can see the
failure mode.
- A range reads its last day: "24-25 Nov" gives 25 Nov. A notice that means the first day is read
wrong. That is a choice, not a measured result.
- Lower-case "may" is never a month. "was due Nov 10, now may 24" gives Nov 10, with no warning that
a newer date was missed. I read only a capital "May", because "may" is common as a verb. The
cost is that a notice that writes the month in lower case is read as its older date.
- A year-less date takes the year box, not the need date's year, so a January 2027 need with the box
at 2026 reads "Jan 5" as January 2026.
- A bare fraction ("3/4") is ignored, but a number shaped like 14.30. (two digits, a dot, two digits,
then a full stop) blocks the date: "Revised ETA Nov 24. Shipped 14.30." gives no date, while
"Ref 14.30 hrs." does not.
- Three probed date cases are wrong or blank, and are not fixed (see the date section). The worst is
"Revised ETA 24 Nov, previously 18 Nov, delayed.": it reads 18 Nov and says SLIP, still in time
(2 days spare), against a 20 Nov need. The supplier's revised date is 24 Nov, 4 days late.
- The pre-filled notice on the page is training notice 1 with one phrase changed: the page says "the
order" where training notice 1 says "the PO shipment". It reads slip at 100% confident (the raw
score for the pre-fill is 0.99947). So the Check result shows the page on text it was built from, not on a new
notice.
- The short-label training notice was reworded during this build. The holdout results above are from
the wording shipped here.
Page updated Build 961 · 29 Nov 2026 · fa5b278