Skip to the lesson
CivOps AI Academy · F14Widgets and the Dashboard: Only Measured Numbers, With Where They Come From
0%

Chapter 1 · Session 15

Measures before widgets

A dashboard exists because someone makes a decision with it. Before any widget, every number gets a written definition: the decision it serves, its formula, the table it comes from, its unit, its owner and what happens when it is red. Anything the platform does not record yet is written down as not measured, never estimated.

30 min2 stepsNo code yetAbout 2½ hours hands-on in all

By the end of this chapter you can

  • Trace every measure back to a decision in your intent and forward to an action.
  • Have Claude Code draft docs/measures.md from the tables you already have, with a list of what is not measured yet.
  • Check each measure with its owner and work one by hand, so the tests have a number to prove.

Start from the decision, not the data

If you start from the data ("we have holds, inspections and die changes, let's chart them") you get a screen full of charts nobody acts on. Start from the decision in docs/INTENT.md instead, and walk the chain below for each person who will read the dashboard. If you cannot name the action a red number triggers, the widget does not belong.

From decision to widget to actionFive steps left to right: decision, question, measure, widget, action, with the stamping plant's example under each. Every widget traces back to a decision, and forward to an actionDecisionfrom the intentwho decides whatQuestionwhat they needto know firstMeasureformula · unittarget · ownerWidgetsource · visualrefresh · rolesActionwhat happenswhen it is redExample · stamping plant · quality leadHold or release thenew lot?Which lots are waitingon me now?Lots on hold now, andfor how longNumber tile, greyunless over 4 hDecide the oldestwaiting lot first
The chain every widget must complete. From the decision in your intent to the action someone takes when the number is red, with the stamping plant's example underneath.
Every measure hasStamping plant exampleWhy it is there
DecisionQuality lead: hold or release the new lot?Ties the number to the intent
Definition and formulaLots whose latest decision is hold, and how long each has waitedEveryone, and Claude Code, counts the same way
Sourceholds, through the lot_status viewProves the platform already records it
Unit and periodLots, nowStops a shift being compared with a week
OwnerQuality leadSomeone answers for it
Target and red whenNone waiting; red when one has waited over 4 hoursSays when to act
Action when redDecide the oldest waiting lot firstNo action, no widget
Stale after15 minutes without a newer rowSays when the number can no longer be trusted
Step 1

Have Claude Code draft docs/measures.md

15 minutes

Why

A measure written down before any code is a measure everyone computes the same way: you, the owner, the tests and Claude Code. Drafting it from your existing tables also shows at once which measures the platform can honestly show today and which it cannot, so nothing on the dashboard has to be filled in by guesswork.

Do this

Paste into Claude Code
Read docs/INTENT.md, docs/SCHEMA-PLAN.md, docs/workflow-1-fields.md, docs/matrix.json and the files in supabase/migrations/. Do not write any SQL or code.

On a new branch dashboard/measures, write docs/measures.md for someone who does not write code:

1. For each role in docs/matrix.json that makes or supports the decision in the intent, the decisions they make each shift and the questions they need answered first.
2. Up to six measures per role. For each: id (naming standard), title, the decision it serves, definition in plain words, formula, source tables (only tables that exist), unit and period, owner (a role), target, red when, the action when red, leading or lagging, and stale after (how old the newest source row may be before the number is not trusted).
3. A machine-readable block (a fenced json block) with the same fields per measure, so tests can read it.
4. "Not measured yet": every measure someone would want that our tables cannot compute today (for example OEE, which needs planned time, run time and part counts), with the data it would need and which session or workflow could bring it. Never propose estimating or defaulting one.
5. "Questions for the owners".

Open a pull request titled "Dashboard: measures" and show me the link.

You will see recreated screen

claude — acme-platform
⏺ Read(docs/workflow-1-fields.md)
⎿ Read 88 lines
⏺ Read(supabase/migrations/)
⎿ 14 files
⏺ Write(docs/measures.md)
+## first_piece_pass (quality lead · lagging)
+Lots whose first first-piece result was inside the limits for every characteristic,
+divided by lots with a first-piece result, last 7 days. Shown with the count of lots.
+Source: inspections, characteristics, lots. Unit: %. Target 95%. Red below 90%.
+Action when red: review the out-of-limit Pareto with the toolroom. Stale after 60 min.
1
⏺ Write(docs/measures.md)
+## Not measured yet
+- OEE: needs planned time, run time and part counts per press. No table holds them.
+ The plant connector (Session 20) could bring counts from the presses.
+- Scrap cost: needs scrap counts and cost per part. Not recorded.
2
⏺ Pull request #41 adds docs/measures.md: 6 measures for the quality lead and the area supervisor, each from tables that exist, with a json block for tests. 3 measures are listed as not measured yet. Two questions for the owners.
Claude Code reads what is recorded before it proposes what to measure, and lists what it cannot measure honestly.
  1. A complete definition: decision, formula, source, unit, owner, red when and action.
  2. The most important list on the page. Whatever is here never appears on a widget as a number.

