Skip to main content

Make sense of a messy table

Inspect a messy synthetic spreadsheet, spot missing rows and unit traps, and check whether the summary matches the numbers.

1. Scenario

Pick a work role starter with synthetic material, or switch to Bring your own.

Fire safety refresher completion rate by department

HR · Synthetic material

You need to report fire safety completion rates, and three staff on parental leave are still listed in the roster export.

staff_id,dept,status,completed_fire_training
S-01,Warehouse,active,yes
S-02,Warehouse,active,yes
S-03,Warehouse,active,no
S-04,Office,active,yes
S-05,Office,active,yes
S-06,Office,parental_leave,no
S-07,Office,parental_leave,no

2. Work area

Edit the briefs or setup below before you run.

Only the header row, inferred column types, and at most 20 sample rows leave your device. The analysis function runs in your browser on all rows.

5 columns · 24 total rows · 20 sample rows leave device

Answer and chart

Example. No model ran.

8 of the 24 shifts used agency cover, and 48 overtime hours were logged across all departments.

Inline SVG chartWard B24Ward A20Reception4
Steps in plain words
  1. 1. Group all 24 shifts by department and count agency shifts alongside total overtime hours.
  2. 2. Count all rows where cover_type equals agency.
  3. 3. Show the agency cover rows so HR can verify the shift count before payroll cut-off.
Inspect the analyze(rows) code that ran in your browser
function analyze(rows) {
  const byDept = {};
  let agencyCount = 0;
  let totalOvertime = 0;

  for (const row of rows) {
    const dept = String(row.department || "Other");
    const ot = Number(row.overtime_hours) || 0;
    if (!byDept[dept]) {
      byDept[dept] = { department: dept, shifts: 0, agencyShifts: 0, overtimeHours: 0 };
    }
    byDept[dept].shifts += 1;
    byDept[dept].overtimeHours += ot;
    totalOvertime += ot;
    if (String(row.cover_type) === "agency") {
      byDept[dept].agencyShifts += 1;
      agencyCount += 1;
    }
  }

  const table = Object.values(byDept).sort((a, b) => b.overtimeHours - a.overtimeHours);
  const chart = table.map((d) => ({ label: d.department, value: d.overtimeHours }));

  return {
    answer: agencyCount + " of the " + rows.length + " shifts used agency cover, and " + totalOvertime + " overtime hours were logged across all departments.",
    table,
    chart,
    checkOne: {
      label: "Shifts filled by agency cover",
      figure: agencyCount,
      column: "cover_type",
      equals: "agency",
      mode: "count"
    }
  };
}

Check one number by hand

Reported: 8 · Rows found: 8

Shifts filled by agency cover: Filter where cover_type equals agency. Below are all 8 matching rows from the 24-row spreadsheet so you can count or sum them yourself.

1. shift_id: SH-02 · department: Ward A · day: Monday · cover_type: agency · overtime_hours: 4
2. shift_id: SH-06 · department: Ward B · day: Tuesday · cover_type: agency · overtime_hours: 6
3. shift_id: SH-08 · department: Ward A · day: Wednesday · cover_type: agency · overtime_hours: 4
4. shift_id: SH-12 · department: Ward B · day: Thursday · cover_type: agency · overtime_hours: 5
5. shift_id: SH-14 · department: Ward A · day: Friday · cover_type: agency · overtime_hours: 4
6. shift_id: SH-16 · department: Reception · day: Friday · cover_type: agency · overtime_hours: 3
7. shift_id: SH-18 · department: Ward B · day: Saturday · cover_type: agency · overtime_hours: 6
8. shift_id: SH-23 · department: Ward A · day: Sunday · cover_type: agency · overtime_hours: 4

3. Run

Nothing leaves your browser until you press Run.

Sends only the column header and at most twenty sample rows when you press run. to job data_code (claude-sonnet-5-5, effort medium). Raw text is processed in memory and not stored.

4. Inspect

See what left the browser, which model ran, and the receipt.

Example. No model ran. · source: offline
What left the browser

Nothing sent yet. When you run, only headers and at most 20 sample rows leave this device.

What stayed on device

All 24 rows stay in your browser and run inside the sandboxed Web Worker.

Model and job

data_code · claude-sonnet-5-5 (effort medium, max 1600 tokens). Haiku reads the schema and sample rows to propose checks you can verify against the full table.

Runs and source

0 runs used · source: offline · Example. No model ran.

5. Judge

Did the summary separate active staff (2 of 2 in Office = 100%) from staff currently on parental leave?

80%

50 is a coin flip. 99 is certain. Honest confidence scores best.

6. Debrief and Keep

What to check next time, the matching lesson, and keeping this setup as a recipe.

What to check next time

A rate is only as honest as its denominator. Including staff on parental leave makes the Office look 50 percent non-compliant when every active person has finished.

Keep as a recipe

Save the stronger brief and scenario setup to your device so you can reuse or adapt it in Keep.

Open Keep