Skip to content

ABBREVIATE strategy redacts dictionary name entities instead of producing initials #320

Description

@jzonthemtn

Summary

The ABBREVIATE redaction strategy is documented as "reduce the detected value to its initials," but it only produces initials on the PhEye NER person path. Applied to the dictionary-based name entities (SURNAME, FIRST_NAME, PHYSICIAN_NAME), it compiles and validates but at runtime silently falls back to full redaction instead of initials.

Where it works vs. does not

  • Works (PhEye/NER path): PhEyeFilterStrategy implements ABBREVIATE for the PER label via WordUtils.initials(...) so "John Smith" becomes "JS" (src/main/java/ai/philterd/phileas/services/strategies/ai/PhEyeFilterStrategy.java:184-190).
  • Broken (dictionary name entities): SurnameFilterStrategy, FirstNameFilterStrategy, and PhysicianNameFilterStrategy all extend StandardFilterStrategy (line 35 of each), and StandardFilterStrategy has no ABBREVIATE branch. An unrecognized strategy therefore hits the trailing else and is fully redacted via getRedactedToken(...) (src/main/java/ai/philterd/phileas/services/strategies/StandardFilterStrategy.java:121-124).

The strategy constant is defined at src/main/java/ai/philterd/phileas/services/strategies/AbstractFilterStrategy.java:60 (ABBREVIATE = "ABBREVIATE").

Impact

A policy intended to reduce names to initials (for example FRBP 9037 / bankruptcy redaction that reduces minors' names to initials) silently over-redacts to {{{REDACTED-...}}} when written against the dictionary name entities. The redaction is stronger than intended rather than weaker, so it is not a data-exposure bug, but the output is wrong and fails silently, and it diverges from the documented strategy semantics. The PhiSQL catalog documents ABBREVIATE as "Reduce the detected value to its initials," and PhiSQL example 04-frbp-9037.phisql and the accept case abbreviate.phisql both apply ABBREVIATE to SURNAME as if it yields initials, reinforcing the wrong expectation.

Fix

Implement ABBREVIATE in StandardFilterStrategy so it returns the value's initials (mirroring PhEyeFilterStrategy's use of org.apache.commons.text.WordUtils.initials(...)) instead of falling through to redaction. Leave the existing PhEye ABBREVIATE behavior unchanged.

This is a conformance fix that restores the documented catalog semantics; it does not require a PhiSQL RFC (per phisql CONTRIBUTING.md: "bug fixes where the spec is unambiguous and the implementation diverged from it").

Acceptance Criteria

  • StandardFilterStrategy.getStandardReplacement(...) handles the ABBREVIATE strategy and returns the value's initials (for example "John Smith" produces "JS") rather than redacting.
  • SURNAME, FIRST_NAME, and PHYSICIAN_NAME filters produce initials when their policy specifies the ABBREVIATE strategy.
  • Existing PhEye ABBREVIATE behavior (PER label produces initials) is unchanged.
  • Unit tests cover ABBREVIATE on at least SURNAME and FIRST_NAME, asserting initials output for both a multi-token value ("John Smith" produces "JS") and a single-token value.
  • Output is consistent with the documented strategy description ("reduce the detected value to its initials"), so a policy equivalent to PhiSQL's 04-frbp-9037.phisql reduces surnames to initials end to end.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions