﻿# Pseudonym key rotation in datasets: preserve longitudinal identity without mixing key epochs

Pseudonym key rotation in datasets: preserve longitudinal identity without mixing key epochs. A practical data-quality guide with failure mechanisms, validation steps, acceptance evidence and primary references.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/dq-pseudonym-key-rotation-longitudinal-joins/
Language: en

A dataset derives pseudonymous entity keys from source identifiers. Rotating the derivation key changes every pseudonym, splitting a longitudinal history or creating misleading unmatched joins between releases.

## The mechanism that changes the example

Deterministic derivation is deterministic only under the same key and input convention. A pseudonym therefore needs an epoch or namespace, while any permitted cross-epoch mapping requires controlled treatment.



## Define the comparison boundary

Define the derivation input as a typed, unambiguous encoding of the source namespace and entity key. Key rotation and an input-encoding change are separate causes of pseudonym changes; record them separately so a failed join can be diagnosed.

Keep a non-secret epoch identifier beside the derived key. A consumer can then reject incompatible joins without obtaining the secret derivation material. Any authorized cross-epoch mapping belongs to a separately governed artifact, with its own allowed users and retention decision.

Validate within-epoch repeatability using synthetic entities, then rotate only the test key. Check that legitimate longitudinal linkage follows the approved mapping and that ordinary release metadata cannot reconstruct that mapping by itself. This protocol addresses data identity, not a claim that deterministic pseudonyms make a dataset anonymous.

## A constructed test case

Create synthetic entity names under an old and a replacement derivation key. A longitudinal join may use an approved mapping, but a mixed-epoch join without that mapping must expose unmatched identities rather than guess continuity.

## A reproducible validation procedure

Rotate a test key over fixed synthetic entities. Check within-epoch equality and explicit cross-epoch behavior. Require consumers to reject mixed epochs unless an approved mapping is supplied; never place derivation secrets in dataset manifests.

Include an unchanged control and a deliberately invalid case. Verify that the checker distinguishes them before testing the complete release.

Exercise the actual preparation path, including later serialization and reload. Limit retained diagnostic content to the evidence required for this comparison.

## Evidence needed for acceptance

Keep epoch identifiers, authorized linkage policy and non-secret fixture results.

## Containment and recovery

Pseudonymization does not establish anonymity; linkage and disclosure risks require separate assessment.

Quarantine an invalid release candidate or use an explicit partial-release rule. Preserve the last approved artifact and record corrections without silently rewriting historical inputs.

## Interpretation and references

Implementation references: [HMAC specification](https://www.rfc-editor.org/rfc/rfc2104.html); [pandas merge validation](https://pandas.pydata.org/docs/reference/api/pandas.merge.html).

This is a proposed engineering validation, not an executed Retrivium benchmark. Documentation specifies interfaces; dataset acceptance needs its own evidence and must be repeated after relevant dependency changes.

## Related reading

Continue with [Presidio dataset redaction: detection spans, replacement offsets and provenance](/journal/data-guide-pii-redaction-offset-lineage/); [Documents to Markdown or JSON: preserve evidence provenance for RAG](/journal/document-markdown-json-provenance/). These guides supply adjacent context; the decision in this article remains the specific example-preservation check above.
