Repository navigation
fix: use dictionary keywords for anonymizer tags - #510
Merged
Merged
Conversation
cleanTags looks up tagNamesToEmpty in DicomMetaDictionary.nameMap, so incorrect or missing keywords were skipped and those PHI tags were left intact.
✅ Deploy Preview for dcmjs2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
97 more tagNamesToEmpty entries used CTP abbreviations or pre-retirement names that never resolve in DicomMetaDictionary.nameMap, so cleanTags silently skipped them and left those PHI tags intact. Retired elements resolve under their RETIRED_ dictionary names. The regression test now asserts every getTagsNameToEmpty() name resolves and is emptied.
✅ Deploy Preview for dcmjs2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
wayfarer3130
approved these changes
Nov 24, 2026
|
🎉 This PR is included in version 0.53.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
wayfarer3130
added a commit
that referenced
this pull request
Nov 27, 2026
) (#674) * fix: registerTag and anonymizer fixes from 0.53.3 (port of #510 and #625) - registerTag() stores the tag in upper case and finds both cases, so a tag registered in lower case keeps its keyword when a file is read. - The first registration of a name keeps the name; a warning names both tags. - DicomMetaDictionary.entryForName() is the one lookup by name (standard keyword first, then a registerTag() name). It is used by denaturalizeDataset(), tagAsIntegerFromName(), entryFor() and cleanTags(), so cleanTags() empties a registered name in a custom list. - dcmjs.data exports registerTag and dictionary again, as in 0.53.3. - The anonymizer list has ResponsiblePersonRole, as in 0.53.3. - MIGRATION.md states the nameMap difference from 0.53.3. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix: registerTag name rules and tag registry requirements (review of #674) - The tag of the first argument wins over entry.tag. - A name that is the keyword of a different tag throws. The keyword of the same tag is accepted with no warning. - When two tags use one name, the second tag gets its hex tag as its name and keeps its VR and VM, so a read and a write keep both values. - A new name for a registered tag removes the old name. - entryForName() reads only own entries of nameMap. - docs/specs/registries.md: REG-U-18 to REG-U-21 for the tag registry; registries-implementation.md: REG-I-23 to REG-I-26. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every
tagNamesToEmptyname now resolves inDicomMetaDictionary.nameMap, socleanTagsactually empties those PHI tags.cleanTagslooks up each name and silently skips any it cannot find. 104 of the 222 live names never resolved, so those tags were left in place.The first commit fixes the seven names from #345:
The second commit renames the remaining 97 to their dictionary keywords: CTP-style
Seqabbreviations (for exampleReferencedImageSequence,OtherPatientIDsSequence), case variants such asAcquisitionDateTime,PatientTelephoneNumbers, and retired elements under theirRETIRED_names. Each one was checked againstnameMap, and none were dropped.Heads up: this changes output for files that carry those tags, since they are now emptied as the list intended. That includes sequences such as
ContentSequenceandReferencedImageSequence, which PS3.15 Table E.1-1 also lists for removal. Callers that copygetTagsNameToEmpty()and splice the old strings will no longer find them, but those strings never matchednameMapanyway.Closes #345
Test plan
test/anonymizer.test.js: builds a dict from every list entry, runscleanTags, and expects empty valuessrc/anonymizer.jsis reverted to the old namestest_anonymization_no_change_ref(that one already fails on Node 26 becausesample-sr.dcmis read via.buffer; not part of this change)