Description Usage Arguments Details Value
View source: R/get_line_data.R
Get_line_data function returns relevant line of therapy information such as line name,
line end date, is maintenance therapy, next line start date, line type, and line end reason.
The function is used in the LoT_main
. The function scans through the
input drug episode dataframe to check for line advancement and outputs the line data.
1 2 3 4 5 6 7 8 9 10 11 | get_line_data(
df,
r_regimen,
l_disgap,
l_line_number,
l_is_next_maintenance,
input_r_window,
input_drug_switch_ignore,
input_combo_dropped_line_advance,
input_indication
)
|
df |
a dataframe with PATIENT_ID ,MED_NAME, MED_START, MED_END columns |
r_regimen |
vector of drugs included in the line treatment regimen |
l_disgap |
threshold number of days of gap in administration before advancing the line |
l_line_number |
a numeric value for the current line number |
input_r_window |
threshold number of days for the regimen defining window to detect combination drugs |
input_drug_switch_ignore |
TRUE or FALSE, flag to see if a drug is administered during the r_window period, but never administered again after, then ignore it from the regimen |
input_combo_dropped_line_advance |
TRUE or FALSE, flag to see if a combination drug is dropped, whether or not it triggers an advance in line number |
input_indication |
The indication of interest |
General Steps:
Check if we hit last row of table - if so then there is no further data to analyze and we stop here, setting end date to be the last date activity
Check if there is a gap between the current drug date for that line. If there is, then we move to the second pass of checks
Check if the the next drug is a drug not within the regimen. If there is, then we move to the second pass of checks
Second pass - analyze combo treatment and determine the correct discontinuation date and account for drug introduction
Second pass - analyze the discontinuations and account for exceptions to discontinuations based on medication
Second pass- analyze if the treatment is maintenance therapy. If it is, then label it as such and do not advance line number
Compute final outputs and return it
A list of line data items: line_name, line_type, line_start, line_end, line_next_start, line_end_reason, line_number, line_is_maintenance, line_is_next_maintenance, line_add_exemption, line_sub_exemption, line_gap_exemption, line_name_exemption
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.