Check it worked

The pull request has one new file. Every measure names its source tables (all of which exist), a unit, an owner and an action when red; there is a json block, a Not measured yet list and a Questions list.

If it goes wrong

It proposes OEE, scrap cost or energy from tables you do not have

Say: Move every measure whose data no table holds to Not measured yet, with the data it would need. Never estimate one. On our platform a report guessed revenue from headcount; the customer had never given it.

A measure has no action when red

Say: Drop any measure with no action when red, or ask its owner in the Questions section what they would do. A number nobody acts on still costs attention every day.

It wrote SQL or a widget anyway

Say: Remove the code. I need the definitions in plain English first, as asked.

Step 2

Check each measure with its owner, and work one by hand

20 minutes

Why

The owner knows what the number is for: whether a hold counts from the decision or from the die change, whether four hours is the right limit. Working one measure by hand on a few made-up rows gives a number that is right because you counted it, so the tests can prove the database computes the same, not just something plausible.

Do this

Sit with the quality lead and the area supervisor and read docs/measures.md on GitHub. For each measure ask: What do you do when this is red? Is this how you would count it? Answer the questions. Then work the pass rate by hand on eight made-up lots: write each lot, whether its first piece was inside limits, and the result (here 7 of 8: 87.5%, red). Then:

Paste into Claude Code, after replacing the <...> parts
The owners read docs/measures.md:
1. <paste their answer to each question>
They also changed: <paste anything else, in their words>.

Update the file. Add a section "Worked by hand" with this example, which the tests must reproduce exactly:
<paste your eight lots and the result, for example: 8 lots on Press 3, lots 1 to 8, lot 6 out of limits on flange height; first_piece_pass = 7 of 8 = 87.5%, red>
Add "Checked with the quality lead and the area supervisor on <today's date>" at the top, and push to the same pull request.

Owner two approves; merge.

You will see recreated screen

github.com/acme-ops/acme-platform/blob/main/docs/measures.md
docs/measures.md
Checked with the quality lead and the area supervisor on 2026-11-171
MeasureOwnerUnitRed whenStale after
Lots on hold nowQuality leadlotsone waits over 4 h15 min
First-piece pass rate, 7 daysQuality lead% (with count)below 90%60 min
Die change to release, medianArea supervisorminutesover 3060 min
Die change minutes, medianMaintenance leadminutesover 4524 h
Worked by hand8 lots on Press 3; lot 6 out of limits on flange height. first_piece_pass = 7 of 8 = 87.5%: red.2
docs/measures.md after the owners' check: signed off, with the hand-worked example the tests will prove.
  1. The sign-off: who agreed each definition, and when.
  2. The number the tests must reproduce. You counted it; the database must agree.

Check it worked

docs/measures.md is merged on main, signed off by the owners with a date, with a hand-worked example and no open questions.

Fastest path

Work the example on paper with the owner during the meeting. They will spot a counting rule (does a correction count as a first piece?) faster than any review.

If it goes wrong

The owner asks for twenty measures

Ask which decision each extra one changes. Keep six; put the rest in a monthly report, or under Not measured yet if the data does not exist.

The owner wants a number you do not record, "just roughly"

Write it under Not measured yet with what would be needed. A rough number on a dashboard is read as a measured one by everyone who did not hear the word roughly.

Use the standard definitions, and only for data you have

Manufacturing already agrees on how to compute its common measures. ISO 22400-2 defines key performance indicators for manufacturing operations (availability, quality ratio, scrap ratio, OEE and others) with formulas, units and the times and quantities each is built from [1], in terms that line up with the ISA-95 model your names follow [2]. Overall equipment effectiveness multiplies three factors, and the lowest factor says where to look [3]:

