Patient Data Erasure
Vorian Connect provides a purpose-built, audited workflow for permanently erasing patient data in response to GDPR Article 17 right-to-erasure requests. The erasure severs all identity links, nulls raw HL7 payloads containing the patient's MRN, deletes the pseudonymisation token, and records the action in the admin audit log — all within a single atomic database transaction.
How It Works
- An administrator with the
patient:erasepermission navigates to the Patient Data Erasure page at/patientand enters the patient's MRN - A two-step confirmation flow requires the operator to re-enter the MRN exactly before the erasure can proceed — preventing accidental erasure via copy-paste or misclick
- On confirmation, the system resolves the MRN to a patient token via HMAC lookup, then executes five steps inside a single atomic transaction:
- Collects all message IDs linked to this patient — both through the
analyte_resultsforeign key and through raw payload text search (catching parse-failure messages with no numeric OBX values) - Writes a required
gdpr_erasureaudit row recording the planned scope (analyte row count and message count) — the erasure fails closed if audit logging is unavailable - Sets
patient_idtoNULLon all analyte result rows, severing the identity link while preserving the result data for operational continuity - Sets
raw_payloadtoNULLon all collected messages, permanently destroying the MRN in the original HL7 text - Deletes the patient token row, making the patient UUID an opaque orphan with no recoverable identity link
- Collects all message IDs linked to this patient — both through the
- The dashboard displays a confirmation with the count of analyte rows cleared and HL7 payloads redacted, and links to the audit log entry for compliance verification
What's Included
- Two-step MRN confirmation: The operator must re-enter the MRN exactly — no single-click or dialog-confirm shortcuts. Mismatch blocks the erasure
- Atomic transaction: All five steps execute within one database transaction — partial erasure is impossible. If any step fails, the entire operation rolls back
- Fail-closed audit: If the audit row cannot be written, the erasure is refused with a 503 status — patient data is never destroyed without an audit trail
- Complete scope: The erasure covers both numeric OBX results (found via foreign key) and messages that failed parsing or contain no numeric values (found via escaped LIKE text search on the raw HL7 payload)
- Audit trail: Every erasure is recorded as a
gdpr_erasureevent in the admin audit log with the planned scope, timestamp, actor, and IP address - Already-erased detection: If the MRN has no matching patient token (already erased or never existed), the system returns zero counts rather than an error
Where It Fits
Patient Data Erasure lives in the Administration section of the dashboard sidebar, gated by the patient:erase permission. It is deliberately separated from routine lab operations — erasure is a compliance workflow, not a clinical one. The page links directly to the audit log so that privacy officers and compliance auditors can verify each erasure event.
The erasure satisfies GDPR Article 17 (right to erasure) requirements: the patient's identity is permanently unlinked from all stored data, the original MRN is destroyed from raw payloads, and the action is recorded in an auditable log. Verification history for the erased patient's results is retained but is no longer attributable to the patient.
Technical Details
- MRN resolution: HMAC-based pseudonymisation via
mrnHmac— the MRN is never stored in plaintext. The HMAC lookup finds the correspondingpatient_tokensrow - Message collection: Two-path approach —
analyte_results.message_idforeign key for numeric OBX messages, plus aLIKEtext search onmessage_logs.raw_payloadfor parse failures and non-numeric messages. LIKE wildcards in the MRN value are escaped to prevent accidental cross-patient matches - Atomicity: All destructive writes run inside
withTenant, which opens a single database transaction with RLS-enforced tenant isolation - Irreversibility: Once the raw payload is nulled and the token is deleted, the patient identity cannot be recovered — this is by design for GDPR compliance
- Permission:
patient:eraserequired; not granted by any standard permission template — must be explicitly assigned by a tenant administrator - Idempotent: Erasing an already-erased patient returns
erased: 0, messages_redacted: 0— no error, no duplicate audit row