关于「工作台手册:对账、订单、库存、客户资料四种后台与四件套蒸馏规格」,《数据后台减负与防呆表单》给出的定量结论是什么?
结论:四种后台各有一个把「看」与「做」接起来的支点。对账靠两遍匹配把 1,089 行红色收成 18 行队列;订单靠服务器端状态机加按钮,让 6.04 个非法选项不再出现在屏幕上;库存靠比较库存位置,让红行从每天 35.60 行降到 4.24 行,断货却一样少;客户资料靠录入时规范化,让查重从 66 个找到全部 300 个。下一节把这些做法连同前六章的计算写成前端样式库的新增规格。
数据口径:本书不是会计、审计或法律意见。 书中以标注框区分已发表的证据、可运行的计算、原典与作者的假说,每条假说都写明什么结果会推翻它;原典考辨取唐代刘晏的报数制度,原文只转述大意。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 1089, 18, 300
| history | 60 days, labelled anomalies 1106, 18.43 a day |
| threshold 1.0: flags/day 204.60, true/day 17.07 | |
| threshold 2.0: flags/day 39.70, true/day 12.45 | |
| threshold 2.5: flags/day 16.80, true/day 9.02 | |
| case what verdict code hit result | |
| DT01 ledger table as specified PASS OK - | |
| DT02 amount column left-aligned REFUSE D1 D1 | |
| DT03 amount trimmed to 0 decimals REFUSE D1 D1 | |
| DT04 | 1,200 rows, header scrolls away REFUSE D2 D2 |
| DT05 wide table, reference column scrolls REFUSE D2 D2 | |
| DT06 touch layout, 36 px rows REFUSE S3 S3 | |
| DT07 touch layout, 44 px rows PASS OK - | |
| DT08 unknown column kind REFUSE E0 E0 | |
| CF01 alert 18/day PPV 1, watch 19.48/day PASS OK - alert/screen | 0.38 watch/screen=0.41 |
| CF02 chapter 1 red rows | 435/day, PPV 0.037 REFUSE D4 D4,D5 alert/screen=9.06 |
| CF03 alert tier with colour only REFUSE D3 D3 alert/screen | 0.38 watch/screen=0.41 |
| CF04 watch tier with neither glyph nor edge REFUSE D3 D3 alert/screen | 0.38 watch/screen=0.41 |
| CF05 alert tier PPV 0.40 REFUSE D4 D4 alert/screen | 0.38 watch/screen=0.41 |
| CF06 watch tier without measured PPV REFUSE D4 D4 alert/screen | 0.38 watch/screen=0.41 |
| CF07 naive diff rule, 1,089 rows/day REFUSE D4 D4,D5 alert/screen | 22.69 |
| CF08 muted text in a watch cell REFUSE S1 S1 alert/screen | 0.38 watch/screen=0.41 |
| CF09 alert at budget edge, 48 rows/day PASS OK - alert/screen | 1.0 |
| CF10 watch tier 150 rows/day REFUSE D5 D5 alert/screen | 0.38 watch/screen=3.12 |
| AT01 threshold 2.5 PASS OK - ppv | 0.537 recall=0.489 per_op_hour=0.53 |
| AT02 threshold 2.0 PASS OK - ppv | 0.314 recall=0.675 per_op_hour=1.24 |
| AT03 threshold 1.0 REFUSE D7 D7,D8 ppv | 0.083 recall=0.926 per_op_hour=6.39 |
| AT04 threshold 2.5, only 20 labelled REFUSE D6 D6 labelled | 20 |
| FG01 order entry as specified PASS OK - |
查看完整验算程序
# Chapter 7. p75: Reference implementation of the four new style-kit checks and their golden cases.
# D3 follows WCAG 2.1 success criterion 1.4.1 (colour is never the only visual means of conveying meaning).
# Ops: table_spec (data table), cf_rules (conditional-format rule table), alert_threshold (alarm budget),
# form_guard (error-proof form). Refusal codes D1-D14 are this book's; S1 and S3 reuse the kit's codes.
# Parameters, each traced to a program of this book:
# tier PPV floors alert 0.5, watch 0.1, and at most 3.0 watch rows per screen (chapter 3 tier rules);
# alert rate <= 6 per operator-hour (chapter 4, ISA-18.2); learned-default accuracy >= 0.90 (p61); full
# checks on blur or hybrid only (p62); typed count from 50 rows, cap 300 rows per batch (p64).
# Set by this chapter: alert rows per 25-row screen <= 1.0 on average (the p70 exception queue needs
# 0.38); at least 30 labelled anomalies before a threshold is set. D3: an alert tier needs a glyph; a
# watch tier needs a glyph or an edge bar, so that hue is never the only channel.
# The alert_threshold cases use a seeded history (seed 7575): 60 days x 1,200 rows, anomaly rate 0.015,
# scores N(0,1) clean and N(2.5,1) anomalous; 4 operators x 8 hours. Golden outputs recorded on CPython 3.11.
import random
COL = {"dark": {"text-body": "#F2F0EA", "text-muted": "#8A8A93", "danger-text": "#F26B6F",
"accent": "#C9A45C",
"surface": "#1A1A1F", "cf-alert-bg": "#E5484D", "cf-alert-fg": "#0E0E10",
"cf-watch-bg": "#33290F",
"row-selected": "#2A2A33", "row-stripe": "#212127"}}
NUMERIC = ("money", "number", "qty")
PPV_FLOOR = {"alert": 0.5, "watch": 0.1}
BUDGET = {"alert": 1.0, "watch": 3.0}
def lum(h):
out = []
for i in (1, 3, 5):
c = int(h[i:i + 2], 16) / 255
out.append(c / 12.92 if c <= 0.03928 else ((c + 0.055) / 1.055) ** 2.4)
return 0.2126 * out[0] + 0.7152 * out[1] + 0.0722 * out[2]
def ratio(a, b):
la, lb = sorted((lum(a), lum(b)), reverse=True)
return (la + 0.05) / (lb + 0.05)
def table_spec(x):
hit = []
for c in x["columns"]:
if c["kind"] not in ("id", "text", "date", "status") + NUMERIC:
return ["E0"], {}
if c["kind"] in NUMERIC:
need_dec = 2 if c["kind"] == "money" else c.get("decimals", 0)
if c.get("align") != "right" or not c.get("tabular") or c.get("decimals") != need_dec \
or (c["kind"] != "qty" and not c.get("grouping")):
hit.append("D1")
if x["rows"] > x["viewport_rows"] and not x["header_sticky"]:
hit.append("D2")
if x["overflow_x"] and not x["first_sticky"]:
hit.append("D2")
if x["touch"] and x["row_height"] < 44:
hit.append("S3")
return hit, {}
def cf_rules(x):
hit, per = [], {}
screens = x["rows_per_day"] / x["screen_rows"]
for t in x["tiers"]:
if t["tier"] not in PPV_FLOOR:
return ["E0"], {}
if not t.get("glyph") and (t["tier"] == "alert" or not t.get("edge")):
hit.append("D3")
if t.get("ppv") is None or t["ppv"] < PPV_FLOOR[t["tier"]]:
hit.append("D4")
if t["tier"] == "alert" and t["scope"] == "row":
hit.append("D5")
col = COL[x["theme"]]
if ratio(col[t["fg"]], col[t["bg"]]) < 4.5:
hit.append("S1")
per[t["tier"]] = t["rows_per_day"] / screens
if per.get("alert", 0) > BUDGET["alert"] or per.get("watch", 0) > BUDGET["watch"]:
hit.append("D5")
return hit, {k + "/screen": round(v, 2) for k, v in per.items()}
def alert_threshold(x):
hit = []
if x["labelled_anomalies"] < 30:
return ["D6"], {"labelled": x["labelled_anomalies"]}
ppv = x["true_per_day"] / x["flags_per_day"]
rate = x["flags_per_day"] / (x["operators"] * x["hours"])
recall = x["true_per_day"] / x["anomalies_per_day"]
if ppv < PPV_FLOOR["watch"]:
hit.append("D7")
if rate > 6:
hit.append("D8")
return hit, {"ppv": round(ppv, 3), "recall": round(recall, 3), "per_op_hour": round(rate, 2)}
def form_guard(x):
hit = []
for f in x["fields"]:
if f["kind"] == "enum" and f["control"] == "text":
hit.append("D9")
if f["kind"] == "id" and f["control"] in ("text", "mask") and f.get("check", "none") == "none":
hit.append("D10")
d = f.get("default", {"source": "none"})
if d["source"] in ("static", "sticky") or (d["source"] in ("learned", "derived")
and d.get("accuracy", 0) < 0.90):
hit.append("D11")
if f.get("validate") in ("keystroke", "submit"):
hit.append("D12")
for a in x["actions"]:
if a["guard"] == "modal_generic" or (a["leaves"] and a["guard"] not in ("outbox", "modal_specific")):
hit.append("D13")
if a.get("batch") and (a["max_rows"] > 300 or (a["max_rows"] >= 50 and not a.get("typed_count"))):
hit.append("D14")
return hit, {}
OPS = {"table_spec": table_spec, "cf_rules": cf_rules, "alert_threshold": alert_threshold,
"form_guard": form_guard}
def run(x):
try:
hit, extra = OPS[x["op"]](x)
except (KeyError, TypeError, ValueError, ZeroDivisionError):
hit, extra = ["E0"], {}
hit = list(dict.fromkeys(hit))
return ("REFUSE" if hit else "PASS"), (hit[0] if hit else "OK"), hit, extra
def history():
rng = random.Random(7575)
rows = []
for _ in range(60 * 1200):
a = rng.random() < 0.015
rows.append((rng.gauss(2.5 if a else 0.0, 1.0), a))
return rows
if __name__ == "__main__":
h = history()
n_an = sum(1 for _, a in h if a)
thr = {}
for t in (1.0, 2.0, 2.5):
f = [a for s, a in h if s > t]
thr[t] = (len(f) / 60, sum(f) / 60)
print("history: 60 days, labelled anomalies {}, {:.2f} a day".format(n_an, n_an / 60))
for t, (fl, tr) in thr.items():
print(" threshold {:.1f}: flags/day {:.2f}, true/day {:.2f}".format(t, fl, tr))
def at(t, labelled=n_an):
return {"op": "alert_threshold", "flags_per_day": thr[t][0], "true_per_day": thr[t][1],
"anomalies_per_day": n_an / 60, "labelled_anomalies": labelled, "operators": 4, "hours": 8}
money = {"key": "amount", "kind": "money", "align": "right", "decimals": 2, "grouping": True,
"tabular": True}
ref = {"key": "ref", "kind": "id", "align": "left"}
base_t = {"op": "table_spec", "rows": 1200, "viewport_rows": 25, "row_height": 28, "touch": False,
"overflow_x": True, "header_sticky": True, "first_sticky": True, "columns": [ref, money]}
alert = {"tier": "alert", "scope": "cell", "fg": "cf-alert-fg", "bg": "cf-alert-bg", "glyph": "!",
"ppv": 1.0, "rows_per_day": 18}
watch = {"tier": "watch", "scope": "cell", "fg": "text-body", "bg": "cf-watch-bg", "glyph": "",
"edge": "accent", "ppv": 0.101, "rows_per_day": 19.48}
base_c = {"op": "cf_rules", "theme": "dark", "screen_rows": 25, "rows_per_day": 1200,
"tiers": [alert, watch]}
fld = [{"name": "currency", "kind": "enum", "control": "select",
"default": {"source": "learned", "accuracy": 0.9073}, "validate": "blur"},
{"name": "tracking", "kind": "id", "control": "mask", "check": "mod97", "validate": "hybrid"},
{"name": "amount", "kind": "money", "control": "mask", "validate": "hybrid"}]
act = [{"name": "refund", "leaves": True, "guard": "modal_specific"},
{"name": "message", "leaves": True, "guard": "outbox"},
{"name": "batch_status", "leaves": False, "guard": "undo", "batch": True, "max_rows": 300,
"typed_count": True}]
base_f = {"op": "form_guard", "fields": fld, "actions": act}
def mod(base, **kw):
y = dict(base)
y.update(kw)
return y
def fmod(i, **kw):
y = [dict(f) for f in fld]
y[i].update(kw)
return mod(base_f, fields=y)
def amod(i, **kw):
y = [dict(a) for a in act]
y[i].update(kw)
return mod(base_f, actions=y)
cases = [
("DT01", "ledger table as specified", base_t),
("DT02", "amount column left-aligned", mod(base_t, columns=[ref, dict(money, align="left")])),
("DT03", "amount trimmed to 0 decimals", mod(base_t, columns=[ref, dict(money, decimals=0)])),
("DT04", "1,200 rows, header scrolls away", mod(base_t, header_sticky=False)),
("DT05", "wide table, reference column scrolls", mod(base_t, first_sticky=False)),
("DT06", "touch layout, 36 px rows", mod(base_t, touch=True, row_height=36)),
("DT07", "touch layout, 44 px rows", mod(base_t, touch=True, row_height=44)),
("DT08", "unknown column kind", mod(base_t, columns=[dict(ref, kind="colour")])),
("CF01", "alert 18/day PPV 1, watch 19.48/day", base_c),
("CF02", "chapter 1 red rows: 435/day, PPV 0.037",
mod(base_c, tiers=[dict(alert, scope="row", ppv=0.037, rows_per_day=435)])),
("CF03", "alert tier with colour only", mod(base_c, tiers=[dict(alert, glyph=""), watch])),
("CF04", "watch tier with neither glyph nor edge", mod(base_c, tiers=[alert, dict(watch, edge="")])),
("CF05", "alert tier PPV 0.40", mod(base_c, tiers=[dict(alert, ppv=0.40), watch])),
("CF06", "watch tier without measured PPV", mod(base_c, tiers=[alert, dict(watch, ppv=None)])),
("CF07", "naive diff rule, 1,089 rows/day",
mod(base_c, tiers=[dict(alert, ppv=0.0165, rows_per_day=1089)])),
("CF08", "muted text in a watch cell", mod(base_c, tiers=[alert, dict(watch, fg="text-muted")])),
("CF09", "alert at budget edge, 48 rows/day", mod(base_c, tiers=[dict(alert, rows_per_day=48)])),
("CF10", "watch tier 150 rows/day", mod(base_c, tiers=[alert, dict(watch, rows_per_day=150)])),
("AT01", "threshold 2.5", at(2.5)),
("AT02", "threshold 2.0", at(2.0)),
("AT03", "threshold 1.0", at(1.0)),
("AT04", "threshold 2.5, only 20 labelled", at(2.5, labelled=20)),
("FG01", "order entry as specified", base_f),
("FG02", "currency typed as free text", fmod(0, control="text")),
("FG03", "tracking typed with no check digit", fmod(1, check="none")),
("FG04", "currency pre-filled JPY (static)", fmod(0, default={"source": "static"})),
("FG05", "learned default at 0.85", fmod(0, default={"source": "learned", "accuracy": 0.85})),
("FG06", "full check on every keystroke", fmod(2, validate="keystroke")),
("FG07", "refund behind 'Are you sure?'", amod(0, guard="modal_generic")),
("FG08", "message sent at once, no outbox", amod(1, guard="none")),
("FG09", "batch of up to 906 rows", amod(2, max_rows=906)),
("FG10", "batch of 300 without typed count", amod(2, typed_count=False)),
]
print("case what verdict code hit result")
for cid, what, x in cases:
v, code, hit, extra = run(x)
res = " ".join("{}={}".format(k, v2) for k, v2 in extra.items()) if extra else ""
line = "{:4s} {:38s} {:7s} {:4s} {:6s} {}".format(cid, what, v, code, ",".join(hit) or "-", res)
print(line.rstrip())
print("cases {}; refusal codes triggered: {}".format(len(cases), ", ".join(sorted(
{c for _, _, x in cases for c in run(x)[2]}, key=lambda s: (s[0], int(s[1:]))))))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《高密度数据工作台视觉减负、条件格式显著性与零培训防呆表单工程》第 7 章「工作台手册:对账、订单、库存、客户资料四种后台与四件套蒸馏规格」(版本 0.1.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-138 · v0.1.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026138,
author = {Fan, Yafu},
title = {Cognitive Unloading of Dense Data Workbenches, Conditional-Format Salience and Zero-Training Error-Proof Form Engineering},
year = {2026},
publisher = {5D Library},
edition = {0.1.0},
note = {DOI pending}
}