The MRN Format Problem
The US has around 6,100 hospitals. Each runs its own EHR system. Each uses its own Medical Record Number format. No national standard exists. The Joint Commission requires that hospitals can identify patients — but sets no format rules.
Formats vary widely. Some are 7-digit integers. Others are 8-digit integers. Some use prefix codes like HOSP-, MRN-, or PT-. Others add institution codes like SVHS- or CHOP-. Some embed the enrollment year in the number.
HIPAA Safe Harbor lists patient record numbers as identifier type 8 of 18. (45 CFR §164.514(b)(2)) All 18 must be removed. The rule does not limit this to any one format. If your hospital uses a custom format, you must detect it. A tool that misses it fails Safe Harbor — even if it removes all 17 other types.
Why the Code Approach Fails
The standard way to add a custom record number format to a de-identification pipeline is to extend Microsoft Presidio. That means writing Python.
A developer creates a class that extends EntityRecognizer. They write the regex, wire it into Presidio's registry, test it, and maintain it. For compliance teams — who rarely code — this is a hard block. Every format change needs an engineer.
Healthcare engineers are busy. They focus on EHR integration and clinical systems. Compliance tooling is rarely their top priority.
The No-Code Pattern Workflow
The guided pattern approach removes the coding step.
A compliance officer opens the Custom Entity Creator in the web app. They paste five sample numbers from their system — for example:
SVHS-0012345
SVHS-0987654
SVHS-1122334
SVHS-4455667
SVHS-8899001
They click Generate Pattern. The AI reads the structure and returns:
- Pattern:
SVHS-\d{7} - Confidence: high
- Suggested name:
HOSPITAL-MRN - Suggested replacement:
[MRN]
The officer pastes five more samples. The pattern passes. They save it to the HIPAA preset.
From that point, every session — web app, Office Add-in, Desktop App, and API — detects this format in the standard PHI pass. No code needed.
GDPR Research Note
GDPR Article 89 requires pseudonymization for research datasets. Custom entities put institution-specific identifiers in scope — closing the gap that generic tools leave open.
What You Get
This workflow takes one afternoon. Custom code takes weeks.
The compliance officer defines the pattern, tests it, and deploys it. No ticket. No wait. The preset holds the custom entity next to the standard 17 Safe Harbor identifiers.
When the next batch of clinical notes runs, all 18 identifier types are covered. Safe Harbor is complete.
See HIPAA Safe Harbor de-identification for healthcare research for how Safe Harbor works in practice. For hospital-specific detection patterns, see detecting hospital-specific MRN formats without engineering.
When This Approach Has Limits
Letting a compliance officer generate and save an MRN pattern without writing Presidio code genuinely removes the engineering bottleneck. But a generated pattern carries limits worth stating plainly.
Five samples define the rule; production data tests it. Generating SVHS-\d{7} from five clean values is fast, but the real record stream may include a legacy six-digit format from before a system migration, MRNs printed without the prefix, numbers wrapped across lines in scanned notes, or a second hospital's scheme in the same file. A pattern that passes its own examples can still miss these. Validate every generated entity against a held-out set of genuine documents from your own system before trusting it in the PHI pass, and re-test after any EHR change.
A confident pattern is not a verified one. The AI returning high confidence reflects how cleanly the samples fit a regex, not whether the regex catches every MRN you will encounter or avoids flagging unrelated codes that share the shape. An over-broad pattern suppresses legitimate values; an over-narrow one lets MRNs through silently, which is the worst case because nothing alerts. Treat the suggested pattern as a draft to measure, with a recall check on real data rather than the generated samples.
One configured entity does not complete Safe Harbor. Adding the MRN closes category 8, but Safe Harbor is all 18 categories, and the remaining ones, especially free-text dates, geography, and category 18 catch-all identifiers, are not solved by one pattern. Certifying a dataset as de-identified is also a judgment about residual re-identification risk, not a checklist the tool completes for you. The no-code builder supports that work; a qualified reviewer still has to confirm the standard is met.