The challenge
Court decisions are full of personal data: names of parties, witnesses and minors, addresses, ID numbers and financial details, often written inconsistently across thousands of documents and jurisdictions.
Publishing or indexing them safely demanded near-complete detection. A single missed name of a minor is a legal and ethical failure, so a simple named-entity pass was not enough.
Original
Le mineur Koffi A., domicilié à Cocody, rue des Jardins, représenté par sa mère Awa D.… K. Adjouaconfirme…
Anonymized
Le mineur [MINEUR 1], domicilié à [ADRESSE], représenté par sa mère [PARTIE B]… [MINEUR 1]confirme…
- Pass 1Contextual entities (Claude)
- Pass 2Patterns & identifiers
- Pass 3Variants & later mentions
4 entities · 1 variant spelling caughtminor-protection rules applied
Architecture · 6 stages
- 01
Parse
Decision text and structure extraction
- 02
Search 1
Contextual entity detection with Claude
- 03
Search 2
Pattern and rule-based identifiers
- 04
Search 3
Document-wide variant and mention search
- 05
Reconcile
Merge passes, apply minor-protection rules
- 06
Release
Anonymized output to index and publication
The solution
I designed a triple-search architecture: three complementary detection passes run over every decision, and their results are reconciled so that an entity caught by one pass is masked everywhere it appears, including variant spellings and later references.
Claude handles the context-heavy judgment, such as telling a party's name from a street name, while rule-based and search-based passes enforce consistency across the full document.
Stricter rules protect minors and other vulnerable parties, and multi-jurisdiction privacy requirements are applied per document. The engine is the mandatory gate in front of the Data Greffe Justice platform: nothing reaches the index without passing through it.
Engineering highlights
- Triple-search detection with cross-pass reconciliation
- 98% PII detection accuracy on legal case decisions
- Stricter masking rules for minors and vulnerable parties
- Consistent masking of variant spellings and repeat mentions
- Multi-jurisdiction privacy rules applied per document
- Mandatory gate before indexing and publication
Technology
- Python
- Claude API
- OpenAI
- Elasticsearch
- NER
- Flask
Related services
Building something similar?
Get a candid view of the architecture, risks and timeline on a free 30-minute call, or ask the AI assistant how this approach would map to your project.