cognovis De-Identification IG for German Practice Data
0.17.2 - release Germany

cognovis De-Identification IG for German Practice Data - Downloaded Version 0.17.2 See the Directory of published versions

TypeScript SDK Contract

TypeScript SDK Contract

@cognovis/fhir-deidentification-sdk is the executable TypeScript projection of this IG's Library/pii-fields-manifest, Library/scrub-patterns, and Library/generalize-methods. Its generated catalogues are reproducible from those IG-owned inputs; the package has no provider-specific application, endpoint, credential, tenant, AI, or LLM-provider dependency.

Profile and structured-value boundary

The public transform<TProfile>(resource, policy, context) API accepts and returns the same selected R4 profile type. A caller may supply its profile validator; validation runs before and after a successful transform. The SDK transforms required structured values into values of the same FHIR primitive shape. It does not remove required content, fabricate clinical facts, perform runtime repair, add DataAbsentReason values, or create R5 output.

The SDK does not follow the IG's Masking Export Path yet. A withheld value becomes an in-band [REDACTED] placeholder, not an omitted element or a data-absent-reason code or extension.

Clinical codes are not a general free-text target. Only catalogued fields and the generated generalization methods are transformed. Where the catalogue scrubs the author-written text of a coded concept, the codings beside it, including Coding.display, stay unchanged. An unknown catalogued method fails closed with a typed error that names its catalogue entry.

Graph and policy boundary

One transform context preserves equality across all catalogued IDs and FHIR references. For Bundles, entry.fullUrl and contained resource IDs are rewritten coherently; recursive reference rewriting includes Provenance.target.

When resources use absolute internal references outside observed Bundle fullUrl values, callers must provide the internal FHIR endpoint through TransformContext.internalFhirBaseUrl. The SDK rewrites only references under that origin and base path; absolute references on other hosts remain unchanged. Without the declaration, an absolute reference ending in a known source ResourceType/id fails closed because its ownership is ambiguous.

development-pseudonymized is labelled PSEUDED. It can retain exactly one typed KVNR source identifier for an authorized VPN lookup; no other source identifier is a policy exception. anonymous-export is labelled ANONYED. The caller creates one explicit createAnonymousExportContext() for an export scope, supplies it through the transform context for every resource in that scope, and destroys it in the scope's finally block. The context preserves graph equality across those calls; destruction clears its mappings, zeroes its secret, and prevents reuse.

For an id-less resource that owns contained resources, stable contained IDs use the source JavaScript object's identity within the anonymous export context. Reusing that same object is stable; parsing or cloning it creates a deliberately distinct container scope.

Deterministic scrubbing uses known context values, their supplied variants, and the generated scrub-pattern Library. transform always derives known values from the resource it transforms: the HumanName family and given strings and their whitespace- and hyphen-separated tokens, each longer than two characters, without lower-case name particles such as von or der. collectKnownValues(resource) returns those values as a fresh, deduplicated array, so a caller can pass a patient's values through TransformContext.knownValues when it transforms the patient's other resources. A known value matches only as a whole word, case-insensitively and with an optional genitive s; a known value inside a longer word or a scrub placeholder is left alone. Development pseudonymization may retain scrubbed clinical text. Anonymous export replaces a catalogued free-text field as a neutral whole-field value when residual uncertainty remains. These boundaries do not claim semantic anonymity beyond the configured policy.

Consumer boundary

The FHIR SDK owns its integration and re-export. Downstream applications own their policy selection and removal of superseded local transports or generators. Consumers use the packed, provider-neutral public API and must not treat this package as an authorization or persistence layer.