processLastDose: 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)
Value
data.frame with identifying information (e.g., filename, etc) as well as processed
and standardized last dose times as a POSIXct column
Arguments
mxrData
data.frame containing output from the medExtractR system
noteMetaData
data.frame with meta data (pid (patient ID) and date) for
the file names contained within mxrData
labData
data.frame that contains lab dates and times associated with the file names
within mxrData. Must contain columns pid and date, as well as labtime.
The date column must be in the same format as date in noteMetaData, and
labtime must be a POSIXct
Details
See EHR Vignette for Extract-Med and Pro-Med-NLP for details.