Skip to content
Skills Library
Medicine & health · Building & coding

phi-redaction

/phi-redaction

Conservative PHI redaction patterns for FHIR resources. Use when: (1) Redacting patient health information from FHIR resources before AI agent access, (2) Implementing de-identification for clinical data pipelines, (3) Understanding what fields are stripped, masked, or truncated in FHIR resources, (4) Building read paths that automatically protect patient privacy.

Licence
MIT
Last repository change
23.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 23.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Conservative PHI redaction patterns for FHIR resources. Use when: (1) Redacting patient health information from FHIR resources before AI agent access, (2) Implementing de-identification for clinical data pipelines, (3) Understanding what fields are stripped, masked, or truncated in FHIR resources, (4) Building read paths that automatically protect patient privacy.

Original author description

Conservative PHI redaction patterns for FHIR resources. Use when: (1) Redacting patient health information from FHIR resources before AI agent access, (2) Implementing de-identification for clinical data pipelines, (3) Understanding what fields are stripped, masked, or truncated in FHIR resources, (4) Building read paths that automatically protect patient privacy.

How it works

  1. When to Use This Skill
  2. Redaction Rules
  3. Implementation Pattern (Python)
  4. De-identification Preview Coverage
  5. Integration with MCP Tools
Original SKILL.md headings · 96 lines, 441 words
SKILL.md preview
---
name: phi-redaction
description: >
  Conservative PHI redaction patterns for FHIR resources. Use when:
  (1) Redacting patient health information from FHIR resources before AI agent access,
  (2) Implementing de-identification for clinical data pipelines,
  (3) Understanding what fields are stripped, masked, or truncated in FHIR resources,
  (4) Building read paths that automatically protect patient privacy.
---

# PHI Redaction for FHIR Resources

Standard redaction profile for Protected Health Information (PHI) applied on all
read paths in the FHIR MCP guardrail stack. This is a technical minimization
preview, not a legal Safe Harbor determination.

## When to Use This Skill

- You need to understand how PHI is stripped from FHIR resources
- You are building a pipeline that must redact clinical data before AI access
- You need to implement or audit de-identification logic for FHIR

## Redaction Rules

All redaction is applied at read time, not at storage time.

### Names (`HumanName`)
- **Family name**: Kept as-is
- **Given names**: Truncated to first initial + period (e.g., "John" -> "J.")
- **Text**: Removed

### Identifiers
- **Value**: Removed (e.g., `{"system": "…/us-ssn", "value": "123-45-6789"}` -> `{"system": "…/us-ssn"}`)
- **System and type**: Kept for reference

### Addresses
- **Line and text**: Removed
- **City, state, country**: Kept (for demographic analysis)

### Telecom (Phone, Email)
- **Value**: Replaced with `[Redacted]`
- **System and use**: Kept

### Birth Date
- **Truncated to year only** (e.g., "1985-03-15" -> "1985")

### Photos
- **Removed entirely** from the resource

### Text Narratives
- **Replaced** with: `<div xmlns="http://www.w3.org/1999/xhtml">[Redacted]</div>`
- **Status** set to `empty`

### Notes and Comments
- **Replaced** with `[Redacted]`

### Contained Resources
- All contained resources are redacted recursively

## Implementation Pattern (Python)

```python
import json

def apply_redaction(resource):
    """Deep-copy the resource and redact PHI fields."""
    redacted = json.loads(json.dumps(resource))
    _redact_fields(redacted)
    for contained in redacted.get('contained', []):
        if isinstance(contained, dict):
            _redact_fields(contained)
    return redacted
```

Key implementation notes:
- Always deep-copy before redacting (never modify the stored resource)
- Redact contained resources recursively
- Apply on ALL read paths: direct reads, search results, context envelopes,
  upstream proxy responses

## De-identification Preview Coverage

This redaction profile minimizes these common identifier classes:
- Names (partial)
- Geographic data smaller than state (addresses stripped)
- Dates (birth date truncated to year)
- Telephone/fax numbers (redacted)
- Email addresses (redacted)
- Medical record numbers, Social Security numbers, account numbers — any `identifier.value` (removed)

**Not covered by this profile** (would need additional implementation):
- An identifier typed into a free-text field the profile does not strip (no pattern scan runs over arbitrary strings)
- IP addresses, device identifiers (not redacted from extension fields)
- Biometric identifiers
- Full-face photographs (removed if in `photo` field, not scanned in attachments)

## Integration with MCP Tools

The redaction is applied automatically by the guardrail stack. MCP tools like
`fhir.read`, `fhir.search`, `fhir.lastn`, and `context.get` all return
redacted data. No additional action is needed by the agent.

The `$deidentify` operation provides an explicit conservative preview on demand.
Expert review is still required before export or disclosure.

Versions

The database has no other skills named phi-redaction.

Database snapshot: 13.11.2026 · package version e89f0e9d5505 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100fhir-r6-guardrails
    HealthClaw Guardrails (healthclaw.io) — FHIR agent guardrails for clinical data access via MCP. Supports FHIR R4 US Core v9 (stable) and FHIR R6 ballot3 (experimental). Use when: (1) Reading patient data through MCP tools with automatic PHI redaction, (2) Writing clinical…
  • 90health
    In an aidd repository, use when code touches FHIR, HL7, PHI, patient records, clinical data, medical devices, HIPAA, EHR integrations, SMART on FHIR, GxP, or clinical trials.
  • 100patient-demographics-summary
    Retrieves and formats a complete patient demographic summary from FHIR Patient, RelatedPerson, and Coverage resources. Use when user asks to "pull demographics", "get patient info", "show patient details", "who is this patient", "patient summary", "emergency contacts",…
  • 100building-with-openmed
    Orient and bootstrap any project that uses OpenMed, the on-device clinical and biomedical NLP library, for named-entity recognition, PHI de-identification, FHIR export, and evaluation. Use when the user mentions OpenMed, wants to install it, asks which OpenMed capability or…
  • 100hipaa-guardian
    This skill should be used when the user asks to "scan for PHI", "detect PII", "HIPAA compliance check", "audit for protected health information", "find sensitive healthcare data", "generate HIPAA audit report", "check code for PHI leakage", "scan logs for PHI", "check…
  • 90healthcare-fhir
    Design RESTful clinical data exchanges using HL7 FHIR standards. Use when: fhir, hl7, healthcare api, clinical data, snomed, loinc.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.