Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Document Ingestion Pipelines

Free · sign in to start and track progress

1 · Reading real-world documents

  • 1What a real case file contains
  • 2Parsing: text layers to vision models
  • 3Tables, plans and handwriting
  • 4Structured extraction at scale

2 · Running ingest in production

  • 5Durable ingest pipelines
  • 6Re-ingestion, versioning and backfills
  • 7PII detection and redaction

    Exercise answers

    • Answer: Build and measure a hybrid PII detector
    • Answer: Redact a PDF and prove it
  • 8Ingest evals and the hand-off
CapstoneIngest a case file end to endReference implementation

Module 2 · Running ingest in production · Lesson 7

PII detection and redaction

Where personal data flows in an ingest pipeline, which uses need it and which don't, how to detect it with rules, NER and LLMs, how to pseudonymise consistently and redact PDFs properly, and how to measure recall under data-protection law such as GDPR.

75 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uv

By the end of this lesson you can

  • Map where personal data flows through ingest and decide, use by use, whether it needs identified, pseudonymised or redacted data under data minimisation
  • Distinguish redaction, masking, pseudonymisation and anonymisation as the ICO uses the terms, and explain why title numbers and addresses are quasi-identifiers
  • Implement detection with Presidio's pattern recognisers plus custom domain recognisers, consistent keyed pseudonyms, and an LLM second pass with span verification
  • Redact PDFs so the underlying text is removed, and measure detection recall and the leaks it implies per case

On this page

  • Intuition: the file, the photocopy and the training binder
  • Where personal data flows
  • The vocabulary, precisely
  • Why conveyancing documents are hard to anonymise
  • Detection: rules, NER and LLMs
  • Presidio plus conveyancing recognisers
  • Consistent pseudonyms
  • Redacting PDFs properly
  • Measuring: recall is the number that matters
  • UK GDPR touchpoints for ingest
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Intuition: the file, the photocopy and the training binder
  2. 02Where personal data flows
  3. 03The vocabulary, precisely
  4. 04Detection: rules, NER and LLMs
  5. 05Redacting PDFs properly
  6. 06Measuring: recall is the number that matters
  7. 07UK GDPR touchpoints for ingest
  8. 08Connections
  9. 09Summary

Sources & further reading

  • The Text Anonymization Benchmark (TAB): A Dedicated Corpus and Evaluation Framework for Text AnonymizationPaper · Pilán, Lison, Øvrelid, Papadopoulou, Sánchez, Batet · 2022Computational Linguistics. Built on European Court of Human Rights judgments, so close to legal documents. Its distinction between direct and quasi-identifiers, and its recall-oriented metrics, are the right way to evaluate redaction.
  • Large Language Models are Advanced AnonymizersPaper · Staab, Vero, Balunović, Vechev · ETH Zurich · 2024Shows that LLMs can infer personal attributes from text that rule-based anonymisers leave behind, and that LLM-based anonymisation can do better. Read the introduction for why removing named entities is not enough.
  • An Evaluation Study of Hybrid Methods for Multilingual PII DetectionPaper · Rajgarhia et al. · 2025Combines deterministic regular expressions with context-aware LLMs, the hybrid design this lesson recommends, and reports where each half contributes.
  • Pseudonymisation (ICO guidance)Lab research · Information Commissioner's OfficeThe regulator's position that pseudonymised data is still personal data in the hands of anyone holding the additional information, and that the additional information must be kept separately and secured. The guidance notes it is under review following the Data (Use and Access) Act 2025.
  • How do we ensure anonymisation is effective? (ICO guidance)Lab research · Information Commissioner's OfficeIdentifiability, the "reasonably likely" test and the motivated intruder test. Use it to judge whether a redacted dataset is anonymous or merely pseudonymised.
  • Data minimisation (ICO guidance)Lab research · Information Commissioner's OfficeArticle 5(1)(c) - personal data must be adequate, relevant and limited to what is necessary for the purpose. The principle behind deciding, use by use, what an ingest output may contain.
  • Presidio supported entitiesDocs · Presidio (Data Privacy Stack)The built-in recognisers, including UK_NHS, UK_NINO, UK_PASSPORT, UK_POSTCODE, UK_DRIVING_LICENCE and UK_VEHICLE_REGISTRATION, and how each is detected (pattern, context, checksum).
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 9 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks