Skip to main content
Version: v0.0.7

Function: deidentify()

deidentify(model, options): DeidResult

De-identify a format-agnostic LocusModel under a policy. Returns the transformed document and a value-free manifest. The input model is never mutated; the result is deeply frozen.

The output is "Safe-Harbor-transformed per the configured policy" - it is not certified de-identified, and Expert Determination is not rendered.

Parameters

model

The located candidate values to de-identify.

loci?

readonly GenericLocus[]

options

DeidOptions

The policy and (for keyed transforms) the key context.

Returns

DeidResult

The frozen DeidResult: transformed document + value-free manifest.

Throws

DeidError EMPTY_INPUT if the model is null or carries no locus list; DEID_NO_KEY if a keyed transform is required but no key context was supplied.

Example

import { deidentify, SAFE_HARBOR_CATEGORIES } from "@cosyte/deid";

const result = deidentify(
{ loci: [{ path: "PID-19", kind: "identifier", category: SAFE_HARBOR_CATEGORIES.SSN, value: "SENTINEL" }] },
{},
);
result.document.loci[0]?.value; // => null (removed)
result.manifest[0]?.disposition; // => "removed"