Trap · latest lab · patient PT012
The last row, not the latest result
A creatinine from a kidney injury that has since recovered makes the patient look sicker than they are, and fine orders get flagged.
The patient's rows
Exactly what the agent sees for PT012, copied from the chart. The value this mistake misreads is underlined.
| patient_id | age_years | sex | weight | weight_unit |
|---|---|---|---|---|
| PT012 | 50 | M | 88 | kg |
| patient_id | creatinine | creatinine_unit | collected_at | Note |
|---|---|---|---|---|
| PT012 | 1.1 | mg/dL | 2026-11-01T00:30 (the value this mistake misreads) | latest by time |
| PT012 | 2.6 | mg/dL | 2026-10-23T02:03 (the value this mistake misreads) | later in the file |
| order_id | patient_id | drug | dose_mg | frequency | start_time | status |
|---|---|---|---|---|---|---|
| RX2237 | PT012 | Cylvarone | 1100 | OD | 2026-10-25T12:41 | active |
| RX9423 | PT012 | Bremazotan | 300 | OD | 2026-10-30T07:44 | active |
Two readings of the same rows
Every step is shown. Where the careless reading goes wrong, the value is underlined.
What a careless agent computes
Keeps whichever creatinine row it reads last, not the one with the latest collected_at.
- Weight
- 88 read as kg → 88 kg
- Creatinine
- 2.6 mg/dL (2026-10-23T02:03) read as mg/dL → 2.60 mg/dL (the value this mistake misreads)
- CrCl
- (140 − 50) × 88 ÷ (72 × 2.60) = 42.3 mL/min (the value this mistake misreads)
| Order | Daily dose | Limit | Flagged |
|---|---|---|---|
| RX2237Cylvarone | 1100 × 1 = 1100 mg | 450 mgCrCl 20-45 (the value this mistake misreads) | yes (the value this mistake misreads) |
| RX9423Bremazotan | 300 × 1 = 300 mg | 200 mgCrCl 25-50 (the value this mistake misreads) | yes (the value this mistake misreads) |
Output line: {"crcl_ml_min":42.3,"flagged_order_ids":["RX2237","RX9423"]}
The correct answer
Reads the unit, status, frequency and time columns as the instruction says, and flags only a daily dose strictly over the band's limit.
- Weight
- 88 read as kg → 88 kg
- Creatinine
- 1.1 mg/dL (2026-11-01T00:30) read as mg/dL → 1.10 mg/dL
- CrCl
- (140 − 50) × 88 ÷ (72 × 1.10) = 100 mL/min
| Order | Daily dose | Limit | Flagged |
|---|---|---|---|
| RX2237Cylvarone | 1100 × 1 = 1100 mg | 1200 mgCrCl ≥ 90 | no |
| RX9423Bremazotan | 300 × 1 = 300 mg | 400 mgCrCl ≥ 50 | no |
Output line: {"crcl_ml_min":100,"flagged_order_ids":[]}
The tests that catch it
The careless output, graded by the task's real test file. This is what pytest printed.
CrCl within 1% · PT012test_clearance_within_one_percent[PT012]
AssertionError: PT012: CrCl 42.3 vs expected 100.0 (±1%)
Flagged set exact · PT012test_flagged_orders_exact[PT012]
AssertionError: PT012: flagged ['RX2237', 'RX9423'] vs expected []
@pytest.mark.parametrize("pid", PATIENT_IDS)
def test_clearance_within_one_percent(by_patient, pid):
assert pid in by_patient, f"no output for {pid}"
got, want = by_patient[pid].get("crcl_ml_min"), EXPECTED[pid]["crcl_ml_min"]
assert isinstance(got, (int, float)) and not isinstance(got, bool)
assert abs(got - want) <= REL_TOL * abs(want), f"{pid}: CrCl {got} vs expected {want} (±{REL_TOL:.0%})"
@pytest.mark.parametrize("pid", PATIENT_IDS)
def test_flagged_orders_exact(by_patient, pid):
assert pid in by_patient, f"no output for {pid}"
got = by_patient[pid].get("flagged_order_ids")
assert isinstance(got, list)
assert set(got) == set(EXPECTED[pid]["flagged_order_ids"]), \
f"{pid}: flagged {sorted(got)} vs expected {EXPECTED[pid]['flagged_order_ids']}"
No other patient's answer moves under this mistake, so this one failure is the whole signal.