FactorFormulaExample shift
Availabilityrun time ÷ planned time = 387 ÷ 45086.0%
Performancetotal parts ÷ (run time × ideal rate) = 6,966 ÷ 7,74090.0%
Qualitygood parts ÷ total parts = 6,757 ÷ 6,96697.0%
OEE0.860 × 0.900 × 0.97075.1%
OEE and the six big lossesOEE of 75.1% splits into availability 86%, performance 90% and quality 97%; under each sit two of the six big losses. OEE 75.1%availability × performance × qualityAvailability 86.0%387 of 450 planned minBreakdownsSetups, changeoversPerformance 90.0%6,966 of 7,740 ideal partsSmall stops, idlingReduced speedQuality 97.0%6,757 good of 6,966Start-up rejectsProduction rejectsThe six big losses: each one shows up in exactly one factor, so the factor tells you where to look
OEE and the six big losses, on an example shift. A teaching example, not your data: your platform records none of these quantities yet, so OEE stays under Not measured yet until press counts arrive.

A lagging measure says what already happened (last week's pass rate). A leading one moves first (lots waiting on a decision now). Pair each lagging measure with a leading one so the owner has time to act, and watch for numbers that mislead: an average that hides one bad shift, a percentage without its count ("50% failed" of two lots), a target that people learn to move instead of the work.

Knowledge check

A manager asks for a widget showing 'all the press data'. What do you ask first?

Knowledge check

The dashboard needs OEE, but no table holds run time or part counts. What goes on the dashboard?

References

  1. ISO 22400-2:2014, Key performance indicators (KPIs) for manufacturing operations management, Part 2: Definitions and descriptions. https://www.iso.org/standard/54497.html
  2. ISA: ISA-95 standard, Enterprise-Control System Integration. https://www.isa.org/standards-and-publications/isa-standards/isa-95-standard
  3. Vorne: Calculating OEE. https://www.oee.com/calculating-oee/

Chapter 2 · Session 15

Widgets that show only what was measured

Each measure becomes a database view that keeps your access rules, and each widget is a few lines of configuration drawn by one component. The component has five honest states, and every widget carries its source and the time of its newest data. Then you hunt for any number on any screen that nobody measured.

45 min3 steps5 honest statesA test for every widget

By the end of this chapter you can

  • Have Claude Code write one view per measure, with security_invoker, and tests that reproduce the hand-worked number.
  • Build one widget component with five states (live, no data, stale, not enough data, could not load) and a test per widget.
  • Find and remove every displayed number that is hard-coded, generated or defaulted.

The number nobody measured

We shipped invented numbers more than once. A savings counter that ticked up by itself, labelled as the ledger. A control chart that drew twelve hard-coded points and graded them "In control" on 87 screens. Seven users on an admin page who did not exist. A sensor that could not be read, shown as 0, which is a real reading. Each time, an agent had filled an empty place so the screen looked finished. The fix is a rule and a design: every displayed number comes from a stored or measured value, and "no data" is a visible state, never a number.

StateWhenWhat the widget shows
LiveRows in the period, newest within stale afterThe value, its count, its source and "as of 06:52"
No dataNo rows in the period"No first-piece results in the last 7 days": never 0
StaleNewest row older than stale afterGrey, the last value, "as of 03:10, not updating"
Not enough dataFewer rows than the measure needs (a control chart needs 20)"12 of 20 lots: limits not yet computed"
Could not loadThe view failed or was refused"Could not load" and the time it tried: never a remembered or default value
Anatomy of a widgetSeven configuration fields sit on a view that runs with the viewer's rights, which reads tables protected by row-level security. The tables, with row-level security generated from docs/matrix.jsoninspections · holds · lots · die_changes · die_change_reviews · characteristicsA view that runs with the viewer's rights (security_invoker)measure_first_piece_pass: value, n and as_of per sitesourcethe viewmeasurethe formulatargetand limitsvisualtile · trend · barrefreshstale afterdrillwhere a tap goesroleswho sees itlib/dashboard/widgets.json: one entry per widget, no values, reviewed like code
Anatomy of a widget. The configuration sits on a view; the view runs with the viewer's rights, so the access rules generated from your matrix still decide what each person sees.

A view is a saved query that reads like a table. Created with security_invoker = true, it runs with the rights of the person asking, so the row-level security on the tables underneath still applies [1][2]. Without it, a view runs with its owner's rights and can show every site's rows to everyone; Supabase's Security Advisor flags such a view as an error [3].

Step 3

One prompt: the measure views and their tests

20 minutes

Why

Computing each measure once, in the database, means every screen and every test gets the same number, and the access rules apply to it automatically. Tests that reproduce your hand-worked number prove the formula; tests from another site prove the view opened no new path to the data. Writing them in the same pull request means no measure ever exists untested.

Do this

Paste into Claude Code
Read docs/measures.md (signed off) and the existing migrations and tests.

On a new branch dashboard/views:
1. Create a NEW migration (npx supabase migration new measure_views) with one view per measure in the json block, named measure_<id>, each created with (security_invoker = true). Each returns site_id, any grouping columns, value, n (how many rows it counted) and as_of (the time of the newest source row). When there are no rows, the view returns no row: no coalesce to 0, no default.
2. pgTAP tests in supabase/tests/measures.test.sql: for the "Worked by hand" example, insert exactly those rows in a transaction and check the view returns exactly that value and count; check a user from another site gets no rows; check every measure_ view has security_invoker on; check each view returns no row when its tables are empty.
3. Do not change any table, policy or existing test.

Push, open a pull request titled "Dashboard: measure views", wait for every check, and fix any failure before you report. Tell me, for each view, the value it returned for the worked example.

You will see recreated screen

claude — acme-platform
⏺ Bash(npx supabase migration new measure_views)
⎿ Created supabase/migrations/20261118090000_measure_views.sql
⏺ Write(supabase/migrations/20261118090000_measure_views.sql)
+create view public.measure_first_piece_pass with (security_invoker = true) as
+select f.site_id, count(*) filter (where f.inside) * 100.0 / count(*) as value,
+ count(*) as n, max(f.recorded_at) as as_of
+from public.first_pieces_last_7_days f group by f.site_id;
1
⏺ Write(supabase/tests/measures.test.sql)
+select results_eq('select value, n from measure_first_piece_pass', $$values (87.5, 8)$$,
+ 'worked by hand: 7 of 8 lots = 87.5%');
+select is_empty('select * from measure_first_piece_pass', 'no rows means no row, not 0');
2
⏺ Bash(gh pr checks --watch)
⎿ ci pass · schema pass · access pass (cross-site: 0 rows) · clamps pass
⏺ Pull request #42 is green. 6 views, all with security_invoker. For the worked example: first_piece_pass 87.5 (n 8), release_minutes 25 (n 5). With empty tables every view returns no row. A supervisor from another site sees none of them.
Views that compute each measure once, tests that prove your number, and no zero standing in for nothing.
  1. value, n and as_of: the number, how many rows it stands on, and how fresh it is.
  2. Your hand-worked 87.5%, proven; and no row, not 0, when there is nothing to count.

Check it worked

The pull request is green, every view has security_invoker, and Claude Code's values for the worked example match the ones you counted. Owner two approves; merge. After the deploy run, rerun the Security Advisor for acme-platform-prod: no errors.

Fastest path

Asking for the worked-example values in the summary lets you check the formula in ten seconds, without reading the SQL.

If it goes wrong

The Security Advisor shows Security Definer View

A view runs with its owner's rights and ignores the access rules. Say: Write a new migration that recreates view <view name> with security_invoker = true, and add a test that a user from another site gets no rows from it.

A view uses coalesce(..., 0) or returns 0 when nothing happened

Say: No data must return no row, not 0. Remove the default and add a test that the view is empty when its tables are. A zero on a dashboard is read as "nothing went wrong".

The test value differs from yours by a little

Do not accept "close enough". Ask: Show me the rows the view counted for the worked example, one per line, and say which rule decided each. Usually it is a counting rule (a correction, a lot with two first pieces) the owner must settle, and you write the answer into docs/measures.md.

Step 4

The widget component, the widgets file, and a test per widget

20 minutes

Why

One component drawing every widget means one place to get the five states, the source line and the freshness right, and a new widget becomes a few reviewable lines instead of a new page. A test per widget, in every state, makes a widget that would show a made-up number fail the build instead of reaching the manager.

Do this

Paste into Claude Code
Read docs/measures.md and the views from "Dashboard: measure views". This version of Next.js differs from older guides: read the relevant guide in node_modules/next/dist/docs/ before writing any page or component code.

On a new branch dashboard/widgets:
1. One widget component that draws a widget from configuration and reads only from its measure_ view, as the signed-in person. Five states: live (value, count, "Source: view and tables", "as of" time), no data (says what is missing, in words), stale (grey, last value, "as of", "not updating"), not enough data (for control charts, fewer than 20 points), could not load (says so). It never shows 0, a sample or a remembered value in place of data. Colour only when red, always with a word.
2. lib/dashboard/widgets.json: one entry per measure: id (must match docs/measures.md), title, view, visual (tile, line, pareto, control chart, table), refresh seconds, stale after (from docs/measures.md), drill (the page a tap opens), roles. No values: targets and limits come from docs/measures.md.
3. Tests, per widget: the worked example shows the hand-worked number; no rows shows the no-data message; an old as_of (fixed clock) shows stale; another site sees no data; a role not listed does not see the widget. Plus guard tests: every widget id exists in the docs/measures.md json block with formula, source, unit and owner; no widget entry holds a value; the component never renders 0 for a missing value.
4. For each new test, show me it failing with the feature broken on purpose, then passing.

Push, open a pull request titled "Dashboard: widgets", wait for every check and the preview, fix any failure, and report.

You will see recreated screen

claude — acme-platform
⏺ Bash(npx vitest run tests/widgets)
⎿ 6 widgets × 5 states: 30 passed · guard: 3 passed
⏺ Bash(npx vitest run tests/widgets -t "no data")
⎿ Planted: component renders 0 when the view is empty → 6 failed. Restored → 6 passed.
1
⏺ Bash(gh pr checks --watch)
⎿ ci pass · e2e pass (phone 360, 390) · clamps pass
⏺ Pull request #43 is green. One component, 6 widgets in lib/dashboard/widgets.json, no values in it. Each test was shown failing with the defect planted. Preview: https://acme-platform-git-dashboard-widgets-acme-ops.vercel.app/manager2
A test for every widget in every state, each shown failing first.
  1. Red first, then green: a test that cannot fail proves nothing.
  2. Open the preview on your phone before approving.

You will see recreated screen

acme-platform-git-dashboard-widgets-acme-ops.vercel.app/manager
First-piece pass rate · 7 days87.5% · 7 of 8 lots · below 90% · Source: measure_first_piece_pass (inspections, characteristics) · as of 06:521
Lots on hold nowNo lots on hold · Source: lot_status (holds) · as of 06:402
Die change to release · medianNot updating · 25 min as of 03:10 · stale after 60 min3
Flange height · control chart12 of 20 lots: limits not yet computed4
One widget in four of its states, recreated. Every one names its source; none fills a gap with a number.
  1. Live: value, count, a word beside the colour, the source and the time.
  2. Nothing to show is said in words. Here it is good news, and still not a 0.
  3. Stale: grey, the last value and its time, so nobody acts on it as if it were now.
  4. Not enough data: control limits from fewer than 20 points would mislead.

Check it worked

The pull request is green with a test per widget per state, each shown failing first; lib/dashboard/widgets.json holds no values; the preview shows each widget with its source and as-of time. Owner two approves; merge.

If it goes wrong

A test only checks that a word appears in the component's code

It will pass while the widget is broken; we found three such tests in one night's work. Say: Rewrite every widget test to render the widget with data from the view and check what it shows.

A widget test was loosened or skipped to get to green

Say: Never edit, skip or loosen a test to make something pass. Restore the test, show me why it fails, and stop if you think the test is wrong. Check the Files changed tab for edited tests before reading the summary.

The component shows a value while the view is still loading, then changes

That first value is invented. Say: While loading, show a loading state with no number. A value may only appear once the view has answered.

Step 5

Hunt down every number nobody measured

10 minutes

Why

The widgets are now honest, but the screens from Sessions 12 to 14 were built before this rule existed, and an agent filling an empty place is the commonest way an invented number gets in. A single sweep finds them; a line in CLAUDE.md and the guard tests keep them out of every later session, including the overnight builds in Session 17.

Do this

Paste into Claude Code
On a new branch dashboard/no-invented-numbers:

Search every screen, chart, widget and report in the app for values that are hard-coded, generated, guessed or defaulted, including 0 or an empty string used for "unknown", sample or placeholder data, and numbers in components that do not come from a query. List each one with its file and line and where its value comes from. Do not group them: check each one separately.

Replace every one that is not a stored or measured value with an explicit "No data", "Not measured" or "Not updating" state. Targets and limits may stay only if they match docs/measures.md.

Add this line to CLAUDE.md: "No displayed number may come from a typed-in, generated, guessed or defaulted value. No data is a visible state, never a number. Every widget names its source and its as-of time."

Push, open a pull request titled "Dashboard: no invented numbers", wait for every check, and report what you found, item by item.

You will see recreated screen

claude — acme-platform
⏺ Found 4. 1) app/manager/board.tsx:41: target 95 typed in the component; docs/measures.md says 95. Kept, now read from docs/measures.md. 2) app/manager/trend.tsx:12: an array of 14 sample points used when the query is empty. Removed; shows No data. 3) app/review/queue.tsx:88: count shows 0 while loading. Now a loading state. 4) lib/format.ts:9: formats null as 0. Now formats null as No data.1
⏺ Write(CLAUDE.md)
+No displayed number may come from a typed-in, generated, guessed or defaulted value.
+No data is a visible state, never a number. Every widget names its source and its as-of time.
2
⏺ Pull request #44 is green. 3 invented values removed, 1 target kept and tied to docs/measures.md, 1 rule added to CLAUDE.md.
Each finding on its own, with the file, the line and where the number came from.
  1. Item by item. A sample array behind a trend is exactly what we found graded "In control" on 87 screens.
  2. The rule every later prompt and agent reads first.

