collapseDose: Collapse Dose Data

View source: R/collapseDose.R

collapseDoseR Documentation

Collapse Dose Data

Description

Splits drug data and calls makeDose to collapse at the note and date level.

Usage

collapseDose(x, noteMetaData, naFreq = "most", ...)

Arguments

x

data.frame containing the output of buildDose, or the output of addLastDose if last dose information is being incorporated.

noteMetaData

data.frame containing identifying meta data for each note, including patient ID, date of the note, and note ID. Column names should be set to ‘filename’, ‘pid’, ‘date’, ‘note’. Date should have format YYYY-MM-DD.

naFreq

Expression used to replace missing frequencies with, or by default use the most common.

...

drug formulations to split by

Details

If different formulations of the drug (e.g., extended release) exist, they can be separated using a regular expression (e.g., ‘xr|er’). This function will call makeDose on parsed and paired medication data to calculate dose intake and daily dose and remove redundancies at the note and date level.

See EHR Vignette for Extract-Med and Pro-Med-NLP as well as Dose Building Using Example Vanderbilt EHR Data for details.

Value

A list containing two dataframes, one with the note level and one with the date level collapsed data.

Examples

data(lam_mxr_parsed)
data(lam_metadata)

lam_build_out <- buildDose(lam_mxr_parsed)

lam_collapsed <- collapseDose(lam_build_out, lam_metadata, naFreq = 'most', 'xr|er')
lam_collapsed$note # Note level collapsing
lam_collapsed$date # Date level collapsing

EHR documentation built on Dec. 28, 2022, 1:31 a.m.