Type Alias: FreeTextRedactor
FreeTextRedactor = (
request) =>FreeTextRedactionResult|null|undefined
A consumer-supplied free-text redactor. The engine invokes it at each free-text locus and treats a
returned FreeTextRedactionResult as consumer-asserted (recorded as
DEID_FREETEXT_CONSUMER_REDACTED). Returning null / undefined - or throwing - makes the engine
fail closed and block the locus. The library never inspects the returned text for residual PHI;
completeness is the consumer's responsibility.
Parameters
request
The free-text value, its value-free locus path, and its category when known.
Returns
FreeTextRedactionResult | null | undefined
The redacted prose as { text }, or null / undefined to decline (engine blocks).
Example
import { deidentify, type FreeTextRedactor } from "@cosyte/deid";
// A consumer plugs in their own detector; the library bundles none.
const redactor: FreeTextRedactor = ({ text }) => ({ text: myNerModel.scrub(text) });
const result = deidentify(model, { redactor });