load_lno: Loads LMR note documents into R.

View source: R/load_lno.R

load_lnoR Documentation

Loads LMR note documents into R.

Description

Loads notes from the LMR legacy EHR system.

Usage

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

Arguments

file

string, full file path to Lno.txt.

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.

Value

data table, with LMR notes information.

ID_MERGE

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

ID_lno_EMPI

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

ID_lno_PMRN

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

ID_lno_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().

time_lno

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

lno_rec_id

string, Internal identifier for this report within the LMR system, corresponds to Record_Id in RPDR.

lno_status

string, Completion status of the note, corresponds to Status in RPDR.

lno_author

string, Name of user who created the note, corresponds to Author in RPDR.

lno_author_mrn

string, Author's user identifier within the LMR system, corresponds to Author_MRN in RPDR.

lno_COD

string, Hospital-specific user code of the note author. The first character is a hospital-specific prefix, corresponds to COD in RPDR.

lno_hosp

string, Facility where the encounter occurred, corresponds to Institution in RPDR.

lno_subject

string, Type of note. This value is derived from the "Subject" line of the narrative text, corresponds to Subject in RPDR.

lno_rep_txt

string, Full narrative text of the note, corresponds to Comments in RPDR.

Examples

## Not run: 
#Using defaults
d_lno <- load_lno(file = "test_Lno.txt")

#Use sequential processing
d_lno <- load_lno(file = "test_Lno.txt", nThread = 1)

#Use parallel processing and parse data in MRN_Type and MRN columns and keep all IDs
d_lno <- load_lno(file = "test_Lno.txt", nThread = 20, mrn_type = TRUE, perc = 1)

## End(Not run)

parseRPDR documentation built on March 31, 2023, 11:36 p.m.