Skip to content

fix(anonymizer): correct the 103 non-resolving names in tagNamesToEmpty - #590

Merged
awatson1978 merged 1 commit into
release/1.0-beta-corefrom
core/anonymizer-names
Oct 3, 2026
Merged

awatson1978 merged 1 commit into
release/1.0-beta-corefrom
core/anonymizer-names

Conversation

@awatson1978

Copy link
Copy Markdown
Collaborator

This closes the last code item of review finding 2 (anonymizer.js, cleanTags) from the PR #512 review map — the documentation half pre-landed in #562, and this PR delivers the list it promised.

What was wrong: the anonymizer's default tagNamesToEmpty list carried 103 entries that match no dictionary keyword — singular/plural mistakes like PhysicianOfRecord and OperatorName, plus ad-hoc abbreviations like RefStudySeq and SPSStartDate. cleanTags resolves each name through DicomMetaDictionary.nameMap and silently skips anything that doesn't resolve, so nearly half the list did nothing and the data those entries were meant to scrub stayed in the file. That's issue #345.

The fix ports the corrected list from the rewrite line: all 103 non-resolving entries mapped 1:1 to their real dictionary keywords, with retired attributes using the dictionary's RETIRED_ prefix. Nothing else in the file changed — getTagsNameToEmpty() already returned a copy on this branch, and cleanTags itself is untouched. I verified the port is confined to the list and its header comment by diffing everything below the list against v2.0-development (identical).

Why the new behavior is right: PS3.15 Table E.1-1 (the Basic Application Level Confidentiality Profile) assigns removal actions to these attributes. The most consequential newcomers are six sequences that can carry diagnostic content — ContentSequence (0040,A730), SourceImageSequence (0008,2112), ReferencedImageSequence (0008,1140), AcquisitionContextSequence (0040,0555), RequestAttributesSequence (0040,0275), IconImageSequence (0088,0200). Leaving them untouched, which is what the misspelled list silently did, is the behavior that departs from the profile. The review map's verdict on finding 2 is that this widening is an improvement to keep, not a regression to revert.

If you depended on the old behavior: the opt-out already exists as a parameter — getTagsNameToEmpty() returns a copy, filter out the names you want to keep, and pass the result as the third argument to cleanTags. The recipe is written out in docs/BREAKING_CHANGES.md under "Fix anonymizer keywords", whose "not yet landed" status note this PR replaces with the landed reality.

Red-green story: test/issues/issue345-anonymizer-names.test.js carried the structural pin as an it.skip KNOWN GAP. I unskipped it and added a behavioral test (a ContentSequence holding SR text must come out of cleanTags empty); both failed against the old list — the pin's diff listed all 103 non-resolving names, and the ContentSequence survived untouched. Both pass with the corrected list. The 0.x suite test/anonymizer.test.js passes unchanged — none of its assertions depended on the broken entries, so no deliberate adjustments were needed. Catalog entry #345 flips gap → green. Full suite: 846 passed / 11 skipped / 857 total (baseline 844/12/856 — one unskip, one new test), pnpm run build green.

Master note, for honesty's sake: the same broken list exists on master today, so a hotfix there is a legitimate candidate — but master hotfixes are currently deferred by the repo owner, so this PR targets the release branch only.

🤖 Generated with Claude Code

The default tagNamesToEmpty list carried 103 entries that matched no
dictionary keyword (misspellings, singular/plural mistakes, and ad-hoc
abbreviations like RefStudySeq), so cleanTags silently skipped the
attributes they were meant to scrub and the PHI survived anonymization
(issue #345). Port the corrected list from the rewrite line: every
entry now maps 1:1 to its real dictionary keyword, with retired
attributes using the dictionary's RETIRED_ prefix. The most visible
newcomers are the six diagnostic sequences named in
docs/BREAKING_CHANGES.md (ContentSequence, SourceImageSequence,
ReferencedImageSequence, AcquisitionContextSequence,
RequestAttributesSequence, IconImageSequence), which PS3.15 Table
E.1-1 assigns removal actions to.

Unskips the KNOWN GAP #345 structural pin (every name resolves via
DicomMetaDictionary.nameMap), adds a behavioral test that a
previously-skipped ContentSequence is actually emptied, flips the
catalog entry to green, and updates the pre-landed BREAKING_CHANGES
entry's status note.

Closes review finding 2 of the PR #512 review map.

Co-Authored-By: Claude Fable 5 <[email protected]>
@awatson1978
awatson1978 merged commit 269a8fc into release/1.0-beta-core Oct 3, 2026
8 checks passed
@awatson1978
awatson1978 deleted the core/anonymizer-names branch October 3, 2026 02:11
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant