A pure, deterministic, dependency-free de-identification engine (the Excisor engine). Give it text, get back text with the identifying information detected and replaced — the same input always produces byte-identical output, so a CI gate or an extraction check can trust it.
- Zero runtime dependencies. No network, no globals, no clock. Just the JS/Node standard library.
- Deterministic. Same
(text, options)⇒ identical spans and identical output, every run. - Local by design. Nothing is uploaded anywhere; your originals are never modified.
- Two detection lanes + optional NER, four+ transform modes, checksum validators, and a batch mode that emits a redaction certificate.
This engine supports HIPAA Safe-Harbor de-identification (45 CFR 164.514(b)(2)). It is not an Expert Determination (45 CFR 164.514(a)) — that judgment remains yours.
npm install @simdad/wordlist-coreimport { detect, transform } from '@simdad/wordlist-core';
const text = 'Email [email protected] or call 555-123-4567. DOB 1980-04-12.';
const spans = detect(text, { profile: 'hipaa' });
const { text: safe } = transform(text, spans, 'mask');
// safe → "Email [REDACTED: email] or call [REDACTED: phone]. DOB [REDACTED: date]."The two calls are the whole story: detect finds identifiers (as non-overlapping spans, in document order), transform replaces them. Everything else is options and reporting.
Structured (shape) detection catches the Safe-Harbor identifiers no one types into a list — email, phone, fax, SSN, ITIN, dates, account/credit-card/IBAN numbers, URLs, IPs, ZIPs, MRNs, ages — selected by a profile:
type Profile = 'hipaa' | 'ferpa' | 'gdpr' | 'off';
detect(text, { profile: 'ferpa' });Wordlist (literal) detection finds caller-supplied terms (codenames, known names, banned words):
import { deidentify, mark } from '@simdad/wordlist-core';
const wordlist = [{ term: 'Project Aurora', category: 'codename' }];
mark('Project Aurora ships Q3', wordlist);
// [{ term: 'Project Aurora', start: 0, end: 14, matched: 'Project Aurora', category: 'codename' }]
deidentify('Project Aurora ships Q3', wordlist);
// { text: '«CODENAME_001» ships Q3', mapping: { '«CODENAME_001»': 'Project Aurora' }, replacements: 1 }Use both at once — they merge into one overlap-resolved span list:
detect(text, { profile: 'hipaa', wordlist });Free-text person/org/location detection is off the lean path: the core bundles no model and takes no onnxruntime dependency. With no backend wired, detection is shape-only (no error). To enable it, register a backend and use the async path:
import { setNerBackend, detectAsync } from '@simdad/wordlist-core';
setNerBackend(myNerDetector); // you supply this
await detectAsync(text, { profile: 'hipaa', includeNer: true });If you wire a model, you own its license hygiene (see NOTICE: use an Apache-2.0 GLiNER v2.1+ model; reject v1 / Pile-NER weights).
type TransformMode = 'mask' | 'placeholder' | 'generalize' | 'safe-harbor' | 'pseudonym';| Mode | Result | Reversible? |
|---|---|---|
mask |
labelled mask [REDACTED: email] |
no |
placeholder |
stable «EMAIL_001» per distinct identifier |
yes — via mapping |
generalize |
Safe-Harbor coarsening (date → year, ZIP → 3-digit) | no |
safe-harbor |
strict superset of generalize (restricted ZIP → 000XX, age > 89 → 90+) |
no |
pseudonym |
«EMAIL~<digest>» via a caller-supplied keyed function |
only with the key |
const { text: masked } = transform(text, spans, 'placeholder');
// masked → "Email «EMAIL_001» ..."; then:
const { mapping } = transform(text, spans, 'placeholder');
// mapping → { '«EMAIL_001»': 'jane@example.com' }The
placeholder/pseudonymreversalmappingre-links identities. Treat it as a secret — store it in a keystore or password manager, never beside the de-identified output, never share it.
pseudonym keeps the engine key-free — you inject the keyed digest so tokens are stable across documents without storing any mapping:
import { createHmac } from 'node:crypto';
transform(text, spans, 'pseudonym', {
pseudonymize: (value, prefix) =>
createHmac('sha256', myKey).update(`${prefix}:${value}`).digest('hex').slice(0, 12),
});A per-document, clock-free record of which lanes ran and what was found — a technical trail that supports Safe-Harbor:
import { generateCoverageReport, formatCoverageReport } from '@simdad/wordlist-core';
const report = generateCoverageReport(text, spans, { profile: 'hipaa' });
console.log(formatCoverageReport(report));Exported so you can offer "validate this span" affordances or reuse them on your own fields:
import { luhnValid, ibanValid, deaValid, npiValid, vinValid, mbiValid, itinValid } from '@simdad/wordlist-core';
luhnValid('4111111111111111'); // truePure engine half — you own I/O, hashing, and the clock (injected, so the engine stays deterministic):
import { processBatch, formatCertificate } from '@simdad/wordlist-core';
import { createHash } from 'node:crypto';
const { items, summary } = processBatch(
[{ name: 'notes.txt', kind: 'text', content }], // kind: 'text' | 'csv' (CSV is de-identified cell-by-cell)
{ profile: 'hipaa', mode: 'mask' },
{ timestamp: new Date().toISOString(), hash: (c) => createHash('sha256').update(c).digest('hex') },
);
for (const item of items) {
writeOutput(item.name, item.result.output); // your I/O
writeCert(item.name, formatCertificate(item.certificate));
}
console.log(summary); // { documents, totalReplacements, countsByCategory, flagged }The package ships a deid command:
# Single file (or stdin) → de-identified text on stdout
deid notes.txt --profile hipaa --mode mask > notes.deid.txt
cat notes.txt | deid --report > safe.txt
# Extra literal terms, one per line
deid notes.txt --wordlist codenames.txt
# Batch: writes <file>.deid + <file>.cert.txt beside every .txt/.md/.csv, plus a summary.
# Originals are never touched; re-running skips the tool's own outputs.
deid --batch ./records --profile hipaa --mode safe-harborFlags: --profile hipaa|ferpa|gdpr (default hipaa), --mode mask|placeholder|generalize|safe-harbor (default mask), --wordlist <file>, --report, --batch <dir>, --help.
- Your originals are never modified. Every mode returns a new string (and the CLI/batch writes copies).
- Deterministic, so it is safe inside CI gates and reproducible pipelines.
- NER is off by default — without a wired backend, free-text names/orgs are not caught by shape alone.
- Supports, does not certify. This is a mechanical Safe-Harbor aid, not a HIPAA Expert Determination.
- The reversal mapping is sensitive — handle it like a credential.
Apache-2.0 © 2026 SIM DAD LLC. Dependency-free; see NOTICE.