Derives a character lab grade based on severity/toxicity criteria.
Usage
derive_var_atoxgr_dir(
dataset,
new_var,
tox_description_var,
meta_criteria,
criteria_direction,
get_unit_expr
)
Arguments
- dataset
Input data set
The columns specified by
tox_description_var
parameter is expected.- new_var
Name of the character grade variable to create, for example,
ATOXGRH
orATOXGRL
.- tox_description_var
Variable containing the description of the grading criteria. For example: "Anemia" or "INR Increased".
- meta_criteria
Metadata data set holding the criteria (normally a case statement)
Permitted Values: atoxgr_criteria_ctcv4, atoxgr_criteria_ctcv5
admiral metadata data set
atoxgr_criteria_ctcv4
implements Common Terminology Criteria for Adverse Events (CTCAE) v4.0 admiral metadata data setatoxgr_criteria_ctcv5
implements Common Terminology Criteria for Adverse Events (CTCAE) v5.0The metadata should have the following variables:
TERM
: variable to hold the term describing the criteria applied to a particular lab test, eg. "Anemia" or "INR Increased". Note: the variable is case insensitive.DIRECTION
: variable to hold the direction of the abnormality of a particular lab test value. "L" is for LOW values, "H" is for HIGH values. Note: the variable is case insensitive.SI_UNIT_CHECK
: variable to hold unit of particular lab test. Used to check against input data if criteria is based on absolute values.VAR_CHECK
: variable to hold comma separated list of variables used in criteria. Used to check against input data that variables exist.GRADE_CRITERIA_CODE
: variable to hold code that creates grade based on defined criteria.
- criteria_direction
Direction (L= Low, H = High) of toxicity grade.
Permitted Values: "L", "H"
- get_unit_expr
An expression providing the unit of the parameter
The result is used to check the units of the input parameters. Compared with
SI_UNIT_CHECK
in metadata (seemeta_criteria
parameter).Permitted Values: A variable containing unit from the input dataset, or a function call, for example,
get_unit_expr = extract_unit(PARAM)
.
Details
new_var
is derived with values NA, "0", "1", "2", "3", "4", where "4" is the most
severe grade
"4" is where the lab value satisfies the criteria for grade 4.
"3" is where the lab value satisfies the criteria for grade 3.
"2" is where the lab value satisfies the criteria for grade 2.
"1" is where the lab value satisfies the criteria for grade 1.
"0" is where a grade can be derived and is not grade "1", "2", "3" or "4".
NA is where a grade cannot be derived.
See also
BDS-Findings Functions that returns variable appended to dataset:
derive_var_analysis_ratio()
,
derive_var_anrind()
,
derive_var_atoxgr()
,
derive_var_basetype()
,
derive_var_base()
,
derive_var_chg()
,
derive_var_ontrtfl()
,
derive_var_pchg()
,
derive_var_shift()
Examples
library(tibble)
data <- tribble(
~ATOXDSCL, ~AVAL, ~ANRLO, ~ANRHI, ~PARAM,
"Hypoglycemia", 119, 4, 7, "Glucose (mmol/L)",
"Hypoglycemia", 120, 4, 7, "Glucose (mmol/L)",
"Anemia", 129, 120, 180, "Hemoglobin (g/L)",
"White blood cell decreased", 10, 5, 20, "White blood cell (10^9/L)",
"White blood cell decreased", 15, 5, 20, "White blood cell (10^9/L)",
"Anemia", 140, 120, 180, "Hemoglobin (g/L)"
)
derive_var_atoxgr_dir(data,
new_var = ATOXGRL,
tox_description_var = ATOXDSCL,
meta_criteria = atoxgr_criteria_ctcv4,
criteria_direction = "L",
get_unit_expr = extract_unit(PARAM)
)
#> # A tibble: 6 x 6
#> ATOXDSCL AVAL ANRLO ANRHI PARAM ATOXGRL
#> <chr> <dbl> <dbl> <dbl> <chr> <chr>
#> 1 Anemia 129 120 180 Hemoglobin (g/L) 0
#> 2 Anemia 140 120 180 Hemoglobin (g/L) 0
#> 3 Hypoglycemia 119 4 7 Glucose (mmol/L) 0
#> 4 Hypoglycemia 120 4 7 Glucose (mmol/L) 0
#> 5 White blood cell decreased 10 5 20 White blood cell (10^9/L) 0
#> 6 White blood cell decreased 15 5 20 White blood cell (10^9/L) 0
data <- tribble(
~ATOXDSCH, ~AVAL, ~ANRLO, ~ANRHI, ~PARAM,
"Hyperglycemia", 119, 4, 7, "Glucose (mmol/L)",
"Hyperglycemia", 120, 4, 7, "Glucose (mmol/L)",
"GGT increased", 129, 0, 30, "Gamma Glutamyl Transferase (U/L)",
"Lymphocyte count increased", 4, 1, 4, "Lymphocytes Abs (10^9/L)",
"Lymphocyte count increased", 2, 1, 4, "Lymphocytes Abs (10^9/L)",
"GGT increased", 140, 120, 180, "Gamma Glutamyl Transferase (U/L)"
)
derive_var_atoxgr_dir(data,
new_var = ATOXGRH,
tox_description_var = ATOXDSCH,
meta_criteria = atoxgr_criteria_ctcv4,
criteria_direction = "H",
get_unit_expr = extract_unit(PARAM)
)
#> # A tibble: 6 x 6
#> ATOXDSCH AVAL ANRLO ANRHI PARAM ATOXGRH
#> <chr> <dbl> <dbl> <dbl> <chr> <chr>
#> 1 GGT increased 129 0 30 Gamma Glutamyl Transferase… 2
#> 2 GGT increased 140 120 180 Gamma Glutamyl Transferase… 0
#> 3 Hyperglycemia 119 4 7 Glucose (mmol/L) 4
#> 4 Hyperglycemia 120 4 7 Glucose (mmol/L) 4
#> 5 Lymphocyte count increa… 4 1 4 Lymphocytes Abs (10^9/L) 0
#> 6 Lymphocyte count increa… 2 1 4 Lymphocytes Abs (10^9/L) 0