phi-deidentifier
Use this skill whenever the user asks to de-identify, redact, anonymise, scrub, or remove PHI/PII from clinical text, notes, transcripts, or documents before sharing, exporting, or using them for analytics, testing, or demos — e.g. "de-identify this note", "strip patient info", "make this HIPAA Safe Harbor compliant", "produce a limited data set". It removes the 18 HIPAA Safe Harbor identifiers and emits an audit manifest of what was removed. Run the bundled scripts/deidentify.py — do NOT hand-write redaction regexes yourself. This skill prepares de-identified text and an audit trail for human review; it does NOT certify legal compliance or make a formal expert determination.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 105
- Forks
- 120
01 前言 Front Matter
- name
- phi-deidentifier
- description
- Use this skill whenever the user asks to de-identify, redact, anonymise, scrub, or remove PHI/PII from clinical text, notes, transcripts, or documents before sharing, exporting, or using them for analytics, testing, or demos — e.g. "de-identify this note", "strip patient info", "make this HIPAA Safe Harbor compliant", "produce a limited data set". It removes the 18 HIPAA Safe Harbor identifiers and emits an audit manifest of what was removed. Run the bundled scripts/deidentify.py — do NOT hand-write redaction regexes yourself. This skill prepares de-identified text and an audit trail for human review; it does NOT certify legal compliance or make a formal expert determination.
02 资源文件 5
- 资产文件assets/name_lexicon.txt3.1 KB
- 参考文档metadata.json613 B
- 参考文档README.md6.4 KB
- 参考文档references/hipaa-safe-harbor.md3.8 KB
- 脚本scripts/deidentify.py38.5 KB
03 SKILL.md 正文
PHI De-identifier
De-identify clinical / health text to the HIPAA Safe Harbor standard (or a
Limited Data Set) using the bundled, offline scripts/deidentify.py. Every
run produces two things: the redacted text and an audit manifest listing
what was removed, by category, plus anything that needs human review.
When to use
- "De-identify / anonymise / scrub / redact this note (or file / folder)."
- "Remove patient identifiers before I share this."
- "Make this Safe Harbor compliant" or "produce a limited data set."
- Preparing PHI-free samples for demos, test fixtures, analytics, or model prompts.
Do not use it to answer clinical questions or to claim legal certification — it is a mechanical redactor plus an audit trail for a human to verify.
How to run it
Always call the bundled script; never improvise redaction logic.
# Safe Harbor (default): writes NOTE.deid.txt + NOTE.manifest.json next to input
python scripts/deidentify.py NOTE.txt
# Limited Data Set: retains dates and city/state/ZIP, strips direct identifiers
python scripts/deidentify.py NOTE.txt --mode limited
# Inline text, machine-readable result to stdout
python scripts/deidentify.py --text "John Doe, SSN 123-45-6789" --json
# HYBRID name recall: pass the person names YOU (the agent) spotted in free prose
python scripts/deidentify.py --text "<text>" --names "Rafael Alcaraz,Ngozi Okafor" --json
# STRUCTURED / JSON input: redact by FIELD NAME (MRN, City, Employer, DOB, ...)
# Use this whenever the input is a JSON object or a key/value record — NOT free text.
python scripts/deidentify.py intake_record.json --format record --json
# ALSO emit a reversible token->value crosswalk (SENSITIVE — re-identifying)
python scripts/deidentify.py NOTE.txt --map crosswalk.json
Steps:
- Identify the input (a file path, a folder, or inline text) and the target
standard: Safe Harbor (default) or Limited Data Set (
--mode limited). - Pick the right mode for the shape of the input. If the input is a
structured record — a JSON object, or clear
Field: valuekey/value pairs (e.g. an intake record, an API payload, an exported row) — run it with--format record. Record mode maps each field by its NAME (MRN, City, Employer, DOB, SSN, …) and redacts deterministically; free-text mode will MISS quoted/structured identifiers like"MRN": "33108876"because there is no adjacent label to anchor on. Use the default (free-text) mode only for prose. Still run the name-recall pass on any free-text field VALUES (e.g. aChiefComplaintorNotesfield that contains a person's name). - Name-recall pass (do this every time on free prose). Before running, read the text yourself and list every PERSON name and PLACE (city / facility) you can identify — including unusual or non-English names that a regex or the bundled lexicon would miss (e.g. "Rafael Alcaraz", "Okafor"). This is the model/agent contribution to the hybrid; you are the recall booster.
- Run
scripts/deidentify.py, passing the names from step 3 via--names "Name One,Name Two"(or a--names-filewith{"names":[...], "places":[...],"orgs":[...]}). The script deterministically redacts every occurrence, tokenizes consistently, runs its guard, and writes the manifest. The script — not your paraphrase — is the auditable system of record. - Return the redacted text exactly as produced, and summarise the manifest: how many identifiers of each category were removed.
- Surface
needs_human_review. Names caught heuristically, and any unknown capitalised text flagged for review, are listed there — tell the user these must be verified before release, and that bare names in free prose may still be missed. - Only write the
--mapcrosswalk when the user explicitly needs to re-identify later; warn that it is sensitive and must be stored securely, separately from the de-identified output.
Use as a safety net before an outbound action
Agents often carry actions that emit content — Send Email, Create Record, Post Message, Export. When an agent maker points one of those actions at this skill (e.g. an instruction like "before Send Email, de-identify the content using phi-deidentifier"), apply this skill as a gate:
- Take the exact text about to leave the agent (e.g. the email Subject + Body, or the field values of the record).
- De-identify it with the steps above (including the name-recall pass).
- Populate the action's inputs from the redacted result only — never from the original text.
- If
needs_human_reviewis non-empty, do not fire the action; show the redacted draft plus the review items and ask the user to confirm first. - On success, tell the user the content was de-identified and how many
identifiers were removed. Never place the
--mapcrosswalk in the outbound content or in chat.
The maker only needs to reference this skill by name in the action's instruction; the operational steps above live here, in the skill, so they do not have to be re-written per agent.
What it removes (HIPAA Safe Harbor, 18 identifiers)
Handled deterministically by regex (high confidence): names in labelled
fields and after titles, street addresses, city + state, geographic ZIP
(truncated to 3 digits; restricted prefixes zeroed), all date elements finer
than year, ages 90+ (aggregated), phone (US, international +country-code, and
labelled formats), fax, email, URL, IP address, SSN (dashed, spaced, or
labelled — including run-together digits), MRN, health-plan / account / member
numbers, certificate / license / DEA / NPI numbers, device serial numbers, VIN.
As a backstop, any unlabelled digit run of 7+ characters that looks like an
identifier the structured detectors couldn't anchor on (a bare account / record
/ SSN / device or phone number) is flagged under needs_human_review — never
silently dropped, and never auto-redacted (a bare number may be a legitimate
non-PHI value, so a human confirms).
Handled best-effort and flagged for review: person names in free prose.
Names are caught by (a) title/label patterns ("Patient: …", "Dr. …") and (b) a
bundled offline name lexicon (assets/name_lexicon.txt) that catches many
bare names with no title or label — all fully local, no network or extra
packages, so it works in locked-down agent sandboxes (e.g. the Copilot Studio
Python container where you cannot pip install). Names not in the lexicon can
still be missed and word-like names may be over-redacted, so human review of
free text is required; extend the lexicon for your population. (If a runtime
already ships spaCy it is used automatically as a bonus, but installation is
never assumed.) City/state written without a comma or trailing ZIP may also be
missed. Full-face photos and biometric identifiers are out of scope — this
skill processes text only; call that out if the source contains images.
Transformations (so downstream data stays useful)
- Consistent pseudonyms: each distinct value maps to a stable token, e.g.
every occurrence of the same MRN becomes
[MRN-1], so linkage is preserved without exposing the value. - Dates → year only:
03/15/1985→[DATE:1985](Safe Harbor keeps year). - Ages: ≤89 retained; 90+ →
[AGE:90+]. - ZIP → first 3 digits:
98104→[ZIP:981XX]; HHS-restricted low-population prefixes →[ZIP:000]. - Limited Data Set mode keeps dates and city/state/ZIP intact while still removing names, contacts, SSN, MRN, and account numbers.
The audit manifest
NOTE.manifest.json records the mode, a per-category count summary, one entry
per token with a salted hash of the original value (never the plaintext),
the needs_human_review list, and explanatory notes. Use it as the evidence
trail for a reviewer — it answers "what did the tool remove, and what still
needs eyes?" without itself containing PHI.
Guardrails
- Never claim compliance. Report what was removed; a qualified human makes the Safe Harbor / expert-determination call.
- Never invent or "restore" content. Only redact.
- Do not paste the crosswalk into chat or co-locate it with the output; it re-identifies the data.
- Always relay
needs_human_reviewand remind the user to review free text — regex cannot guarantee every bare name or unusual identifier is caught. - Text only: if the source has images/scans, say so and recommend a separate image-redaction step.
References
references/hipaa-safe-harbor.md— the 18 identifiers, ZIP/date/age rules, and Safe Harbor vs Limited Data Set, as implemented here.
04 同仓库更多 Skills
stakeholder-and-decision-map
Mines customer interactions to identify stakeholders, infer their likely roles and engagement, map the decision process, and highlight who or what may be missing. Use when asked to "map a deal's buying group", identify influential or missing stakeholders, "assess who has gone quiet", or "explain how the customer will decide". Do not use for phased engagement plans, contact sequences, choosing or drafting outreach to the single next contact, seller or team performance reviews, or contacting, scheduling, or changing records.
sales-progress-update
Creates or refreshes a sales progress update for a manager or team about work done, deal movement, pending outcomes, supported forecast position, and help needed. Use when asked to "create my weekly sales update", "refresh my sales progress deck", "report my forecast position", "where do I stand against my quarter forecast", or "catch my manager up on committed deals". Do NOT use for non-sales project updates, a since-date deal change digest, momentum or blocker analysis, meeting prep, or outreach drafting.
submission-assemble
Put the checked CSR or 510(k) sections together in template order with a reviewer-facing open-items register, as a draft package for human sign-off. Use when the user asks "assemble the CSR draft", "put the module together for review", "build the review package with the open items on top", "compile the 510(k) sections in order" or "package this up for the submission lead". Do NOT use for assembling an unchecked draft - use consistency-check instead. Do NOT use for loading protocol, SAP or TLF sources - use source-ingest instead. Do NOT use for compiling general documents or slide decks - use the built-in docx or pptx skill instead. Do NOT use for filing or submitting to a regulator - use the sponsor's validated gateway, operated by a human, instead. Guardrail: draft for human approval only (L1); status is draft_clean or draft_open_items, never submitted.
source-ingest
Pull every number, date and population definition out of a study's protocol, SAP, TLF tables, investigator brochure and prior approved text into one cited fact map, keyed per config/field-dictionary.json, before any CSR or 510(k) section is written. Use when the user asks "here's the locked TLF set and SAP, set up the CSR", "load the protocol and tables before we start drafting", "what figures do we have from the database lock?", "pull the disposition counts out of Table 14.1.1" or "ingest the IB for the 510(k)". Do NOT use for drafting or assembling submission sections - use section-draft or submission-assemble instead. Do NOT use for reconciling a patient's medications - use the discharge-care-transition plugin instead. Guardrail: reads and cites sources only; never estimates, rounds or invents a fact.
section-plan
Work out which sections a CSR or 510(k) requires, from the templates in config, check each one against the cited fact map, and name what is missing before a word is drafted. Use when the user asks "what do we still need before we can draft the CSR?", "which sections are ready to start?", "what's blocking the performance data section?", "do we have everything for the synopsis?" or "map our tables to the E3 structure". Do NOT use for writing section language - use section-draft instead. Do NOT use for cross-checking a finished draft - use consistency-check instead. Do NOT use for outlining general Word documents or business reports - use the built-in docx skill instead. Only structures with a template in config are supported. Guardrail: plans only; never marks a section ready on a missing fact and never invents a structure.
section-draft
Write or revise the language for one planned CSR or 510(k) section - synopsis, efficacy, safety, discussion, device description - using only figures already in the cited fact map, each with its TLF or SAP citation. Use when the user asks "draft the Synopsis from our locked tables", "write up safety from Table 14.3.1", "give me a first pass at the discussion", "draft the device description for the 510(k)" or "tighten the wording of the Discussion section". Do NOT use for supplying a number not already in source_facts - use source-ingest instead. Do NOT use for verifying a draft's figures - use consistency-check instead. Do NOT use for appeal letters, clinical notes or discharge summaries - use the matching HLS plugin instead. Guardrail: drafts for human approval only (L1); never asserts an unsourced number or harmonises two figures.