Data Pipeline Case Studies
Classify Scores
Classify numeric scores with one threshold and summarize the decision.
threshold
A selected cutoff changes which records enter the passing group.
label
The summary label is derived from the count, not stored in a table.
Classify Scores
classify_scores.lua
Replay: real traced execution (multi-file project)
local cutoff = 70
local passed = 0
for _, score in ipairs({55, 72, 91}) do
if score >= cutoff then
passed = passed + 1
end
end
local label = "review"
if passed >= 2 then
label = "ready"
end
print("cutoff=" .. cutoff)
print("passed=" .. passed)
print("label=" .. label)
local cutoff = 60
local passed = 0
for _, score in ipairs({55, 72, 91}) do
if score >= cutoff then
passed = passed + 1
end
end
local label = "review"
if passed >= 2 then
label = "ready"
end
print("cutoff=" .. cutoff)
print("passed=" .. passed)
print("label=" .. label)
local cutoff = 85
local passed = 0
for _, score in ipairs({55, 72, 91}) do
if score >= cutoff then
passed = passed + 1
end
end
local label = "review"
if passed >= 2 then
label = "ready"
end
print("cutoff=" .. cutoff)
print("passed=" .. passed)
print("label=" .. label)
cutoff ← 70, passed ← 0
1local cutoff→ 70 = 70 --@cutoff=60, 852local passed→ 0 = 0_, score in ipairs({55, 72, 91}) do
pass 1 of 34for _1, score55 in ipairs({55, 72, 91}) do5 if score >= cutoff then6 passed = passed + 1All 3 passes — pass 1 is the card above pass _scorecutoffpassed1 1 55 — — 2 2 72 70 0 → 1 3 3 91 70 1 → 2 passed ← 1
pass 1 of 24for _, score in ipairs({55, 72, 91}) do5 if score72 >= cutoff70 then6 passed→ 1 = passed + 17 endpassed ← 2
pass 2 of 24for _, score in ipairs({55, 72, 91}) do5 if score91 >= cutoff70 then6 passed→ 2 = passed + 17 endlabel ← review
10local label→ review = "review"11if passed >= 2 thenlabel ← ready
10local label = "review"11if passed2 >= 2 then12 label→ ready = "ready"13endprint("cutoff=" .. cutoff)
15print("cutoff=" .. cutoff70)16print("passed=" .. passed2)17print("label=" .. labelready)outputcutoff=70 passed=2 label=ready
cutoff ← 60, passed ← 0
1local cutoff→ 60 = 602local passed→ 0 = 0_, score in ipairs({55, 72, 91}) do
pass 1 of 34for _1, score55 in ipairs({55, 72, 91}) do5 if score >= cutoff then6 passed = passed + 1All 3 passes — pass 1 is the card above pass _scorecutoffpassed1 1 55 — — 2 2 72 60 0 → 1 3 3 91 60 1 → 2 passed ← 1
pass 1 of 24for _, score in ipairs({55, 72, 91}) do5 if score72 >= cutoff60 then6 passed→ 1 = passed + 17 endpassed ← 2
pass 2 of 24for _, score in ipairs({55, 72, 91}) do5 if score91 >= cutoff60 then6 passed→ 2 = passed + 17 endlabel ← review
10local label→ review = "review"11if passed >= 2 thenlabel ← ready
10local label = "review"11if passed2 >= 2 then12 label→ ready = "ready"13endprint("cutoff=" .. cutoff)
15print("cutoff=" .. cutoff60)16print("passed=" .. passed2)17print("label=" .. labelready)outputcutoff=60 passed=2 label=ready
cutoff ← 85, passed ← 0
1local cutoff→ 85 = 852local passed→ 0 = 0_, score in ipairs({55, 72, 91}) do
pass 1 of 34for _1, score55 in ipairs({55, 72, 91}) do5 if score >= cutoff then6 passed = passed + 1All 3 passes — pass 1 is the card above pass _scorecutoffpassed1 1 55 — — 2 2 72 — — 3 3 91 85 0 → 1 passed ← 1
4for _, score in ipairs({55, 72, 91}) do5 if score91 >= cutoff85 then6 passed→ 1 = passed + 17 endlabel ← review
10local label→ review = "review"11if passed >= 2 then12 label = "ready"13end1415print("cutoff=" .. cutoff85)16print("passed=" .. passed1)17print("label=" .. labelreview)outputcutoff=85 passed=1 label=review