processLastDose {EHR} | R Documentation |
Process and standardize extracted last dose times
Description
This function takes last dose times extracted using the medExtractR system and
processes the times into standardized datetime objects using recorded lab data where necessary.
The raw output from extractMed
is filtered to just the LastDose extractions. Time expressions
are standardized into HH:MM:SS format based on what category they fall into (e.g., a time represented
with AM/PM, 24-hour military time, etc.). When the last dose time is after 12pm, it is assumed to have
been taken one day previous to the note's date. For any duration extractions (e.g. "14 hour level"),
the last dose time is calculated from the labtime by extracting the appropriate number of hours. The
final dataset is returned with last dose time formatted into a POSIXct variable.
Usage
processLastDose(mxrData, noteMetaData, labData)
Arguments
mxrData |
data.frame containing output from the |
noteMetaData |
data.frame with meta data ( |
labData |
data.frame that contains lab dates and times associated with the file names
within |
Details
See EHR Vignette for Extract-Med and Pro-Med-NLP for details.
Value
data.frame with identifying information (e.g., filename, etc) as well as processed and standardized last dose times as a POSIXct column
Examples
tac_mxr <- read.csv(system.file("examples", "tac_mxr.csv", package = "EHR"))
data(tac_metadata)
data(tac_lab)
processLastDose(mxrData = tac_mxr, noteMetaData = tac_metadata, labData = tac_lab)