load_prc: Loads procedures into R.

View source: R/load_prc.R

load_prcR Documentation

Loads procedures into R.

Description

Loads Clinical procedure information into the R environment, both Prc and Pec files.

Usage

load_prc(
  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 Prc.txt or Pec.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 procedural information.

ID_MERGE

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

ID_prc_EMPI

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

ID_prc_PMRN

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

ID_prc_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_prc

POSIXct, Date when the procedure was performed, corresponds to Date in RPDR. Converted to POSIXct format.

prc_name

string, Name of the procedure or operation performed, corresponds to Procedure_Name in RPDR.

prc_code

string, Procedure code associated with the "Code_type" value, corresponds to Code in RPDR.

prc_code_type

string, Standardized classification system or custom source value associated with the procedure code, corresponds to Code_type in RPDR.

prc_flag

string, Qualifier for the diagnosis, corresponds to Procedure_Flag in RPDR.

prc_quantity

string, Number of the procedures that were ordered for this record, corresponds to Quantity in RPDR.

prc_provider

string, Provider identifies the health care clinician performing the procedure, corresponds to Provider in RPDR.

prc_clinic

string, Specific department/location where the procedure was ordered or performed, corresponds to Clinic in RPDR.

prc_hosp

string, Facility where the procedure was ordered or performed, corresponds to Hospital in RPDR.

prc_inpatient

string, classifies the type of encounter where the procedure was performed or ordered.

prc_enc_num

string, Unique identifier of the record/visit, displayed in the following format: Source System - Institution Number, corresponds to Encounter_number in RPDR.

Examples

## Not run: 
#Using defaults
d_prc <- load_prc(file = "test_Prc.txt")

#Use sequential processing
d_prc <- load_prc(file = "test_Prc.txt", nThread = 1)

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

## End(Not run)

parseRPDR documentation built on June 24, 2024, 5:16 p.m.