extract_lastdose: Extract Last Dose Time From Phrase

View source: R/extract_lastdose.R

extract_lastdoseR Documentation

Extract Last Dose Time From Phrase

Description

This function searches a phrase for the expression and postion of the time at which the last dose of a drug was taken. It is called within medExtractR and generally not intended for use outside that function.

Usage

extract_lastdose(phrase, p_start, d_start, d_stop, time_exp = "default")

Arguments

phrase

Text to search.

p_start

Start position of phrase in the overall text (e.g., the full clinical note).

d_start

Start position of drug name in larger text.

d_stop

End position of drug name in larger text.

time_exp

Vector of regular expressions to identify time expressions.

Details

This function identifies the time at which the last dose of a drug of interest was taken. The arguments p_start, d_start, and d_stop represent global start or stop positions for the phrase or drug. These arguments are used to determine the position of any found last dose time expressions relative to the overall clinical note, not just within phrase.

The time_exp argument contains regular expressions for numeric or text representations of last dose time. See time_regex for more information about the default regular expressions used in medExtractR.

Value

data.frame with last dose time entity information. This output format is consistent with the output of extract_entities, and the formatted label for the time of last dose entity is "LastDose."
Sample output for the phrase “Last prograf at 5pm” would look like:

entity expr
LastDose 5pm;17:20

Examples

# Suppose this phrase begins at character 120 in the overall clinical note
extract_lastdose("took aspirin last night at 8pm", p_start = 120,
                  d_start = 125, d_stop = 131)

medExtractR documentation built on June 7, 2022, 1:08 a.m.