Skip to content

Packs / healthcare-admin-public

deidentify-clinical-text

Redact identifiers (names, dates, phone, email, record numbers, addresses, ZIPs) from clinical free text before it is shared or analysed

L2 Checks passed 3 of 3 runsv1.0.0Tech-Realm/space-healthcare-admin-public

Install

logicpacks pack use healthcare-admin-public/deidentify-clinical-text
get_pack healthcare-admin-public/deidentify-clinical-text

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: local-python
  • Checks: 2 in outcome/checks.yaml
  • Code: deid.py
  • Tools: python3

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Goal

A redacted copy of free text with HIPAA Safe Harbor style identifiers replaced by tags ([NAME], [DATE], [PHONE], [EMAIL], [MRN], [ZIP3]) and a count per type; dates reduced to year.

Verified by: Synthetic note: every planted identifier is replaced, clinical content (medications, vitals) is untouched.

Steps

  1. Run python3 code/deid.py note.txt --names names.txt > note.redacted.txt.
  2. Review the redacted text by eye; add missed names to names.txt and re-run.
  3. Only share data that passed human review, under the organisation's policy (BAA/DUA).

Edge cases

  • Names without a title or not in the names list can be missed; use the names list from the record's demographics.
  • Ages over 89 must be grouped as 90+ (done).
  • ZIP codes keep 3 digits; Safe Harbor requires 000 for sparsely populated ZIP3s, check the census list.

Don'ts

  • Never put real patient data in fixtures, prompts, logs or git; fixtures are synthetic.
  • Don't call rule-based output 'de-identified' for compliance without expert determination or full Safe Harbor review.
  • Don't send identifiable text to any cloud API to redact it.