Check it worked

The pull request lists every finding separately with its file and line, the CLAUDE.md rule is on main, and every check is green. Merge it.

If it goes wrong

Claude Code says the findings are false positives and changes nothing

Some may be; a group is never all false. Say: For each item separately, show me where its value comes from and what the screen shows with an empty table. We once saw a group of warnings dismissed together; some of them were real and were exposing customer data in production.

It reports nothing found

Test the search: Add a hard-coded 42 to one widget on this branch, run your search again, and show me it is found. Then remove it. A search that cannot find a planted number cannot be trusted to find a real one.

Knowledge check

Why are measure views created with security_invoker = true?

Knowledge check

A view has no rows for the last 7 days. What should the widget show?

References

  1. PostgreSQL Documentation: CREATE VIEW (security_invoker). https://www.postgresql.org/docs/current/sql-createview.html
  2. Supabase Docs: Row Level Security. https://supabase.com/docs/guides/database/postgres/row-level-security
  3. Supabase Docs: Database advisors. https://supabase.com/docs/guides/database/database-advisors
  4. Supabase Docs: Testing your database (pgTAP). https://supabase.com/docs/guides/database/testing

Chapter 3 · Session 15

The dashboard, on the floor

One dashboard per role, read in five seconds on a phone or from across the room. Grey is normal, colour means act, a control chart tells signal from noise, and every widget says how fresh it is. Then it ships through the pipeline and you check the live one tells the truth.

30 min2 stepsEnds with a gateThe five-second test

By the end of this chapter you can

  • Lay out each role's dashboard with the measure tied to the main decision first, on a wall and on a phone.
  • Use colour only for trouble, always with a word, and read an individuals control chart.
  • Ship the dashboard through the Session 11 pipeline and check every live widget shows a measured value or an honest state.

One role, one screen, five seconds

Each role gets its own dashboard, answering its own questions. Test it the simple way: show it to the person for five seconds, hide it, and ask what they would do next. If they cannot say, the layout is wrong, not the person. Most important top left; widgets for the same decision together; the same scale every day; on a phone, one column in the same order, 44 px targets, as Session 12 set out [1].

Dashboard layout on a wall and a phoneSix numbered widgets in a three by two grid on a wall display, and the same six in one column on a phone. Wall display (16:9), read from across the roomPhone, 390 px wide1Lots on hold now2First-piece pass3Release time4Flange chart5Out-of-limit Pareto6Die change min1Lots on hold now2First-piece pass3Release time4Flange chart5Out-of-limit Pareto6Die change minMost important top left; the phone keeps the same order in one column; every tile is a 44 px tap target
The same dashboard on a wall and on a phone. The order never changes: the measure tied to the main decision is first on both.

Choose each widget's picture from the question it answers. People judge positions along a common scale (bars, dots on a line) far more accurately than angles, areas or shades, which is why sorted bars and plain lines beat pies, round gauges and 3-D effects [6].

Choosing a visualFive manager questions, each mapped to a visual: number tile, line trend, sorted bars, status grid, control chart. The manager's questionThe visual that answers itHow are we doing right now?Number tile with its target and trend arrowIs it getting better or worse?Line over time, same scale every dayWhat causes most of the loss?Bars sorted largest first (Pareto)Which line or press needs me?Status grid: grey when normal, colour when notIs this change real, or noise?Control chart with its limitsAvoid pies, gauges and 3-D: people judge positions on a common scale far better than angles or areas
Choosing a visual. Start from the owner's question; the visual follows. Set it once in lib/dashboard/widgets.json.

Control rooms learned the colour lesson the hard way. ISA-101, the standard for operator displays in process automation, describes screens where normal states are muted and bright colour is kept for abnormal conditions, so the eye goes straight to what needs attention [2]. Never use colour alone: add a word or a shape, so people who cannot tell the colours apart, and screens in bright light, still carry the message [3].

Signal or noise

Every process varies. React to every dip and you change things that were fine, adding variation. An individuals control chart draws limits from the process's own variation: the mean plus and minus 2.66 times the average moving range (the average difference between one point and the next). The 2.66 is 3 ÷ 1.128, which turns the average moving range into three estimated standard deviations [4]. React to a point outside a limit, or to a run of eight on one side of the mean; otherwise, watch.

