By · Last updated 2026-04-30

Back to BlogHealthcare

Custom MRN Detection Without Code for HIPAA

Medical Record Numbers are hospital-specific — every healthcare system uses a different format. HIPAA Safe Harbor requires removing MRNs.

April 30, 20268 minute read
custom MRN detectionHIPAA pipeline configurationno-code regexAI pattern helperhospital identifier de-identification

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.

Sources

Ready to protect your data?

Start anonymizing PII with 285+ entity types across 48 languages.

About this page

We update this page when our platform or the law changes.

Read our founder note for how we work.

Each change shows up in the timestamp at the top.

Related reading

We follow these rules

  • GDPR (EU 2016/679).
  • ISO/IEC 27001:2022.
  • NIS2 (EU 2022/2555).
  • HIPAA safe harbor under 45 CFR § 164.514(b)(2).

Our promise

We do not sell your data.

We do not train models on your text.

We store your files in Germany.

You can delete your account at any time.

You own your work.

Where we run

Our servers live in Falkenstein, Germany.

We use Hetzner. They hold ISO 27001 certification.

All data stays in the EU.

Backups run every day.

Need help?

Email support@anonym.legal.

We reply within one business day.

How we test

We run a full check suite on every release.

Each surface gets its own sweep script and report.

Human reviewers spot-check the output each week.

We track recall and precision on a labelled set.

Bad runs block the deploy.

What we never do

  • We never sell your information to third parties.
  • We never train models on what you upload.
  • We never keep your work after you delete it.
  • We never share keys with any outside firm.
  • We never run ads inside the product.

Plans in plain words

We sell credits, not seats.

One credit covers one short job.

Long jobs use a few credits each.

You can top up at any time.

Unused credits roll over each month.

Read the plans page for current rates.

Who built this

A small team of engineers and lawyers built this.

We ship from Europe and work in the open.

Our founder note spells out why we started.

Where to start

How the parts fit

A browser add-on cleans text inside Chrome.

A Word plug-in handles drafts in Office.

A small desktop tool works on whole folders.

An agent protocol link feeds large models safely.

All four share one core engine and one rule set.

Words from our team

We started this work after a lunch about cookies.

One friend kept getting odd ads on her phone.

We asked why a court file leaked through a draft.

We sketched the first build on a napkin that week.

By month three we had a tiny demo for a friend.

She used it on her first case the next day.

Common questions we hear

Can the tool read scanned PDFs? Yes, with OCR.

Does it work on long files? Yes, in small chunks.

Can I roll my own rule set? Yes, save it as a preset.

Does it run offline? The desktop build runs offline.

Do you keep my files? No, the cloud build wipes after each run.

Will it learn from my work? No, we never train on inputs.

A short tour of the workflow

Upload a file or paste a snippet of prose.

Pick the entities you want gone from the draft.

Choose a method: replace, mask, hash, encrypt, or redact.

Press run and watch the side panel show each hit.

Skim the result and tweak any rule that misfired.

Save the cleaned file or send it to a teammate.