Easy/Quick eICR xml redacting?
Hi Team. Does anyone have a quick and easy way to redact names, DOB, and address from an xml without manually searching and deleting using Notepad++? We are spending a lot of time redacting xml files to send to NBS/AIMS for help requests, especially in the "Notes" section where patient and family member PHI is sometimes used. Thank you!
Jana Meridith (she/her)
eCR Coordinator
Maine Center for Disease Control and Prevention
jana.meridith@maine.gov | (707) 502-5739
Maine Center for Disease Control and Prevention
jana.meridith@maine.gov | (707) 502-5739
I agree that de-identifying an XML is difficult. One thing that has helped me and maybe you all already use it, is using the replace feature in the search pop up box in Notepad++. Then you can put in the patient first name in the find box and a fake name in the replace box and then it will remove it in the whole document. This might be a little more difficult if a family name is only in the notes, you would still have to review. But it removes some of the steps in the document.
I do the same thing with phone numbers. and nice where it will keep a history of what you have replaced so you can keep the fake one and then just add in different real numbers to replace.
And if it is within 7 days, AIMS should be able to find the eCR with just the doc ID.
Not a lot of great workarounds.
thanks,
Sara
library(xml2) library(tidyverse) library(stringr) xml_file <- read_xml("input.xml") lastname_real <- xml_file %>% xml_find_first("//patientRole/patient/name/family") %>% xml_text() firstname_real <- xml_file %>% xml_find_first("//patientRole/patient/name/given") %>% xml_text() xml_string <- as.character(xml_file) updated_xml_string <- str_replace_all(xml_string, lastname_real, "Smith") updated_xml_string <- str_replace_all(updated_xml_string, firstname_real, "Bob") updated_xml_file <- read_xml(updated_xml_string) write_xml(updated_xml_file, "output.xml")library(xml2) library(tidyverse) library(stringr) xml_file <- read_xml("input.xml") xml_file_ns <- xml_ns_strip(xml_file) lastname_real <- xml_file_ns %>% xml_find_first("//patientRole/patient/name/family") %>% xml_text() firstname_real <- xml_file_ns %>% xml_find_first("//patientRole/patient/name/given") %>% xml_text() xml_string <- as.character(xml_file) lastname <- regex(lastname_real, ignore_case = TRUE) firstname <- regex(firstname_real, ignore_case = TRUE) updated_xml_string <- str_replace_all(xml_string, lastname, "Smith") updated_xml_string <- str_replace_all(updated_xml_string, firstname, "Bob") updated_xml_file <- read_xml(updated_xml_string) write_xml(updated_xml_file, "output.xml")Example:
updated_xml_string <- str_replace_all(string = str_to_lower(“SMITH”),
pattern = str_to_lower(lastname_real),
replacement = "Smith"))
-Jana
Cheers!