Protected Health Information (PHI) De-identifier
scrub_phiRedacts Protected Health Information from clinical narratives by masking HIPAA identifiers, national IDs, MRNs, phone numbers, and emails before logging or external processing.
Instructions
Scans clinical narratives and de-identifies Protected Health Information (PHI), masking HIPAA Safe Harbor 18 identifiers, Egyptian National IDs (14 digits), Saudi Iqama/National IDs (10 digits), Medical Record Numbers (MRN), phone numbers, and email addresses.
When to use:
Sanitizing patient narratives, consultation transcripts, or discharge summaries before logging, exporting, or passing to external models or public registries.
When NOT to use:
Detecting adversarial prompt injections, jailbreaks, or security exploits (use scan_prompt_security instead).
Calculating clinical risk scores or physiological parameters (use calculate_clinical_score or check_red_flags instead).
Normalizing pharmaceutical brand names to generic entities (use normalize_terminology instead).
Parameter constraints & formats:
'text': Unstructured clinical narrative, progress note, or dialogue string (up to 500,000 characters) containing patient identifiers to mask.
Behavioral guarantees & return states:
Non-LLM deterministic transformation running locally in memory using regex and Luhn checksum validation; requires no external APIs, credentials, or rate limits.
Token substitution: Direct identifiers are replaced with standardized masking tokens ([NATIONAL_ID_REDACTED], [PHONE_REDACTED], [EMAIL_REDACTED], [MRN_REDACTED]) while preserving clinical timeline and context.
Return contract: Returns scrubbed_text alongside audit_report (total_entities_detected and breakdown by type); stateless with zero disk logging or network leakage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Raw clinical text, patient consultation note, discharge summary, or dialogue containing potential PHI identifiers to redact. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audit_report | Yes | Detailed de-identification summary including count of detected entities and list of redacted identifier categories. | |
| scrubbed_text | Yes | Privacy-sanitized narrative with all detected identifiers replaced with safe masking tokens. |