Skip to content

fix: LICENSE resolves to a single entity in the hierarchy (#199) - #207

Merged
omri374 merged 1 commit into
data-privacy-stack:mainfrom
cpruijsen:fix/issue-199
Sep 14, 2026
Merged

omri374 merged 1 commit into
data-privacy-stack:mainfrom
cpruijsen:fix/issue-199

Conversation

@cpruijsen

Copy link
Copy Markdown
Contributor

LICENSE is defined twice in the entity hierarchy: as a leaf under EMPLOYMENT, and as an alias of
GOVERNMENT_ID > PROFESSIONAL_LICENSE. The two lookups disagree, so canonicalize("LICENSE")
returns PROFESSIONAL_LICENSE while to_branch("LICENSE") returns EMPLOYMENT, and which one a
caller gets depends on which function it happens to use.

The EMPLOYMENT leaf is removed from presidio_evaluator/entity_mapping/definitions.py.
PROFESSIONAL_LICENSE under GOVERNMENT_ID is the better home: it is where the alias already
pointed, and a professional license is an identifier issued by an authority rather than an employment
attribute.

This changes evaluation results for datasets annotated with a LICENSE label, which now score against
the GOVERNMENT_ID branch. That is the point of the fix rather than a side effect, so it is called
out in the changelog rather than left to be discovered.

docs/mapping_scenarios.md drops the LICENSE row from its table of duplicate aliases, since it is
no longer one. The remaining rows there are other instances of the same class and are not touched
here.

Fixes #199

…cy-stack#199)

LICENSE was defined twice: a canonical leaf under EMPLOYMENT and an alias
of GOVERNMENT_ID > PROFESSIONAL_LICENSE. The alias won the raw->canonical
map while to_branch() saw the leaf first, so one label reported two
branches - and add_alias("LICENSE", x) attached aliases to the EMPLOYMENT
leaf while canonicalize() sent them to GOVERNMENT_ID.

A license is a government-issued ID: drop the EMPLOYMENT leaf so LICENSE
resolves to PROFESSIONAL_LICENSE under GOVERNMENT_ID in every lookup.

@omri374 omri374 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@omri374
omri374 merged commit 6db3769 into data-privacy-stack:main Sep 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LICENSE is defined twice in the entity hierarchy

2 participants