Skip to content

Repository files navigation

Filing Redactor 📝🔒

PII redaction for e-filed legal documents (India).

Every plaint, brief, and agreement a lawyer e-files carries personal data — phone numbers, emails, bank accounts, Aadhaar, PAN, client names — and courts increasingly require it masked before filing. Blacking out by hand in a PDF editor leaves the text recoverable underneath. This tool physically removes the data from the PDF file itself.

What it detects

Type Example
Aadhaar (grouped or plain) 2345 6789 0123
PAN ABCDE1234F
Mobile (with/without +91) +91-9876543210
Email priya.nair@example.net
Bank account / long digit runs (9–18 digits) 5478123900123456
Party names & parentage (S/o, W/o, D/o …) Sh. Suresh Sharma
Full addresses — party blocks & text body R/o 456, Laxmi Nagar, New Delhi - 110092
residing at C-15, Green Park Colony, New Delhi - 110016
Address markers + PIN (H.No, Flat No, Village, District, Post …) Flat No. 12, Sector 45, Noida - 201301

Safe by design: role words (Plaintiff, Defendant, Petitioner, Counsel, Judge, Court) are never redacted, even when an address ends on the same line as ... Plaintiff. Court titles (DISTRICT JUDGE) are untouched.

Install (one time)

cd ~/Documents/filing-redactor
python3 -m pip install pymupdf

Usage

1. Scan a PDF — see what PII is in it (no changes):

python3 filing_redactor.py scan plaint.pdf

2. Add party/client names (optional, text file, one name per line):

echo "Ramesh Kumar Sharma" >> names.txt
echo "Priya Nair" >> names.txt

3. Redact — produce a clean file (original untouched):

python3 filing_redactor.py redact plaint.pdf -o plaint_redacted.pdf --names names.txt

Add --strip-metadata to also wipe the author/title hidden fields.

Proof it works

  • sample_plaint.pdf — a fake plaint with 10 PII items
  • redacted_plaint.pdf — after redaction, pdftotext shows 0 of the original PII remain. Redaction boxes are rendered (not just drawn), so the data under them is gone from the file.
  • visual_before.png / visual_after.png — side-by-side view

Notes

  • Works on text-layer PDFs (Word/Google Docs/Scanned-with-OCR output). Pure image scans need OCR first (e.g. the free ocrmypdf).
  • The original file is never modified — you always get a new output file.
  • scan never writes; redact never overwrites in place.

About

PII redaction for Indian e-filed legal documents — removes Aadhaar, PAN, mobiles, client names & addresses from pleadings PDFs while preserving role labels and court titles

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages