Supporting new types of PII operators
Operators are the presidio-anonymizer actions over the text.
There are two types of operators: - Anonymize (hash, replace, redact, encrypt, mask) - Deanonymize (decrypt)
Presidio anonymizer can be easily extended to support additional anonnymization and deanonymization methods.
Extending presidio-anonymizer for additional PII operators:
- Under the path presidio_anonymizer/operators create new python class implementing the abstract Operator class
- Implement the methods:
operate- gets the data and returns a new text expected to replace the old one.
validate- validate the parameters entered for the anonymizer exists and valid.
operator_name- this method helps to automatically load the existing anonymizers.
operator_type- either Anonymize or Deanonymize. Will be mapped to the proper engine.
- Add the class to presidio_anonymizer/operators/init.py.
- Restart the anonymizer.
The list of operators is being loaded dynamically each time Presidio Anonymizer is started.