Redacta
Redacta pseudonymises medical documents before AI processing. It detects patient identifiers and replaces them with labelled tokens, preserving clinical meaning while protecting privacy.
How It Works
When a user shares medical text, scan it for patient identifiers and replace them with pseudonymised tokens. The output should be clinically readable but contain no real patient data.
What Gets Detected
Structured Identifiers (regex-based)
Apply these pattern rules automatically:
NHS Numbers (UK)
- Format: 3-3-4 digits (e.g.
943 476 5919) or 10 consecutive digits
- Replace with:
[NHS_NUMBER]
- Validation: check digit using Modulus 11 algorithm when possible
Dates of Birth / Dates
- Formats: DD/MM/YYYY, DD-MM-YYYY, DD.MM.YYYY, YYYY-MM-DD, "3rd February 1985", "Feb 3, 1985"
- Context: dates near keywords like "DOB", "born", "date of birth", "age", "d.o.b"
- Replace with:
[DATE_OF_BIRTH] (when contextually a DOB) or [DATE] (other dates)
- Preserve clinical dates when clearly not patient-identifying (e.g. "appointment on 15 March")
UK Postcodes
- Format: A9 9AA, A99 9AA, A9A 9AA, AA9 9AA, AA99 9AA, AA9A 9AA
- Replace with:
[POSTCODE]
Phone Numbers
- UK formats: 07xxx, 01xxx, 02xxx, +44
- US formats: (xxx) xxx-xxxx, xxx-xxx-xxxx, +1
- Replace with:
[PHONE_NUMBER]
Email Addresses
- Standard email pattern
- Replace with:
[EMAIL]
Hospital / MRN Numbers
- Context: numbers near "hospital number", "MRN", "patient ID", "unit number", "case number"
- Replace with:
[HOSPITAL_NUMBER]
UK National Insurance Numbers
- Format: 2 letters + 6 digits + 1 letter (e.g. AB123456C)
- Replace with:
[NI_NUMBER]
Contextual Identifiers (agent reasoning)
Use your understanding of clinical documents to detect:
Patient Names
- Look for names in: salutations ("Dear Mrs Jones"), headers ("Patient: John Smith"), references in body text
- Distinguish patient names from clinician names — do NOT redact doctor/nurse/consultant names unless explicitly asked
- Replace with:
[PATIENT_NAME]
- If multiple patients mentioned, use:
[PATIENT_NAME_1], [PATIENT_NAME_2]
Patient Addresses
- Full or partial addresses (house number + street, or referenced near "address", "lives at", "resides")
- Replace with:
[ADDRESS]
- Postcodes are handled separately above
Ages
- Specific ages that could identify when combined with other data: "82-year-old", "aged 47"
- Replace with:
[AGE]
- Context matters: "children aged 5-12" (general) vs "a 73-year-old woman" (specific patient)
Output Format
Return two sections:
1. Pseudonymised Document
The full document with all identifiers replaced by tokens. Preserve all formatting, paragraph breaks, and clinical content.
2. Redaction Report
A summary of what was found and replaced:
Redaction Report
================
Items pseudonymised: 7
- [NHS_NUMBER] × 1 (line 3)
- [PATIENT_NAME] × 2 (lines 1, 5)
- [DATE_OF_BIRTH] × 1 (line 2)
- [POSTCODE] × 1 (line 8)
- [PHONE_NUMBER] × 1 (line 9)
- [AGE] × 1 (line 4)
Clinical content preserved: ✓
Clinician names preserved: Dr. Sarah Chen, Mr. James Wright
Rules
- Never output the original patient identifiers in your response — only the pseudonymised version
- Preserve all clinical content — medications, diagnoses, procedures, test results, clinical observations
- Preserve clinician names by default — only redact if the user explicitly asks
- Preserve hospital/practice names by default — these are institutional, not patient data
- When uncertain, err on the side of redacting — false positives are safer than false negatives
- Dates: appointment dates, procedure dates, and follow-up dates should be preserved unless they could identify the patient (e.g. a specific date of birth)
- Consistency: the same identifier should get the same token throughout the document (e.g. every instance of the patient's name becomes
[PATIENT_NAME])
Example
Input:
Dear Mrs Patricia Hartley,
DOB: 14/03/1952 (age 73)
NHS Number: 943 476 5919
Hospital Number: RXH-2847561
I am writing to inform you of the results of your recent investigations.
Mrs Hartley attended the cardiology outpatient clinic on 10 February 2026
under the care of Dr Sarah Chen.
Address: 14 Oakfield Road, Headingley, Leeds LS6 3PJ
Tel: 0113 278 4532
Output:
Dear [PATIENT_NAME],
DOB: [DATE_OF_BIRTH] (age [AGE])
NHS Number: [NHS_NUMBER]
Hospital Number: [HOSPITAL_NUMBER]
I am writing to inform you of the results of your recent investigations.
[PATIENT_NAME] attended the cardiology outpatient clinic on 10 February 2026
under the care of Dr Sarah Chen.
Address: [ADDRESS], [POSTCODE]
Tel: [PHONE_NUMBER]
What This Skill Does NOT Do
- Store or transmit patient data
- Guarantee 100% detection (always review output)
- Replace formal data protection processes
- Provide legal compliance certification
- Process images or PDFs (text input only in v1)
Privacy Note
This skill processes text locally within your AI agent session. No patient data is sent to external services. However, the text is processed by the underlying language model — ensure your model provider's data handling meets your organisation's requirements.
Built by PharmaTools.AI — applied AI for pharma and healthcare.
1---
2name: redacta
3description: Redacta pseudonymises medical documents — replacing patient identifiers (NHS numbers, dates of birth, postcodes, phone numbers, hospital numbers) with labelled tokens so clinical content can be safely processed by AI. Built by PharmaTools.AI.
4metadata:
5 source: https://skillmd.com/skills/modbender/redacta
6 openclaw:
7 emoji: 🔒
8 homepage: https://pharmatools.ai
9---
10
11# Redacta
12
13Redacta pseudonymises medical documents before AI processing. It detects patient identifiers and replaces them with labelled tokens, preserving clinical meaning while protecting privacy.
14
15## How It Works
16
17When a user shares medical text, scan it for patient identifiers and replace them with pseudonymised tokens. The output should be clinically readable but contain no real patient data.
18
19## What Gets Detected
20
21### Structured Identifiers (regex-based)
22
23Apply these pattern rules automatically:
24
25**NHS Numbers** (UK)
26- Format: 3-3-4 digits (e.g. `943 476 5919`) or 10 consecutive digits
27- Replace with: `[NHS_NUMBER]`
28- Validation: check digit using Modulus 11 algorithm when possible
29
30**Dates of Birth / Dates**
31- Formats: DD/MM/YYYY, DD-MM-YYYY, DD.MM.YYYY, YYYY-MM-DD, "3rd February 1985", "Feb 3, 1985"
32- Context: dates near keywords like "DOB", "born", "date of birth", "age", "d.o.b"
33- Replace with: `[DATE_OF_BIRTH]` (when contextually a DOB) or `[DATE]` (other dates)
34- Preserve clinical dates when clearly not patient-identifying (e.g. "appointment on 15 March")
35
36**UK Postcodes**
37- Format: A9 9AA, A99 9AA, A9A 9AA, AA9 9AA, AA99 9AA, AA9A 9AA
38- Replace with: `[POSTCODE]`
39
40**Phone Numbers**
41- UK formats: 07xxx, 01xxx, 02xxx, +44
42- US formats: (xxx) xxx-xxxx, xxx-xxx-xxxx, +1
43- Replace with: `[PHONE_NUMBER]`
44
45**Email Addresses**
46- Standard email pattern
47- Replace with: `[EMAIL]`
48
49**Hospital / MRN Numbers**
50- Context: numbers near "hospital number", "MRN", "patient ID", "unit number", "case number"
51- Replace with: `[HOSPITAL_NUMBER]`
52
53**UK National Insurance Numbers**
54- Format: 2 letters + 6 digits + 1 letter (e.g. AB123456C)
55- Replace with: `[NI_NUMBER]`
56
57### Contextual Identifiers (agent reasoning)
58
59Use your understanding of clinical documents to detect:
60
61**Patient Names**
62- Look for names in: salutations ("Dear Mrs Jones"), headers ("Patient: John Smith"), references in body text
63- Distinguish patient names from clinician names — do NOT redact doctor/nurse/consultant names unless explicitly asked
64- Replace with: `[PATIENT_NAME]`
65- If multiple patients mentioned, use: `[PATIENT_NAME_1]`, `[PATIENT_NAME_2]`
66
67**Patient Addresses**
68- Full or partial addresses (house number + street, or referenced near "address", "lives at", "resides")
69- Replace with: `[ADDRESS]`
70- Postcodes are handled separately above
71
72**Ages**
73- Specific ages that could identify when combined with other data: "82-year-old", "aged 47"
74- Replace with: `[AGE]`
75- Context matters: "children aged 5-12" (general) vs "a 73-year-old woman" (specific patient)
76
77## Output Format
78
79Return two sections:
80
81### 1. Pseudonymised Document
82The full document with all identifiers replaced by tokens. Preserve all formatting, paragraph breaks, and clinical content.
83
84### 2. Redaction Report
85A summary of what was found and replaced:
86
87```
88Redaction Report
89================
90Items pseudonymised: 7
91
92- [NHS_NUMBER] × 1 (line 3)
93- [PATIENT_NAME] × 2 (lines 1, 5)
94- [DATE_OF_BIRTH] × 1 (line 2)
95- [POSTCODE] × 1 (line 8)
96- [PHONE_NUMBER] × 1 (line 9)
97- [AGE] × 1 (line 4)
98
99Clinical content preserved: ✓
100Clinician names preserved: Dr. Sarah Chen, Mr. James Wright
101```
102
103## Rules
104
1051. **Never output the original patient identifiers** in your response — only the pseudonymised version
1062. **Preserve all clinical content** — medications, diagnoses, procedures, test results, clinical observations
1073. **Preserve clinician names** by default — only redact if the user explicitly asks
1084. **Preserve hospital/practice names** by default — these are institutional, not patient data
1095. **When uncertain**, err on the side of redacting — false positives are safer than false negatives
1106. **Dates**: appointment dates, procedure dates, and follow-up dates should be preserved unless they could identify the patient (e.g. a specific date of birth)
1117. **Consistency**: the same identifier should get the same token throughout the document (e.g. every instance of the patient's name becomes `[PATIENT_NAME]`)
112
113## Example
114
115**Input:**
116```
117Dear Mrs Patricia Hartley,
118
119DOB: 14/03/1952 (age 73)
120NHS Number: 943 476 5919
121Hospital Number: RXH-2847561
122
123I am writing to inform you of the results of your recent investigations.
124Mrs Hartley attended the cardiology outpatient clinic on 10 February 2026
125under the care of Dr Sarah Chen.
126
127Address: 14 Oakfield Road, Headingley, Leeds LS6 3PJ
128Tel: 0113 278 4532
129```
130
131**Output:**
132```
133Dear [PATIENT_NAME],
134
135DOB: [DATE_OF_BIRTH] (age [AGE])
136NHS Number: [NHS_NUMBER]
137Hospital Number: [HOSPITAL_NUMBER]
138
139I am writing to inform you of the results of your recent investigations.
140[PATIENT_NAME] attended the cardiology outpatient clinic on 10 February 2026
141under the care of Dr Sarah Chen.
142
143Address: [ADDRESS], [POSTCODE]
144Tel: [PHONE_NUMBER]
145```
146
147## What This Skill Does NOT Do
148
149- Store or transmit patient data
150- Guarantee 100% detection (always review output)
151- Replace formal data protection processes
152- Provide legal compliance certification
153- Process images or PDFs (text input only in v1)
154
155## Privacy Note
156
157This skill processes text locally within your AI agent session. No patient data is sent to external services. However, the text is processed by the underlying language model — ensure your model provider's data handling meets your organisation's requirements.
158
159---
160
161Built by [PharmaTools.AI](https://pharmatools.ai) — applied AI for pharma and healthcare.