DEV Community

eth shihao
eth shihao

Posted on

Trace dental autoclave spore-test quarantine windows in JavaScript

A dental sterilizer's May 11 spore test comes back positive on May 12. The May 13 retest comes back negative on May 15. The May 14 audit still shows an open review window. On May 15 the window closes in the record, and the same 27 packages remain visible in the affected-load history.

Load on AUT-A1 Cycle date Packages Role in the review
A-101 May 4 10 Preceding negative biological indicator (BI), outside the window
A-102 May 7 12 Included because it follows the negative baseline
A-103 May 11 9 Positive result, reported May 12
A-104 May 12 6 Included while the window is open
A-105 May 13 0 Retest cycle, included because its result arrives May 15

Keep three dates and two identities straight

The cycle date orders the loads. The result date controls when a BI becomes visible as completed. The audit date fixes what the reviewer could see at the time. A negative retest reported after its cycle date keeps the review window open until the result arrives. The inputs only carry dates, so the closed window includes cycles through that report date. For multiple cycles on one day, use the per-sterilizer sequence field.

Evidence matching is a separate check. The module resolves the BI's report ID against the supplied inventory, checks the sterilizer and load IDs, then requires a file reference. A report from AUT-B2 can reuse the load label A-103 without satisfying the claim for AUT-A1/A-103.

Reproduce both snapshots

Run this from the repo root with Node.js 20 or later. The fixture uses synthetic equipment IDs, cycle IDs, and package counts. MIT source repository

node --input-type=module <<'JS'
import assert from 'node:assert/strict'
import { reconcileSporeTests } from './src/index.js'

const sterilizerId = 'AUT-A1'
const loads = [
  { loadId: 'A-101', date: '2026-05-04', packageCount: 10,
    bi: { result: 'negative', resultDate: '2026-05-05', reportId: 'LAB-A101' } },
  { loadId: 'A-102', date: '2026-05-07', packageCount: 12 },
  { loadId: 'A-103', date: '2026-05-11', packageCount: 9,
    bi: { result: 'positive', resultDate: '2026-05-12', reportId: 'LAB-A103' } },
  { loadId: 'A-104', date: '2026-05-12', packageCount: 6 },
  { loadId: 'A-105', date: '2026-05-13', packageCount: 0,
    bi: { result: 'negative', resultDate: '2026-05-15', reportId: 'LAB-A105', retest: true } },
].map((load) => ({ ...load, sterilizerId }))
const labReports = loads.filter((load) => load.bi).map(({ loadId, bi }) => ({
  id: bi.reportId, sterilizerId, loadId, reference: `reports/${bi.reportId}.pdf`,
}))
const wrongUnit = labReports.map((report) => report.id === 'LAB-A103'
  ? { ...report, sterilizerId: 'AUT-B2' }
  : report)
const snapshot = (asOf, reports = wrongUnit) =>
  reconcileSporeTests({ asOf, loads, labReports: reports }).sterilizers[0]

const before = snapshot('2026-05-14')
const after = snapshot('2026-05-15')
const [window] = after.quarantineWindows
assert.equal(before.quarantineWindows[0].status, 'open')
assert.equal(before.pendingBiLoads[0].loadId, 'A-105')
assert.equal(window.status, 'closed')
assert.deepEqual(window.loads.map(({ loadId }) => loadId), ['A-102', 'A-103', 'A-104', 'A-105'])
assert.equal(window.packageCount, 27)
assert.equal(after.missingEvidence[0].reason, 'report-load-mismatch')
assert.equal(snapshot('2026-05-15', labReports).missingEvidence.length, 0)

console.log(`May 14: ${before.quarantineWindows[0].status}, ${before.pendingBiLoads.length} pending result`)
console.log(`May 15: ${window.status}, ${window.packageCount} affected packages, ${after.missingEvidence.length} evidence exception`)
JS
Enter fullscreen mode Exit fullscreen mode
May 14: open, 1 pending result
May 15: closed, 27 affected packages, 1 evidence exception
Enter fullscreen mode Exit fullscreen mode

The CDC recommends at least weekly spore testing as part of dental sterilization monitoring and provides guidance for responding to positive results. Use the review window to find records for the clinic's designated reviewer, who applies the clinic's approved procedures to recall, quarantine, and release decisions. Keep patient identifiers out of both the input records and file references. CDC dental sterilization monitoring guidance

Change the audit date in the demo's two-sterilizer fixture to watch the pending retest become visible. The demo also has a separate control for a missing lab report. Interactive GitHub Pages demo · Companion Gist

SteriLog's $9.00 One-Time Audit Period Pass unlocks evidence and exception PDFs plus five CSVs for one sterilizer and review window. Use LAUNCH20 at checkout for $7.20. Practice Yearly is $59/yr. SteriLog · Autoclave spore test log sheet guide

For the same practice's treatment estimates and insurance calculations, see DentalPlan.

Top comments (0)