patient_data <- tibble::tribble(
~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"
)
risk_data <- patient_data |>
dplyr::mutate(
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
)
) |>
dplyr::select(
c("unique_id", "esc_2024_ptp_percent")
)
print(risk_data)