R package used to calculate different PreTest Probability (PTP) scores for obstructive Coronary Artery Disease (CAD).
As diagnosis of CAD involves a costly and invasive coronary angiography procedure for patients, having a reliable PTP for CAD helps doctors to make better decisions during patient management. This ensures high risk patients can be diagnosed and treated early for CAD while avoiding unnecessary testing for low-risk patients.
Install the development version from GitHub with:
# install.packages("pak")
::pak("JauntyJJS/pretestcad") pak
Here is how you can calculate the score using a single patient.
# 30 female with symptom score of 0 and 0 risk factors
calculate_esc_2024_fig_4_ptp(
age = 30,
sex = "female",
chest_pain_type = "no chest pain",
have_dyspnoea = "no",
have_family_history = "no",
have_smoking_history = "no",
have_dyslipidemia = "no",
have_hypertension = "no",
have_diabetes = "no",
output = "numeric"
)
[1] 0
calculate_esc_2024_fig_4_ptp(
age = 30,
sex = "female",
chest_pain_type = "no chest pain",
have_dyspnoea = "no",
have_family_history = "no",
have_smoking_history = "no",
have_dyslipidemia = "no",
have_hypertension = "no",
have_diabetes = "no",
output = "grouping"
)
[1] "very low"
Here is how you can calculate the score using for multiple patients.
<- tibble::tribble(
patient_data ~unique_id,
~age, ~sex,
~chest_pain_type, ~have_dyspnoea,
~have_family_history, ~have_smoking_history, ~have_dyslipidemia, ~have_hypertension, ~have_diabetes,
"45 year old male with typical chest pain, no dyspnoea, hypertension and diabetes",
45, "male",
"typical", "no",
"no", "no", "no", "yes", "yes",
"70 year old female with no chest pain, dyspnoea, have smoking history (past or current smoker) and dyslipidemia",
70, "female",
"no chest pain", "yes",
"no", "yes", "yes", "no", "no"
)
<- patient_data |>
risk_data ::mutate(
dplyresc_2024_ptp_group = purrr::pmap_chr(
.l = list(
age = .data[["age"]],
sex = .data[["sex"]],
chest_pain_type = .data[["chest_pain_type"]],
have_dyspnoea = .data[["have_dyspnoea"]],
have_family_history = .data[["have_family_history"]],
have_smoking_history = .data[["have_smoking_history"]],
have_dyslipidemia = .data[["have_dyslipidemia"]],
have_hypertension = .data[["have_hypertension"]],
have_diabetes = .data[["have_diabetes"]],
output = "grouping"
),.f = pretestcad::calculate_esc_2024_fig_4_ptp,
),esc_2024_ptp_numeric = purrr::pmap_int(
.l = list(
age = .data[["age"]],
sex = .data[["sex"]],
chest_pain_type = .data[["chest_pain_type"]],
have_dyspnoea = .data[["have_dyspnoea"]],
have_family_history = .data[["have_family_history"]],
have_smoking_history = .data[["have_smoking_history"]],
have_dyslipidemia = .data[["have_dyslipidemia"]],
have_hypertension = .data[["have_hypertension"]],
have_diabetes = .data[["have_diabetes"]],
output = "numeric"
),.f = pretestcad::calculate_esc_2024_fig_4_ptp
),esc_2024_ptp_percent = purrr::pmap_chr(
.l = list(
age = .data[["age"]],
sex = .data[["sex"]],
chest_pain_type = .data[["chest_pain_type"]],
have_dyspnoea = .data[["have_dyspnoea"]],
have_family_history = .data[["have_family_history"]],
have_smoking_history = .data[["have_smoking_history"]],
have_dyslipidemia = .data[["have_dyslipidemia"]],
have_hypertension = .data[["have_hypertension"]],
have_diabetes = .data[["have_diabetes"]],
output = "percentage"
),.f = pretestcad::calculate_esc_2024_fig_4_ptp
)|>
) ::select(
dplyrc("unique_id", "esc_2024_ptp_group",
"esc_2024_ptp_numeric", "esc_2024_ptp_percent")
)
print(risk_data)
# A tibble: 2 Γ 4
unique_id esc_2024_ptp_group esc_2024_ptp_numeric esc_2024_ptp_percent
<chr> <chr> <int> <chr>
1 45 year old male⦠moderate 20 20%
2 70 year old fema⦠low 10 10%