multi-model · onnx-community/deid_bert_i2b2-ONNX (108.51 MB) → Xenova/nli-deberta-v3-xsmall (87.3 MB) · WASM q8

2-stage scrub-before-classify clinical triage

Downstream clinical classifiers should never receive raw patient identifiers. Chain two isolated on-device workers: Stage 1 · Clinical DeID-BERT detects and redacts every HIPAA PHI span locally; Stage 2 · DeBERTa-v3 Zero-Shot NLI reads only the scrubbed payload to route the note into clinical specialty and urgency queues — with live zero-PHI handoff verification.

Synthetic Data & Clinical Safety Notice: All clinical triage notes below are 100% synthetic (zero real patient records). Automated PHI scrubbing is an assistive pre-screening step that requires human review before HIPAA Safe Harbor release or clinical escalation.

1 · Workflow models (~195.8 MB combined)

Stage 1 · Clinical DeID-BERT (i2b2)

token-classification · 45 BILOU HIPAA PHI tags · 108.51 MB q8 · MIT · ./worker.js

Stage 2 · DeBERTa-v3 Clinical Triage NLI

zero-shot-classification · specialty & urgency routing · 87.3 MB q8 · MIT · reuses ../zero-shot-text/worker.js

2 · Clinical note, redaction firewall & triage labels

Stage 1 redaction mode

Prepare both models above to run the 2-stage pipeline.

Stage 1 PHI scrubbed–
Handoff check–
Top triage queue–
Stage 1 / Stage 2 ms–
Stage 2 id2label order–
NaN count–

3 · Stage 1 firewall & Stage 2 sanitized handoff

Stage 1 · Local PHI detection (stays on device)

Run Stage 1 to detect and highlight HIPAA PHI spans.

Firewall handoff · Sanitized payload sent to Stage 2

Only this scrubbed text enters Stage 2.

4 · Stage 2 clinical triage scores (mapped from res.classNames)

Stage 2 DeBERTa-v3 zero-shot clinical specialty and urgency triage scores
Rank Clinical Queue / Urgency Score Confidence Entailment Neutral Contradiction
Run Stage 2 to classify the scrubbed note.

How it works

Show the code — verifying zero original PHI tokens remain in the Stage 2 handoff payload
Show the code — dynamic NLI class mapping from res.classNames in deid-core.mjs