load_notes {parseRPDR}R Documentation

Loads note documents into R.

Description

Loads documents information into the R environment, which are:

Cardiology:

"car"

Discharge:

"dis"

Endoscopy:

"end"

History & Physical:

"hnp"

Operative:

"opn"

Pathology:

"pat"

Progress:

"prg"

Pulmonary:

"pul"

Radiology:

"rad"

Visit:

"vis"

Usage

load_notes(
  file,
  type,
  merge_id = "EMPI",
  sep = ":",
  id_length = "standard",
  perc = 0.6,
  na = TRUE,
  identical = TRUE,
  nThread = parallel::detectCores() - 1,
  mrn_type = FALSE,
  load_report = TRUE,
  format_orig = FALSE
)

Arguments

file

string, full file path to given type of note i.e. Hnp.txt.

type

string, the type of note to be loaded. May be on of: "car", "dis", "end", "hnp", "opn", "pat", "prg", "pul", "rad" or "vis".

merge_id

string, column name to use to create ID_MERGE column used to merge different datasets. Defaults to EPIC_PMRN, as it is the preferred MRN in the RPDR system.

sep

string, divider between hospital ID and MRN. Defaults to :.

id_length

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.

perc

numeric, a number between 0-1 indicating which parsed ID columns to keep. Data present in perc x 100% of patients are kept.

na

boolean, whether to remove columns with only NA values. Defaults to TRUE.

identical

boolean, whether to remove columns with identical values. Defaults to TRUE.

nThread

integer, number of threads to use to load data.

mrn_type

boolean, should data in MRN_Type and MRN be parsed. Defaults to FALSE, as it is not advised to parse these for all data sources as it takes considerable time.

load_report

boolean, should the report text be returned in the data table. Defaults to TRUE. However, be aware that some notes may take up more memory than available on the machine.

format_orig

boolean, should report be returned in its original formatting or should white spaces used for formatting be removed. Defaults to FALSE.

Value

data table, with notes information. abc stands for the three letter abbreviation of the given type of note.

ID_MERGE

numeric, defined IDs by merge_id, used for merging later.

ID_abc_EMPI

string, Unique Partners-wide identifier assigned to the patient used to consolidate patient information from abc datasource, corresponds to EMPI in RPDR. Data is formatted using pretty_mrn().

ID_abc_PMRN

string, Epic medical record number. This value is unique across Epic instances within the Partners network from abc datasource, corresponds to EPIC_PMRN in RPDR. Data is formatted using pretty_mrn().

ID_abc_loc

string, if mrn_type == TRUE, then the data in MRN_Type and MRN are parsed into IDs corresponding to locations (loc). Data is formatted using pretty_mrn().

abc_rep_num

string, Source-specific identifier used to reference the report, corresponds to Report_Number in RPDR.

time_abc

POSIXct, Date when the report was filed, corresponds to Report_Date_Time in RPDR. Converted to POSIXct format.

abc_rep_desc

string, Type of report or procedure documented in the report, corresponds to Report_Description in RPDR.

abc_rep_status

string, Completion status of the note/report, corresponds to Report_Status in RPDR.

abc_rep_type

string, See specification in RPDR data dictionary, corresponds to Report_Type in RPDR.

abc_rep_txt

string, Full narrative text contained in the note/report, corresponds to Report_Text in RPDR. Only provided if load_report is TRUE.

Examples

## Not run: 
#Using defaults
d_hnp <- load_notes(file = "test_Hnp.txt", type = "hnp")

#Use sequential processing
d_hnp <- load_notes(file = "test_Hnp.txt", type = "hnp", nThread = 1, format_orig = TRUE)

#Use parallel processing and parse data in MRN_Type and MRN columns and keep all IDs
d_hnp <- load_notes(file = "test_Hnp.txt", type = "hnp", nThread = 20, mrn_type = TRUE, perc = 1)

## End(Not run)

[Package parseRPDR version 1.1.1 Index]