dsh-canteen-retention-check
Checks a canteen food-retention ledger for the four required record elements, the 125 g minimum, the 48-hour cold-storage window and template placeholders left in a cell.
Install
dsh plugin --profile web add dsh-canteen-retention-check
Sandbox test results
| Stage | Result |
|---|---|
| 1 install | ✓ |
| 2 list | ✓ |
| 3 mount | ✓ |
| 4 boot | — |
Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).
README
dsh-canteen-retention-check — Canteen retention check
[English](README.md) · [简体中文](README-zh.md) · [Español](README-es.md) · [Português](README-pt.md) · [हिन्दी](README-hi.md)
<!-- topblock:v1 -->
What it is — Checks a canteen retention ledger for the four required elements, sample weight, refrigeration time and leftover placeholders.
Who it is for — canteen managers and food-safety officers; no command line required.
What you give it — the source material the check works on (a table, register or document); the original is never modified. Excel can be converted to JSON/YAML first, in chat if the platform supports it.
What it does not do — no compliance verdict, no liability finding, no replacement for the reviewer; differences only.
How to start — search "Safety Compliance Suite" in WorkBuddy / Coze (this check is one part of it; availability as listed); or:
dsh plugin --profile <name> add dsh-canteen-retention-check
<!-- /topblock:v1 -->

dsh-canteen-retention-check checks a canteen food-retention ledger for the four record elements the regulation requires (dish name, weight, time, person), the 125-gram minimum, the 48-hour cold-storage window, and template placeholders left in a cell.
It checks the ledger, not the kitchen. A missing row means the ledger cannot prove a sample was taken; it does not mean no sample was taken.
Install
dsh plugin --profile <name> add dsh-canteen-retention-check dsh --profile <name> --dump-config | grep 'dsh-canteen-retention-check'
What it looks like
Workflow overview: document → rule pack → findings.
Boundary: this only checks the ledger's own completeness and internal time consistency. It does not judge whether a retained sample would satisfy an inspection, whether the food was safe, or what happened in the kitchen. A blank cell is reported as "the ledger does not record it", not as "it did not happen" — the two are different claims and only the first is supportable from a document.
What it answers
- Does every row name the dish, the weight, the time and the person?
- Is each weight at least 125 grams?
- Is the retention time recorded to the minute, and not in the future?
- Was the sample kept at least 48 hours before release?
- Does any cell still hold template text such as
XXXor待填? - Does every dish on the menu have a retained sample? This is the one rule that
needs two ledgers; a single table can check a row's weight, but only a join can
find a dish that has no sample row at all.
Standards it follows
The pack quotes 《学校食品安全与营养健康管理规定》(教育部 国家市场监督管理总局 国家卫生健康委员会令第45号) 第四十条 verbatim:
中小学、幼儿园食堂应当对每餐次加工制作的每种食品成品进行留样,每个品种留样量应当满足检验需要,不得少于125克,并记录留样食品名称、留样量、留样时间、留样人员等。
That single clause supplies the four elements and the 125-gram floor, which is why the pack marks those checks direct and caps them at error. The 48-hour window is checked as a day gap and is labelled as such, not as a quotation of a clause it does not appear in.
Compatibility
Surface · Status
Harness · peer range >=0.1.2-rc.1 <0.2.0 \ · \ · >=0.2.0-0 <0.3.0
Node · ^22.19.0 · · >=24.0.0
Platforms · all (pure ESM; no native code, no network, no model call)
What it does
Nine rules, all single-table checks over the ledger:
Rule · Check
CF-001 · Dish name present
CF-002 · Weight ≥ 125 g
CF-003 · Sample time present
CF-004 · Sample person present
CF-005 · Sample time written to the minute
CF-006 · Release at least 2 days after sampling
CF-007 · Meal present
CF-008 · No template placeholder in the dish name
CF-009 · Sample time not in the future
A column that is absent from the ledger entirely is reported as "not applicable" rather than as a violation of every row: a sheet without a 留样量 column is a shape problem, and saying "every row is wrong" would bury it.
Configuration
Key · Default · Meaning
rulesFile · rules/canteen-retention-check.yaml · 规则库路径
Material format
One row per retained sample:
Column · Meaning
餐次 · Meal: 早餐 / 午餐 / 晚餐
留样食品名称 · Dish name
留样量 · Weight in grams
留样时间 · Sampling time, YYYY-MM-DD HH:MM
出柜时间 · Release time, same format
留样人员 · Person who retained the sample
Column aliases are declared in src/model.ts, so 品名, 留样重量, 留样人 and English names also resolve.
Rule sources
Quotations live in rules/evidence/clause-verification-school-food-safety.md and in the pack itself; check:citations verifies each appears verbatim.
Known limit: the 48-hour window is compared as whole days (dateGap, minDays: 2), so a sample released at 47 hours on the second day is not distinguished from one released at 49 hours. Tightening that needs an hour-level check, which the current engine kind does not provide.
Troubleshooting
- The plugin installs but the tool never appears: check that
mainresolves tolib/index.mjsand thatpnpm run buildproduced it. dsh plugin addrejects the package: the peer range covers0.1.xand0.2.x; outside it, grant an explicit exemption.- A rule did not run: read the
skippedarray.
Development
pnpm install pnpm run typecheck pnpm test pnpm run build node ../scripts/sync-shared.mjs dsh-canteen-retention-check
PerryLink DSH Plugin Family
Full family index: choose a checker by material and all plugins. This repository is one of them.
License
[Apache License 2.0](LICENSE) © 2026 dsh-canteen-retention-check contributors.
Rendered from the README published on npm. Formatted only, not edited.
Versions
Published on npm::5,最后更新 2026-11-04