Control chart of first-piece flange heightTwenty lots with mean 25.033 mm and limits 24.950 to 25.116 mm; only lot 16, at 25.14 mm, falls outside. First-piece flange height, Part P-1123, last 20 lots (mm)24.9525.0025.0525.1025.15upper limit 25.116lower limit 24.950mean 25.033lot 16: a real signal, find the causeEvery other up-and-down is normal variation: reacting to it adds variation
First-piece flange height on Part P-1123, last 20 lots, with limits computed from the data. Nineteen lots are normal variation. One is a signal worth a conversation with the toolroom.
Data freshness and stalenessRows arrive each minute for three minutes, stop for eight, and the widget turns grey with an as-of time after five minutes without data. One widget over 12 minutes: refresh every minute, stale after 5 minutes without new data0123456789101112minutesnew data each minuteno new rows arrivinggrey: 'as of minute 3'widget shows live valuebackA stale number that looks live is worse than no number: every widget shows its 'as of' time
Refresh and staleness. When rows stop arriving, the widget turns grey and shows the time of its newest data instead of pretending.
Step 6

Lay out each role's dashboard, and test it on a phone

20 minutes

Why

The same six widgets in the wrong order are read wrongly every shift. Putting the main decision first, keeping normal grey and colour for red with a word, and running the five-second test with the real person on a phone is how you know the dashboard changes a decision rather than decorating a wall.

Do this

Paste into Claude Code
On a new branch dashboard/layout, using only the widget component and lib/dashboard/widgets.json:

- One dashboard per role in docs/measures.md, on the manager view from Session 13 (its address is in lib/access/routes.ts) and the supervisor's view. Most important first, as docs/measures.md orders them; widgets for the same decision together.
- Normal values in the page's neutral colours. Colour only when a measure is red, always with a word or shape beside it ("Over 4 h").
- On a phone, one column in the same order, 44 px targets, no sideways scrolling. A tap opens the widget's drill page.
- Phone tests at 360 and 390 px for each role's dashboard.

Push, open a pull request titled "Dashboard: layout", wait for every check and the preview, and give me the preview address.

Open the preview on your phone, signed in as a test quality lead. Then show it to the real quality lead for five seconds, hide it, and ask what they would do next. Write their answer in the pull request.

You will see recreated screen

acme-platform-git-dashboard-layout-acme-ops.vercel.app/manager
1 · Lots on hold now2 lots · L-2071 waiting 4 h 20 min · Over 4 h ▲ · as of 06:401
2 · First-piece pass rate · 7 days96.2% · 52 lots · as of 06:52
3 · Die change to release · median18 min · 31 die changes · as of 06:52
4 · Flange height · control chart20 lots · 1 point above the upper limit (lot 16)2
5 · Out-of-limit results by characteristicFlange height 23 · Hole position 17 · Burr 9 · as of 06:52
The quality lead's dashboard on a phone, recreated: one column, the waiting lots first, grey unless red.
  1. The only colour on the screen, with a word and a shape: the one thing to act on now.
  2. A signal, not a dip: a point outside limits computed from at least 20 lots.

Check it worked

The pull request is green with phone tests for each role; on your phone the order matches docs/measures.md, only red measures have colour, each with a word; and the quality lead said what they would do after five seconds. Owner two approves; merge.

Fastest path

Do the five-second test on the preview, before merging. Moving a widget is one line in lib/dashboard/widgets.json now, and a whole meeting after go-live.

If it goes wrong

The "last 8 hours" and "this shift" widgets on the preview all say No data

The made-up data in the development project has aged: it was written relative to the day it was seeded, and we measured our newest seeded batch at 10.9 days old eleven days later. The widgets are right to say so. Re-run the development seed (scripts/seed-dev, Session 6) against acme-platform-dev only, yourself, and check the newest row is less than an hour old. Never change a widget's period to make it show something.

Some widgets show today and others a fortnight ago

Some tables were re-seeded and others not, or the seed read the clock more than once. Ask: Check that the seed reads the clock once and shifts every table by the same offset, so the newest record is now and the gaps between records are unchanged. Add a test for it.

A tap on a widget opens a 404

Say: Sign in as each role on the preview, tap every widget and follow its drill link. Report every 404 or error and fix it. A link that compiles is not a link that works.

Step 7

Ship it, and check the live dashboard tells the truth

10 minutes

Why

The preview runs on made-up data; production runs on the plant's. After the pipeline ships the dashboard, the live widgets must show either a number measured from real records or an honest state. A widget that shows a number on production that you cannot trace to a real record is the defect this whole session exists to prevent.

