13/38
Part 2 of 6 · The indexLearn and do

Redact before anything is indexed, sent or logged

Past tickets and live conversations carry names, emails, phone numbers, addresses, payment details and messages between guests and hosts. Remove them at three points: before indexing, before text goes to a model, and before logging.

Layer it:

  1. Patterns for structured data like emails, phone numbers and card numbers.
  2. A named-entity model for names and addresses.
  3. An allowlist, so policy terms don't get masked.

No tool is complete. Presidio, a tool for finding and removing personal data, says in its own documentation that its automated detection can't guarantee it finds all sensitive information. So measure redaction recall on a labeled sample of tickets, like any other model.

Document redaction showed up as a coding question in the same reported loop (1 report), so expect the interviewer to push here.

In the editor, write redact(text): the pattern layer, with Python's re module. The example holds an email, a phone number and a card number, plus a policy code and a date that must come through unchanged.