Loads all RPDR text outputs into R and returns a list of data tables processed. Currently supported outputs are: Mrn.txt, Con.txt, Dem.txt, Enc.txt, Rdt.txt, Lab.txt, Med.txt, Dia.txt, Rfv.txt, Prc.txt, Car.txt, Dis.txt, End.txt, Hnp.txt, Opn.txt, Pat.txt, Prg.txt, Pul.txt, Rad.txt and Vis.txt. If multiple text files of the same type are available (if the query is larger than 25000 patients), then add a "_" and a number to merge the same data sources into a single output in the order of the provided number.
load_all(
folder,
which_data = c("mrn", "con", "dem", "enc", "rdt", "lab", "med", "dia", "rfv", "prc",
"lno", "car", "dis", "end", "hnp", "opn", "pat", "prg", "pul", "rad", "vis"),
old_dem = FALSE,
merge_id = "EMPI",
sep = ":",
id_length = "standard",
perc = 0.6,
na = TRUE,
identical = TRUE,
nThread = parallel::detectCores() - 1,
many_sources = TRUE,
load_report = TRUE,
format_orig = FALSE
)
list of parsed data tables containing the information.
string, full folder path to RPDR text files.
string vector, an array of abbreviation corresponding to the datasources wished to load. Currently supported values and the default is: c("mrn", "con", "dem", "enc", "rdt", "lab", "med", "dia", "rfv", "prc", "car", "dis", "end", "hnp", "opn", "pat", "prg", "pul", "rad" and "vis")
boolean, should old load_dem function be used for loading demographic data. Defaults to TRUE, should be set to FALSE for Dem.txt datasets prior to 2022.
string, column name to use to create ID_MERGE column used to merge different datasets. Defaults to EMPI, as it is the preferred MRN in the RPDR system. In case of mrn dataset, leave at EMPI, as it is automatically converted to: "Enterprise_Master_Patient_Index".
string, divider between hospital ID and MRN. Defaults to :.
string, indicating whether to modify MRN length based-on required values id_length = standard, or to keep lengths as is id_length = asis. If id_length = standard then in case of MGH, BWH, MCL, EMPI and PMRN the length of the MRNs are corrected accordingly by adding zeros, or removing numeral from the beginning. In other cases the lengths are unchanged. Defaults to standard.
numeric, a number between 0-1 indicating which parsed ID columns to keep. Data present in perc x 100% of patients are kept.
boolean, whether to remove columns with only NA values. Defaults to TRUE.
boolean, whether to remove columns with identical values. Defaults to TRUE.
integer, number of threads to use for parallelization.
boolean, if TRUE, then parallelization is done on the level of the datasources. If FALSE, then parallelization is done within the datasources. If there are many datasources, then it is advised to set this TRUE, as then each different datasource will be processed in parallel. However, if there are only a few datasources selected to load, but many files per datasource (result of large queries), then it may be faster to parallelize within each datasource and therefore should be set to FALSE. If there are only a few sources each with one file then set to TRUE.
boolean, should the report text be returned for notes.
boolean, should report be returned in its original formatting or should white spaces used for formatting be removed. Defaults to FALSE.
if (FALSE) {
#Load all Con, Dem and Mrn datasets processing all files within given datasource in parallel
load_all(folder = folder_rpdr, which_data = c("con", "dem", "mrn"),
nThread = 2, many_sources = FALSE)
#Load all supported file types parallelizing on the level of datasources
load_all(folder = folder_rpdr, nThread = 2, many_sources = TRUE,
format_orig = TRUE)
}
Run the code above in your browser using DataLab