
De-Identify Free-Text Radiology Reports or Structured Reports
Source:R/nlp-deid.R
ai_deid_report.RdRedacts or pseudonymizes protected health information (PHI) in free-text
radiology reports or dicom_sr objects using a registered NLP backend
("presidio" REST or built-in deterministic HIPAA/GDPR/SG pattern NER).
Enforces a monotonic union invariant: optional LLM audit passes can only add
missed spans, never remove deterministic detections.
Usage
ai_deid_report(
x,
backend = "presidio",
chat = NULL,
mode = c("redact", "pseudonymize")
)Arguments
- x
Character report text or a
dicom_srobject fromdicomtk::read_dicom_sr().- backend
Registered NLP de-id backend name (default
"presidio").- chat
Optional
dicom_ai_chatobject for contextual review.- mode
"redact"(default) or"pseudonymize".
Examples
ai_deid_report("Patient John Tan (MRN: MRN-12345) scanned on 2026-03-14.")
#> $text
#> [1] "[REDACTED_PERSON] ([REDACTED_MRN]) scanned on [REDACTED_DATE]."
#>
#> $spans
#> # A tibble: 3 × 4
#> entity_type start end text
#> <chr> <int> <int> <chr>
#> 1 PERSON 1 16 Patient John Tan
#> 2 MRN 19 32 MRN: MRN-12345
#> 3 DATE 46 55 2026-03-14
#>
#> $mode
#> [1] "redact"
#>