Do this

Open

https://github.com/acme-ops/acme-platform/actions

The deploy run for the layout merge must be green, with any new migrations applied.

Open

https://acme-platform.vercel.app/manager

The live dashboard on your phone, signed in as yourself. Check each widget against the table below.

Open

https://supabase.com/dashboard/project/abcdefghijklmnopqrst/advisors/security

The Security Advisor for the live project: Rerun linter. No errors.

For any live number you doubt, ask Claude Code to trace it, without touching production:

Paste into Claude Code
On the live dashboard, the widget "<title>" shows <value> as of <time>. Using only the view's definition and docs/measures.md, tell me which tables and which kind of rows that number is computed from, and what I should look up in the Supabase Table Editor to check it by hand. Do not connect to or change the live project.

You will see recreated screen

https://acme-platform.vercel.app/manager
Lots on hold nowNo lots on hold · Source: lot_status (holds) · as of 06:401
Die change minutes · median per press · 14 daysP-03: 47 min · 6 verified · as of 06:52 · other presses: no verified die changes yet2
Flange height · control chart7 of 20 lots: limits not yet computed3
The live dashboard in its first week, recreated. Real records from the die change workflow, and honest states where there are none yet.
  1. Real and current: as of minutes ago.
  2. Only Press 3 uses the screen so far (Session 14). The other presses say so, in words.
  3. Production has fewer lots than the preview. The widget waits for 20 before drawing limits.

Check it worked

The deploy run is green, the Security Advisor shows no errors, and every live widget shows either a value you can trace to real records, with its source and as-of time, or an honest state in words. No number on the live dashboard is a sample, a default or a guess.

If it goes wrong

A live widget shows a number you cannot trace to any real record

Stop and treat it as a defect, not a curiosity. Check that no made-up row reached production: made-up data is marked as made up (Session 6) and must never be in acme-platform-prod. If it is, tell owner two, and follow docs/runbook.md.

Every live widget says Not updating

The newest real row is older than its stale after. Ask the floor whether the screens are being used; if records are stuck in a device's outbox, the widget is right to say so. Do not lengthen stale after to make it look live.

The production deploy shows Canceled

A newer merge replaced it within a minute. A canceled deploy that a newer ready deploy replaced is not a failure. Check the newest production deployment is Ready and came from git.

Before you go on · Session 15 is done whenTick each one

Knowledge check

On the quality lead's dashboard, what colour is a measure that is inside its limits?

Knowledge check

A widget's newest row is 3 hours old and its stale after is 60 minutes. What does it show?

References

  1. W3C: Understanding WCAG 2.2, Success Criterion 2.5.5 Target Size (Enhanced). https://www.w3.org/WAI/WCAG22/Understanding/target-size-enhanced.html
  2. ISA: ISA-101, Human-Machine Interfaces for Process Automation Systems. https://www.isa.org/standards-and-publications/isa-standards/isa-101-standards
  3. W3C: Understanding WCAG 2.2, Success Criterion 1.4.1 Use of Color. https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html
  4. NIST/SEMATECH e-Handbook of Statistical Methods: Individuals control charts. https://www.itl.nist.gov/div898/handbook/pmc/section3/pmc322.htm
  5. NIST/SEMATECH e-Handbook of Statistical Methods: What are control charts?. https://www.itl.nist.gov/div898/handbook/pmc/section3/pmc31.htm
  6. Cleveland, W. S. and McGill, R. (1984). Graphical perception. Journal of the American Statistical Association 79 (387). https://doi.org/10.1080/01621459.1984.10478080

Chapter 4 · 12 questions · 80% passes

Final assessment

Twelve questions across the session. Score 80% (10 of 12) to pass. Your LMS records your score and each answer; you can review the chapters and try again.

15 min12 questions≈ 15 minutesRetake allowed

Choose one answer for each question, then submit. You will see the right answer and why for every question.

1. What must every widget trace back to?
2. Which is a complete measure definition?
3. Your tables hold no run time or part counts. Where does OEE go?
4. Why work one measure by hand before any view is written?
5. Why are measure views created with security_invoker = true?
6. A measure view has nothing to count. What should it return?
7. What may lib/dashboard/widgets.json contain?
8. A widget's newest row is older than its stale after. What does it show?
9. A control-chart widget has 12 points. What does it show?
10. For an individuals control chart, the limits are the mean plus and minus:
11. On the dashboard, when is bright colour used?
12. After a few days the preview's 'this shift' widgets all say No data. What is the right fix?