Type: Package
Title: Pretest Probability for Coronary Artery Disease
Version: 1.0.2
Maintainer: Jeremy Selva <jeremy1189.jjs@gmail.com>
Description: An application to calculate a patient's pretest probability (PTP) for obstructive Coronary Artery Disease (CAD) from a collection of guidelines or studies. Guidelines usually comes from the American Heart Association (AHA), American College of Cardiology (ACC) or European Society of Cardiology (ESC). Examples of PTP scores that comes from studies are the 2020 Winther et al. basic, Risk Factor-weighted Clinical Likelihood (RF-CL) and Coronary Artery Calcium Score-weighted Clinical Likelihood (CACS-CL) models <doi:10.1016/j.jacc.2020.09.585>, 2019 Reeh et al. basic and clinical models <doi:10.1093/eurheartj/ehy806> and 2017 Fordyce et al. PROMISE Minimal-Risk Tool <doi:10.1001/jamacardio.2016.5501>. 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.
License: MIT + file LICENSE
Encoding: UTF-8
Language: en-GB
Depends: R (≥ 4.1.0)
Imports: cli, dplyr, rlang, stringr
Suggests: purrr, tibble, spelling, testthat (≥ 3.0.0)
RoxygenNote: 7.3.2
URL: https://github.com/JauntyJJS/pretestcad, https://jauntyjjs.github.io/pretestcad/
BugReports: https://github.com/JauntyJJS/pretestcad/issues
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2025-05-15 15:18:53 UTC; Jeremy
Author: Jeremy Selva ORCID iD [aut, cre]
Repository: CRAN
Date/Publication: 2025-05-19 13:50:03 UTC

Match an argument to a character vector but skip NA

Description

This is equivalent to arg_match but skip NA

Usage

arg_match0_allow_na(
  arg,
  values,
  arg_nm = rlang::caller_arg(arg),
  error_call = rlang::caller_env()
)

Arguments

arg

A symbol referring to an argument accepting strings.

values

A character vector of possible values that arg can take.

arg_nm

Same as error_arg.

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

The string supplied to arg.

See Also

caller_arg, stack, arg_match


Match an argument to a integer vector but skip NA

Description

This is equivalent to arg_match but an integer vector is compared and skip NA.

Usage

arg_match0_integer(
  arg,
  values,
  allow_na = TRUE,
  arg_nm = rlang::caller_arg(arg),
  error_call = rlang::caller_env()
)

Arguments

arg

A symbol referring to an argument accepting strings.

values

A character vector of possible values that arg can take.

allow_na

Input boolean to determine if NA or NaN is allowed. Default: TRUE

arg_nm

Same as error_arg.

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

The integer supplied to arg.


Match an argument to a TRUE or FALSE vector but skip NA

Description

This is equivalent to arg_match but an integer vector is compared and skip NA.

Usage

arg_match0_true_or_false(
  arg,
  allow_na = TRUE,
  arg_nm = rlang::caller_arg(arg),
  error_call = rlang::caller_env()
)

Arguments

arg

A symbol referring to an argument accepting strings.

allow_na

Input boolean to determine if NA or NaN is allowed. Default: TRUE

arg_nm

Same as error_arg.

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

The TRUE or FALSE value supplied to arg.


Calculate ACCF/AHA/ACP/AATS/PCNA/SCAI/STS 2012 PTP for obstructive CAD

Description

This function returns a patient's pre-test Probability (PTP) of obstructive coronary artery disease (CAD) based on the American College of Cardiology Foundation, American Heart Association, American College of Physicians, American Association for Thoracic Surgery, Preventive Cardiovascular Nurses Association, Society for Cardiovascular Angiography and Interventions, and Society of Thoracic Surgeons 2012 guidelines.

Usage

calculate_aha_2012_tbl_9_ptp(
  age,
  sex,
  chest_pain_type,
  output = c("numeric", "percentage")
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

output

Input text to indicate the how pre-test probability results be expressed Default: c("numeric", "percentage")

  • numeric means the PTP will be expressed as an integer probability (0-100).

  • percentage means the PTP will be expressed as percentage text (0-100%).

Details

The predictive model used to create the guidelines are based on patients from the Diamond and Forrester and the Coronary Artery Surgery Study.

Value

An integer or percentage representing the patient's PTP for obstructive CAD based on the ACCF/AHA/ACP/AATS/PCNA/SCAI/STS 2012 guidelines.

Examples

# 35 year old female with typical chest pain
calculate_aha_2012_tbl_9_ptp(
    age = 35,
    sex = "female",
    chest_pain_type = "typical",
    output = "percentage"
)

# 65 year old male with nonanginal chest pain
calculate_aha_2012_tbl_9_ptp(
    age = 65,
    sex = "male",
    chest_pain_type = "nonanginal",
    output = "percentage"
)

Calculate AHA/ACC 2021 PTP for obstructive CAD

Description

This function returns a patient's pre-test Probability (PTP) of obstructive coronary artery disease (CAD) based on the American Heart Association/American College of Cardiology (AHA/ACC) 2021 guidelines.

Usage

calculate_aha_2021_ptp(
  age,
  sex,
  have_dyspnoea,
  have_chest_pain,
  output = c("grouping", "numeric", "percentage")
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

have_dyspnoea

Input characters (no, yes) to indicate if the patient only has dyspnoea symptoms.

  • no stands for not having dyspnoea symptoms.

  • yes stands for having dyspnoea symptoms.

have_chest_pain

Input characters (no, yes) to indicate if the patient has chest pain.

  • no stands for not having dyspnoea symptoms.

  • yes stands for having dyspnoea symptoms.

output

Input text to indicate the how pre-test probability results be expressed Default: c("grouping", "numeric", "percentage")

  • grouping means the PTP will be expressed as Low, Intermediate and High.

    • very low if PTP is less than 5%.

    • low if PTP is in between 5% to 15%.

    • intermediate if PTP is in between 15% to 50%.

    • high if PTP is more than 50%.

  • numeric means the PTP will be expressed as an integer probability (0-100).

  • percentage means the PTP will be expressed as percentage text (0-100%).

Details

The predictive model used to create the guidelines are based on patients from European countries with low cardiovascular disease (CVD) risk.

If the patient has both dyspnoea and a particular chest pain type (typical, atypical, nonanginal), The chest pain type will take precedence over dyspnoea

Value

An integer, percentage or category representing the patient's PTP for obstructive CAD based on the AHA/ACC 2021 guidelines. See parameter option output for more information.

Examples

# 35 year old female with chest pain
calculate_aha_2021_ptp(
    age = 35,
    sex = "female",
    have_dyspnoea = "no",
    have_chest_pain = "yes",
    output = "percentage"
)

# 75 year old male with only dyspnoea
calculate_aha_2021_ptp(
    age = 75,
    sex = "male",
    have_dyspnoea = "yes",
    have_chest_pain = "no",
    output = "percentage"
)

Calculate 2011 CAD1 Basic PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2011 CAD Consortium 1 (CAD1) basic model.

Usage

calculate_cad1_2011_ptp(age, sex, chest_pain_type)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

Details

The predictive model is based on patients from 14 hospitals in Europe and the United States.

This model is also called the updated Diamond-Forrester model.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2011 CAD Consortium 1 (CAD1) basic model.

Examples

# 40 year old female with typical chest pain
calculate_cad1_2011_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical"
)

Calculate 2012 CAD2 Basic PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2012 CAD Consortium 2 (CAD2) basic model.

Usage

calculate_cad2_2012_basic_ptp(age, sex, chest_pain_type)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

Details

The predictive model is based on patients from 18 hospitals in Europe and the United States.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2012 CAD Consortium 2 (CAD2) basic model.

Examples

# 40 year old female with typical chest pain
calculate_cad2_2012_basic_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical"
)

Calculate 2012 CAD2 Clinical and CCS PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2012 CAD Consortium 2 (CAD2) clinical and coronary calcium score (CCS) model.

Usage

calculate_cad2_2012_clinical_ccs_ptp(
  age,
  sex,
  chest_pain_type,
  have_diabetes,
  have_hypertension,
  have_dyslipidemia,
  have_smoking_history,
  coronary_calcium_score
)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

coronary_calcium_score

Input non-negative numeric to indicate the total coronary calcium score of the patient.

Details

The predictive model is based on patients from 18 hospitals in Europe and the United States.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2012 CAD Consortium 2 (CAD2) clinical and coronary calcium score (CCS) model.

Examples

# 40 year old female with typical chest pain,
# diabetes but no hypertension, dyslipidemia,
# a non-smoker and a coronary calcium score of 0
calculate_cad2_2012_clinical_ccs_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical",
    have_diabetes = "yes",
    have_hypertension = "no",
    have_dyslipidemia = "no",
    have_smoking_history = "no",
    coronary_calcium_score = 0

)

Calculate 2012 CAD2 Clinical PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2012 CAD Consortium 2 (CAD2) clinical model.

Usage

calculate_cad2_2012_clinical_ptp(
  age,
  sex,
  chest_pain_type,
  have_diabetes,
  have_hypertension,
  have_dyslipidemia,
  have_smoking_history
)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

Details

The predictive model is based on patients from 18 hospitals in Europe and the United States.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2012 CAD Consortium 2 (CAD2) clinical model.

Examples

# 40 year old female with typical chest pain,
# diabetes but no hypertension, dyslipidemia
# and a non-smoker
calculate_cad2_2012_clinical_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical",
    have_diabetes = "yes",
    have_hypertension = "no",
    have_dyslipidemia = "no",
    have_smoking_history = "no"

)

Calculate Number Of Risk Factors (CONFIRM 2015)

Description

A function used to calculate the number of risk factors the patient has. This is used to calculate the pretest probability of coronary artery disease (CAD) based on the 2015 CONFIRM Risk Score.

Usage

calculate_confirm_2015_num_of_rf(
  have_typical_chest_pain,
  have_diabetes,
  have_hypertension,
  have_family_history,
  is_current_smoker,
  max_na = 0
)

Arguments

have_typical_chest_pain

Input characters (no, yes) to indicate if the patient has typical chest pain.

  • no stands for not having typical chest pain.

  • yes stands for having typical chest pain.

have_diabetes

Input characters (no, yes) to indicate if the patient only has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient only has hypertension.

  • no stands for not having hypertension.

  • yes stands for having a hypertension.

have_family_history

Input characters (no, yes) to indicate if the patient only has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

is_current_smoker

Input characters (no, yes) to indicate if the patient is a current smoker.

  • no stands for patient is a current smoker.

  • yes stands for patient is a not current smoker (past or non-smoker).

max_na

Input integer 0 to 5 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

Value

An integer indicating the number of risk factors the patient has. It can also be NA if the number of missing risk factors exceeds the max_na input value

Examples

calculate_confirm_2015_num_of_rf(
  have_typical_chest_pain = "yes",
  have_diabetes = "yes",
  have_hypertension = "yes",
  have_family_history = "yes",
  is_current_smoker = "no"
)

calculate_confirm_2015_num_of_rf(
  have_typical_chest_pain = "no",
  have_diabetes = "no",
  have_hypertension = "no",
  have_family_history = NA,
  is_current_smoker = "no",
  max_na = 0
)

calculate_confirm_2015_num_of_rf(
  have_typical_chest_pain = "no",
  have_diabetes = "no",
  have_hypertension = "no",
  have_family_history = NA,
  is_current_smoker = "no",
  max_na = 1
)

Calculate 2015 CONFIRM Risk Score for obstructive CAD

Description

This function returns a patient's risk score for obstructive coronary artery disease based on the 2015 CONFIRM Risk Score.

Usage

calculate_confirm_2015_ptp(
  age,
  sex,
  have_typical_chest_pain,
  have_diabetes,
  have_hypertension,
  have_family_history,
  is_current_smoker,
  max_na_num_of_rf = 0,
  output = c("text", "percentage")
)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

have_typical_chest_pain

Input characters (no, yes) to indicate if the patient has typical chest pain.

  • no stands for not having typical chest pain.

  • yes stands for having typical chest pain.

have_diabetes

Input characters (no, yes) to indicate if the patient only has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient only has hypertension.

  • no stands for not having hypertension.

  • yes stands for having a hypertension.

have_family_history

Input characters (no, yes) to indicate if the patient only has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

is_current_smoker

Input characters (no, yes) to indicate if the patient is a current smoker.

  • no stands for patient is a current smoker.

  • yes stands for patient is a not current smoker (past or non-smoker).

max_na_num_of_rf

Input integer 0 to 5 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

output

Input text to indicate the how pre-test probability results be expressed Default: c("text", "percentage")

  • text means the PTP will be expressed as a probability in text (0 to > 82.4).

  • percentage means the PTP will be expressed as percentage text (0-100%).

Details

The predictive model is based on CCTA images from 9093 patients from Phase I of the Coronary CT Angiography EvaluatioN For Clinical Outcomes: An InteRnational Multicenter (CONFIRM) registry.

Value

A numeric value representing the patient's risk score for obstructive CAD based on the 2015 CONFIRM Risk Score.

Examples

# 30 years old male current smoker with typical chest pain
calculate_confirm_2015_ptp(
  age = 30,
  sex = "male",
  have_typical_chest_pain = "yes",
  have_diabetes = "no",
  have_hypertension = "no",
  have_family_history = "no",
  is_current_smoker = "yes",
  max_na_num_of_rf = 0,
  output = "percentage"
)

Calculate 1993 Duke Clinical Score for Left Main Disease

Description

This function returns a patient's pre-test probability (PTP) of severe (>75% luminal diameter narrowing of the left main coronary artery) coronary artery disease based on the 1993 Duke Clinical Score.

Usage

calculate_dcs_1993_lm_cad_ptp(
  age,
  sex,
  have_typical_chest_pain,
  have_peripheral_vascular_disease,
  have_cerebrovascular_disease,
  have_carotid_bruits,
  duration_of_cad_symptoms_year,
  max_na_vascular_disease_index = 0,
  max_age = 65
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

have_typical_chest_pain

Input characters (no, yes) to indicate if the patient has typical chest pain.

  • no stands for the patient not having typical chest pain.

  • yes stands for the patient having typical chest pain.

have_peripheral_vascular_disease

Input characters (no, yes) to indicate if the patient has peripheral vascular disease.

  • no stands for not having peripheral vascular disease.

  • yes stands for having peripheral vascular disease.

have_cerebrovascular_disease

Input characters (no, yes) to indicate if the patient has cerebrovascular disease.

  • no stands for not having cerebrovascular disease.

  • yes stands for having cerebrovascular disease.

have_carotid_bruits

Input characters (no, yes) to indicate if the patient has carotid bruits.

  • no stands for not having carotid bruits.

  • yes stands for having carotid bruits.

duration_of_cad_symptoms_year

Input integer to indicate the duration of coronary artery disease symptoms in years.

max_na_vascular_disease_index

Input integer 0 to 3 to indicate the maximum number of missing disease history to tolerate before outputting an NA. Default: 0

max_age

Input positive integer to indicate the maximum age to tolerate before outputting an NA. In the Duke Clinical Score 1993 paper, the maximum value is set as 65. Default: 65

Details

The predictive model is based on patients referred for cardiac catheterisation between 1969 and 1983.

Value

A numeric value representing the patient's PTP for left main disease (>75% luminal diameter narrowing of the left main coronary artery) based on the 1993 Duke Clinical Score.

Examples

# 40 year old female with typical chest pain for one year,
# She has peripheral vascular and cerebrovascular disease.

calculate_dcs_1993_lm_cad_ptp(
    age = 40,
    sex = "female",
    have_typical_chest_pain = "yes",
    have_peripheral_vascular_disease = "yes",
    have_cerebrovascular_disease = "yes",
    have_carotid_bruits = "no",
    duration_of_cad_symptoms_year = 1,
)


Calculate The Pain Index For Duke Clinical Score 1993

Description

A function used to calculate the patient's pain index. This is used to calculate the likelihood of severe coronary artery disease in the Duke Clinical Score 1993 paper.

Usage

calculate_dcs_1993_pain_index(
  have_typical_chest_pain,
  frequency_of_angina_pain_per_week,
  have_progressive_angina,
  have_nocturnal_angina,
  have_q_waves,
  have_st_t_changes,
  max_na = 0,
  max_frequency_of_angina_pain_per_week = 35
)

Arguments

have_typical_chest_pain

Input characters (no, yes) to indicate if the patient has typical chest pain.

  • no stands for not having typical chest pain.

  • yes stands for having typical chest pain.

frequency_of_angina_pain_per_week

Input integer to indicate the patient's frequency of angina per week.

have_progressive_angina

Input characters (no, yes) to indicate if the patient has progressive angina.

  • no stands for not having progressive angina.

  • yes stands for having progressive angina.

have_nocturnal_angina

Input characters (no, yes) to indicate if the patient has nocturnal angina.

  • no stands for not having nocturnal angina.

  • yes stands for having nocturnal angina.

have_q_waves

Input characters (no, yes) to indicate if the patient has Q waves on electrocardiogram (ECG).

  • no stands for the patient not having Q waves on ECG.

  • yes stands for the patient having Q waves on ECG.

have_st_t_changes

Input characters (no, yes) to indicate if the patient has ST-T changes on electrocardiogram (ECG).

  • no stands for the patient not having ST-T changes on ECG.

  • yes stands for the patient having ST-T changes on ECG.

max_na

Input integer 0 to 6 to indicate the maximum number of missing symptoms to tolerate before outputting an NA. Default: 0

max_frequency_of_angina_pain_per_week

Input non-negative integer to indicate the maximum frequency angina per week to tolerate before outputting an NA. In the Duke Clinical Score 1993 paper, the maximum value is set as 35. Default: 35

Value

An integer indicating the patient's pain index. It can also be NA if the number of missing symptoms exceeds the max_na input value or the frequency of angina per week exceed the max_frequency_of_angina_pain_per_week input value.

Examples

calculate_dcs_1993_pain_index(
  have_typical_chest_pain = "yes",
  frequency_of_angina_pain_per_week = 10,
  have_progressive_angina = "yes",
  have_nocturnal_angina = "no",
  have_q_waves = "no",
  have_st_t_changes = "no",
  max_na = 0,
  max_frequency_of_angina_pain_per_week = 35
)

calculate_dcs_1993_pain_index(
  have_typical_chest_pain = "yes",
  frequency_of_angina_pain_per_week = 10,
  have_progressive_angina = "yes",
  have_nocturnal_angina = NA,
  have_q_waves = "no",
  have_st_t_changes = "no",
  max_na = 0,
  max_frequency_of_angina_pain_per_week = 35
)

calculate_dcs_1993_pain_index(
  have_typical_chest_pain = "yes",
  frequency_of_angina_pain_per_week = 10,
  have_progressive_angina = "yes",
  have_nocturnal_angina = NA,
  have_q_waves = "no",
  have_st_t_changes = "no",
  max_na = 1,
  max_frequency_of_angina_pain_per_week = 35
)

calculate_dcs_1993_pain_index(
  have_typical_chest_pain = "yes",
  frequency_of_angina_pain_per_week = 40,
  have_progressive_angina = "yes",
  have_nocturnal_angina = "no",
  have_q_waves = "no",
  have_st_t_changes = "no",
  max_na = 0,
  max_frequency_of_angina_pain_per_week = 35
)

calculate_dcs_1993_pain_index(
  have_typical_chest_pain = "yes",
  frequency_of_angina_pain_per_week = 40,
  have_progressive_angina = "yes",
  have_nocturnal_angina = "no",
  have_q_waves = "no",
  have_st_t_changes = "no",
  max_na = 0,
  max_frequency_of_angina_pain_per_week = NA
)


Calculate The Risk Factor Index For Duke Clinical Score 1993

Description

A function used to calculate the patient's risk factor index. This is used to calculate the likelihood of severe coronary artery disease in the Duke Clinical Score 1993 paper.

Usage

calculate_dcs_1993_risk_factor_index(
  have_hypertension,
  have_dyslipidemia,
  have_diabetes,
  max_na = 0
)

Arguments

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

max_na

Input integer 0 to 3 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

Value

An integer indicating the patient's risk factor index. It can also be NA if the number of missing risk factors exceeds the max_na input value.

Examples

calculate_dcs_1993_risk_factor_index(
  have_hypertension = "yes",
  have_dyslipidemia = "yes",
  have_diabetes = "no"
)

calculate_dcs_1993_risk_factor_index(
  have_hypertension = NA,
  have_dyslipidemia = "yes",
  have_diabetes = "no",
  max_na = 0
)

calculate_dcs_1993_risk_factor_index(
  have_hypertension = NA,
  have_dyslipidemia = "yes",
  have_diabetes = "no",
  max_na = 1
)

Calculate 1993 Duke Clinical Score for Severe CAD

Description

This function returns a patient's pre-test probability (PTP) of severe (>75% luminal diameter narrowing of all three major coronary arteries or of the left main coronary artery) coronary artery disease based on the 1993 Duke Clinical Score.

Usage

calculate_dcs_1993_severe_cad_ptp(
  age,
  sex,
  chest_pain_type,
  have_progressive_angina,
  have_nocturnal_angina,
  have_peripheral_vascular_disease,
  have_cerebrovascular_disease,
  have_carotid_bruits,
  have_hypertension,
  have_dyslipidemia,
  have_diabetes,
  have_q_waves,
  have_st_t_changes,
  frequency_of_angina_pain_per_week,
  duration_of_cad_symptoms_year,
  max_na_risk_factor_index = 0,
  max_na_pain_index = 0,
  max_na_vascular_disease_index = 0,
  max_frequency_of_angina_pain_per_week = 35
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_progressive_angina

Input characters (no, yes) to indicate if the patient has progressive angina.

  • no stands for not having progressive angina.

  • yes stands for having progressive angina.

have_nocturnal_angina

Input characters (no, yes) to indicate if the patient has nocturnal angina.

  • no stands for not having nocturnal angina.

  • yes stands for having nocturnal angina.

have_peripheral_vascular_disease

Input characters (no, yes) to indicate if the patient has peripheral vascular disease.

  • no stands for not having peripheral vascular disease.

  • yes stands for having peripheral vascular disease.

have_cerebrovascular_disease

Input characters (no, yes) to indicate if the patient has cerebrovascular disease.

  • no stands for not having cerebrovascular disease.

  • yes stands for having cerebrovascular disease.

have_carotid_bruits

Input characters (no, yes) to indicate if the patient has carotid bruits.

  • no stands for not having carotid bruits.

  • yes stands for having carotid bruits.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_q_waves

Input characters (no, yes) to indicate if the patient has Q waves on electrocardiogram (ECG).

  • no stands for the patient not having Q waves on ECG.

  • yes stands for the patient having Q waves on ECG.

have_st_t_changes

Input characters (no, yes) to indicate if the patient has ST-T changes on electrocardiogram (ECG).

  • no stands for the patient not having ST-T changes on ECG.

  • yes stands for the patient having ST-T changes on ECG.

frequency_of_angina_pain_per_week

Input integer to indicate the patient's frequency of angina per week.

duration_of_cad_symptoms_year

Input integer to indicate the duration of coronary artery disease symptoms in years.

max_na_risk_factor_index

Input integer 0 to 3 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

max_na_pain_index

Input integer 0 to 5 to indicate the maximum number of missing symptoms to tolerate before outputting an NA. Default: 0

max_na_vascular_disease_index

Input integer 0 to 3 to indicate the maximum number of missing disease history to tolerate before outputting an NA. Default: 0

max_frequency_of_angina_pain_per_week

Input non-negative integer to indicate the maximum frequency angina per week to tolerate before outputting an NA. In the Duke Clinical Score 1993 paper, the maximum value is set as 35. Default: 35

Details

The predictive model is based on patients referred for cardiac catheterisation between 1969 and 1983.

Value

A numeric value representing the patient's PTP for severe (>75% luminal diameter narrowing of all three major coronary arteries or of the left main coronary artery) CAD based on the 1993 Duke Clinical Score.

Examples

# 40 year old female with typical chest pain for one year,
# She has progressive angina but no nocturnal angina.
# Angina pain lasted at most five times a week.
# She has peripheral vascular and cerebrovascular disease.
# She has hypertension but has no dyslipidemia and not diabetic.
# She has Q waves and ST-T changes on ECG.

calculate_dcs_1993_severe_cad_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical",
    have_progressive_angina = "yes",
    have_nocturnal_angina = "no",
    have_peripheral_vascular_disease = "yes",
    have_cerebrovascular_disease = "yes",
    have_carotid_bruits = "no",
    have_hypertension = "yes",
    have_dyslipidemia = "no",
    have_diabetes = "no",
    have_q_waves = "yes",
    have_st_t_changes = "yes",
    frequency_of_angina_pain_per_week = 5,
    duration_of_cad_symptoms_year = 1,
)

Calculate 1993 Duke Clinical Score for Significant CAD

Description

This function returns a patient's pre-test probability (PTP) of significant (>75% luminal diameter narrowing of at least one major coronary artery) coronary artery disease based on the 1993 Duke Clinical Score.

Usage

calculate_dcs_1993_sig_cad_ptp(
  age,
  sex,
  chest_pain_type,
  have_mi,
  have_smoking_history,
  have_dyslipidemia,
  have_diabetes,
  have_q_waves,
  have_st_t_changes
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_mi

Input characters (no, yes) to indicate if the patient has a previous history of Myocardial Infarction (MI).

  • no stands for the patient not having a previous history of MI.

  • yes stands for the patient a previous history of MI.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_q_waves

Input characters (no, yes) to indicate if the patient has Q waves on electrocardiogram (ECG).

  • no stands for the patient not having Q waves on ECG.

  • yes stands for the patient having Q waves on ECG.

have_st_t_changes

Input characters (no, yes) to indicate if the patient has ST-T changes on electrocardiogram (ECG).

  • no stands for the patient not having ST-T changes on ECG.

  • yes stands for the patient having ST-T changes on ECG.

Details

The predictive model is based on patients referred for cardiac catheterisation between 1969 and 1983.

Value

A numeric value representing the patient's PTP for significant (>75% luminal diameter narrowing of at least one major coronary artery) CAD based on the 1993 Duke Clinical Score.

Examples

# 40 year old female with typical chest pain,
# previous history of MI,
# has diabetes but no dyslipidemia and a non-smoker.
# She has Q waves but no ST-T changes on ECG.

calculate_dcs_1993_sig_cad_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical",
    have_mi = "yes",
    have_smoking_history = "no",
    have_dyslipidemia = "no",
    have_diabetes = "yes",
    have_q_waves = "yes",
    have_st_t_changes = "no"
)

Calculate The Vascular Disease Index For Duke Clinical Score 1993

Description

A function used to calculate the patient's vascular disease index. This is used to calculate the likelihood of severe coronary artery disease in the Duke Clinical Score 1993 paper.

Usage

calculate_dcs_1993_vascular_disease_index(
  have_peripheral_vascular_disease,
  have_cerebrovascular_disease,
  have_carotid_bruits,
  max_na = 0
)

Arguments

have_peripheral_vascular_disease

Input characters (no, yes) to indicate if the patient has peripheral vascular disease.

  • no stands for not having peripheral vascular disease.

  • yes stands for having peripheral vascular disease.

have_cerebrovascular_disease

Input characters (no, yes) to indicate if the patient has cerebrovascular disease.

  • no stands for not having cerebrovascular disease.

  • yes stands for having cerebrovascular disease.

have_carotid_bruits

Input characters (no, yes) to indicate if the patient has carotid bruits.

  • no stands for not having carotid bruits.

  • yes stands for having carotid bruits.

max_na

Input integer 0 to 3 to indicate the maximum number of missing disease history to tolerate before outputting an NA. Default: 0

Value

An integer indicating the patient's vascular disease index. It can also be NA if the number of missing disease history exceeds the max_na input value.

Examples

calculate_dcs_1993_vascular_disease_index(
  have_peripheral_vascular_disease = "yes",
  have_cerebrovascular_disease = "yes",
  have_carotid_bruits = "no"
)

calculate_dcs_1993_vascular_disease_index(
  have_peripheral_vascular_disease = NA,
  have_cerebrovascular_disease = "yes",
  have_carotid_bruits = "no",
  max_na = 0
)

calculate_dcs_1993_vascular_disease_index(
  have_peripheral_vascular_disease = NA,
  have_cerebrovascular_disease = "yes",
  have_carotid_bruits = "no",
  max_na = 1
)

Calculate Diamond-Forrester 1979 PTP for obstructive CAD

Description

This function returns a patient's pre-test Probability (PTP) of obstructive coronary artery disease (CAD) based on Diamond-Forrester 1979 model.

Usage

calculate_diamond_forrester_1979_ptp(
  age,
  sex,
  chest_pain_type,
  output = c("numeric", "percentage")
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

output

Input text to indicate the how pre-test probability results be expressed Default: c("numeric", "percentage")

  • numeric means the PTP will be expressed as an integer probability (0-100).

  • percentage means the PTP will be expressed as percentage text (0-100%).

Value

A numeric or percentage representing the patient's PTP for obstructive CAD based on Diamond-Forrester 1979 model.

Examples

# 35 year old female with typical chest pain
calculate_diamond_forrester_1979_ptp(
    age = 35,
    sex = "female",
    chest_pain_type = "typical",
    output = "percentage"
)

# 65 year old male with nonanginal chest pain
calculate_diamond_forrester_1979_ptp(
    age = 65,
    sex = "male",
    chest_pain_type = "nonanginal",
    output = "percentage"
)

Calculate ESC 2013 PTP for obstructive CAD

Description

This function returns a patient's pre-test Probability (PTP) of obstructive coronary artery disease (CAD) based on the European Society of Cardiology (ESC) 2013 guidelines.

Usage

calculate_esc_2013_ptp(
  age,
  sex,
  chest_pain_type,
  output = c("numeric", "percentage")
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

output

Input text to indicate the how pre-test probability results be expressed Default: c("numeric", "percentage")

  • numeric means the PTP will be expressed as an integer probability (0-100).

  • percentage means the PTP will be expressed as percentage text (0-100%).

Details

The predictive model used to create the guidelines are based on the journal A clinical prediction rule for the diagnosis of coronary artery disease: validation, updating, and extension by 2011 Genders et. al.

Value

An integer or percentage representing the patient's PTP for obstructive CAD based on the ESC 2013 guidelines.

Examples

# 35 year old female with typical chest pain
calculate_esc_2013_ptp(
    age = 35,
    sex = "female",
    chest_pain_type = "typical",
    output = "percentage"
)

# 65 year old male with nonanginal chest pain
calculate_esc_2013_ptp(
    age = 65,
    sex = "male",
    chest_pain_type = "nonanginal",
    output = "percentage"
)

Calculate ESC 2019 PTP for obstructive CAD

Description

This function returns a patient's pre-test Probability (PTP) of obstructive coronary artery disease (CAD) based on the European Society of Cardiology (ESC) 2019 guidelines.

Usage

calculate_esc_2019_ptp(
  age,
  sex,
  have_dyspnoea,
  chest_pain_type,
  output = c("grouping", "numeric", "percentage")
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

have_dyspnoea

Input characters (no, yes) to indicate if the patient only has dyspnoea symptoms.

  • no stands for not having dyspnoea symptoms.

  • yes stands for having dyspnoea symptoms.

chest_pain_type

Input characters (no chest pain, typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • no chest pain stands for the patient having no chest pain.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

output

Input text to indicate the how pre-test probability results be expressed Default: c("grouping", "numeric", "percentage")

  • grouping means the PTP will be expressed as Low, Intermediate and High.

    • low if PTP is less than 5%.

    • intermediate if PTP is in between 5% to 15%.

    • high if PTP is more than 15%.

  • numeric means the PTP will be expressed as an integer probability (0-100).

  • percentage means the PTP will be expressed as percentage text (0-100%).

Details

The predictive model used to create the guidelines are based on patients from European countries with low cardiovascular disease (CVD) risk.

If the patient has both dyspnoea and a particular chest pain type (typical, atypical, nonanginal), The chest pain type will take precedence over dyspnoea.

Value

An integer, percentage or category representing the patient's PTP for obstructive CAD based on the ESC 2019 guidelines. See parameter option output for more information.

Examples

# 35 year old female with typical chest pain
calculate_esc_2019_ptp(
    age = 35,
    sex = "female",
    have_dyspnoea = "no",
    chest_pain_type = "typical",
    output = "percentage"
)

# 75 year old male with only dyspnoea
calculate_esc_2019_ptp(
    age = 75,
    sex = "male",
    have_dyspnoea = "yes",
    chest_pain_type = "no chest pain",
    output = "percentage"
)

Calculate ESC 2024 PTP for obstructive CAD

Description

This function returns a patient's pre-test Probability (PTP) of obstructive coronary artery disease (CAD) based on the European Society of Cardiology (ESC) 2024 guidelines.

Usage

calculate_esc_2024_fig_4_ptp(
  age,
  sex,
  chest_pain_type,
  have_dyspnoea,
  have_family_history,
  have_smoking_history,
  have_dyslipidemia,
  have_hypertension,
  have_diabetes,
  allow_na_symptom_score = TRUE,
  max_na_num_of_rf = 0,
  output = c("grouping", "numeric", "percentage")
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (no chest pain, typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • no chest pain stands for the patient having no chest pain.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_dyspnoea

Input characters (no, yes) to indicate if the patient only has dyspnoea symptoms.

  • no stands for not having dyspnoea symptoms.

  • yes stands for having dyspnoea symptoms.

have_family_history

Input characters (no, yes) to indicate if the patient has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

allow_na_symptom_score

A logical evaluating to TRUE or FALSE indicating whether we can allow chest_pain_type or have_dyspnoea to be NA when calculating the score

max_na_num_of_rf

Input integer 0 to 5 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

output

Input text to indicate the how pre-test probability results be expressed Default: c("grouping", "numeric", "percentage")

  • grouping means the PTP will be expressed as Low, Intermediate and High.

    • very low if PTP is less than or equal to 5%.

    • low if PTP is in between 6% to 15%.

    • moderate if PTP is more than 15%.

  • numeric means the PTP will be expressed as an integer probability (0-100).

  • percentage means the PTP will be expressed as percentage text (0-100%).

Value

An integer, percentage or category representing the patient's PTP for obstructive CAD based on the ESC 2024 guidelines. See parameter option output for more information.

Examples

# 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",
  allow_na_symptom_score = TRUE,
  max_na_num_of_rf = 0,
  output = "percentage"
)


Calculate ESC 2024 PTP for obstructive CAD

Description

This function returns a patient's pre-test Probability (PTP) of obstructive coronary artery disease (CAD) based on the European Society of Cardiology (ESC) 2024 guidelines.

Usage

calculate_esc_2024_fig_4_ptp_simplfied(
  age,
  sex,
  symptom_score,
  num_of_rf,
  output = c("grouping", "numeric", "percentage")
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

symptom_score

An integer indicating the symptom score of the patient. This value can be calculated via the calculate_esc_2024_symptom_score

num_of_rf

An integer indicating the number of risk factors the patient has. This value can be calculated via the calculate_esc_2024_num_of_rf Risk factors are:

  • having a family history of CAD.

  • having a smoking history (current and past smoker).

  • having dyslipidemia.

  • having hypertension.

  • having diabetes.

output

Input text to indicate the how pre-test probability results be expressed Default: c("grouping", "numeric", "percentage")

  • grouping means the PTP will be expressed as Low, Intermediate and High.

    • very low if PTP is less than or equal to 5%.

    • low if PTP is in between 6% to 15%.

    • moderate if PTP is more than 15%.

  • numeric means the PTP will be expressed as an integer probability (0-100).

  • percentage means the PTP will be expressed as percentage text (0-100%).

Value

An integer, percentage or category representing the patient's PTP for obstructive CAD based on the ESC 2024 guidelines. See parameter option output for more information.

Examples

# 30 female with symptom score of 0 and 0 risk factors
calculate_esc_2024_fig_4_ptp_simplfied(
  age = 30,
  sex = "female",
  symptom_score = 0,
  num_of_rf = 0,
  output = "percentage"
)


Calculate Number Of Risk Factors (ESC 2024)

Description

A function used to calculate the number of risk factors the patient has. This is used to calculate the pretest probability of coronary artery disease (CAD) based on the ESC 2024 guidelines.

Usage

calculate_esc_2024_num_of_rf(
  have_family_history,
  have_smoking_history,
  have_dyslipidemia,
  have_hypertension,
  have_diabetes,
  max_na = 0
)

Arguments

have_family_history

Input characters (no, yes) to indicate if the patient has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

max_na

Input integer 0 to 5 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

Value

An integer indicating the number of risk factors the patient has. It can also be NA if the number of missing risk factors exceeds the max_na input value.

Examples

calculate_esc_2024_num_of_rf(
  have_family_history = "yes",
  have_smoking_history = "yes",
  have_dyslipidemia = "yes",
  have_hypertension = "yes",
  have_diabetes = "no"
)

calculate_esc_2024_num_of_rf(
  have_family_history = "no",
  have_smoking_history = "no",
  have_dyslipidemia = "no",
  have_hypertension = NA,
  have_diabetes = "no",
  max_na = 0
)

calculate_esc_2024_num_of_rf(
  have_family_history = "no",
  have_smoking_history = "no",
  have_dyslipidemia = "no",
  have_hypertension = NA,
  have_diabetes = "no",
  max_na = 1
)

Calculate Symptom Score (ESC 2024)

Description

A function used to calculate the symptom score of the patient. This is used to calculate the pretest probability of coronary artery disease (CAD) based on the ESC 2024 guidelines.

Usage

calculate_esc_2024_symptom_score(
  chest_pain_type,
  have_dyspnoea,
  allow_na = TRUE
)

Arguments

chest_pain_type

Input characters (no chest pain, typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • no chest pain stands for the patient having no chest pain.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_dyspnoea

Input characters (no, yes) to indicate if the patient only has dyspnoea symptoms.

  • no stands for not having dyspnoea symptoms.

  • yes stands for having dyspnoea symptoms.

allow_na

A logical evaluating to TRUE or FALSE indicating whether we can allow 'chest_pain_type' or 'have_dyspnoea' to be NA when calculating the score. Default: TRUE

Value

An integer indicating the symptom score of the patient. It can also be NA if both chest_pain_type and have_dyspnoea are NA. Patients with both nonanginal chest pain and dyspnoea will be given a score of 2

Examples

calculate_esc_2024_symptom_score(
  chest_pain_type = "nonanginal",
  have_dyspnoea = "yes",
  allow_na = TRUE
)

calculate_esc_2024_symptom_score(
  chest_pain_type = "nonanginal",
  have_dyspnoea = NA,
  allow_na = FALSE
)

calculate_esc_2024_symptom_score(
  chest_pain_type = "nonanginal",
  have_dyspnoea = NA,
  allow_na = TRUE
)


Calculate 2022 LAH Clinical PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2022 Local Assessment of the Heart (LAH) clinical model.

Usage

calculate_lah_2022_clinical_ptp(
  age,
  sex,
  chest_pain_type,
  have_diabetes,
  have_hypertension,
  have_dyslipidemia,
  have_smoking_history
)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

Details

The predictive model is based on patients a mixed Asian cohort within Singapore with stable chest pain.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2022 Local Assessment of the Heart (LAH) clinical model.

Examples

# 40 year old female with typical chest pain,
# diabetes but no hypertension, dyslipidemia
# and a non-smoker
calculate_lah_2022_clinical_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical",
    have_diabetes = "yes",
    have_hypertension = "no",
    have_dyslipidemia = "no",
    have_smoking_history = "no"

)

Calculate 2022 LAH Extended PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2022 Local Assessment of the Heart (LAH) extended model.

Usage

calculate_lah_2022_extended_ptp(
  age,
  sex,
  chest_pain_type,
  have_diabetes,
  have_hypertension,
  have_dyslipidemia,
  have_smoking_history,
  coronary_calcium_score
)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

coronary_calcium_score

Input non-negative numeric to indicate the total coronary calcium score of the patient.

Details

The predictive model is based on patients a mixed Asian cohort within Singapore with stable chest pain.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2022 Local Assessment of the Heart (LAH) extended model.

Examples

# 40 year old female with typical chest pain,
# diabetes but no hypertension, dyslipidemia,
# a non-smoker and a coronary calcium score of 0
calculate_lah_2022_extended_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical",
    have_diabetes = "yes",
    have_hypertension = "no",
    have_dyslipidemia = "no",
    have_smoking_history = "no",
    coronary_calcium_score = 0

)

Calculate 2021 PRECISE Clinical PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2021 Predictive Risk scorE for CAD In Southeast Asians with chEst pain (PRECISE) clinical model.

Usage

calculate_precise_2021_clinical_ptp(
  age,
  sex,
  chest_pain_type,
  have_neck_radiation,
  have_diabetes,
  have_hypertension,
  smoking_history_type,
  have_q_waves,
  have_st_t_changes
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_neck_radiation

Input characters (no, yes) to indicate if the patient has chest pain radiating to the neck.

  • no stands for not chest pain radiating to the neck.

  • yes stands for having chest pain radiating to the neck.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

smoking_history_type

Input characters (current, past, none) to indicate the smoking history of the patient.

  • current stands for being a current smoker.

  • past stands for being a past smoker.

  • none stands for not having a smoking history (non-smoker).

have_q_waves

Input characters (no, yes) to indicate if the patient has Q waves on electrocardiogram (ECG).

  • no stands for the patient not having Q waves on ECG.

  • yes stands for the patient having Q waves on ECG.

have_st_t_changes

Input characters (no, yes) to indicate if the patient has ST-T changes on electrocardiogram (ECG).

  • no stands for the patient not having ST-T changes on ECG.

  • yes stands for the patient having ST-T changes on ECG.

Details

The predictive model is based on patients a mixed Asian cohort within Singapore with stable chest pain.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2021 Predictive Risk scorE for CAD In Southeast Asians with chEst pain (PRECISE) clinical model.

Examples

# 40 year old female with typical chest pain
# radiating to the neck, has diabetes
# but no hypertension and a non-smoker.
# She has Q waves but no ST-T changes on ECG.

calculate_precise_2021_clinical_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical",
    have_neck_radiation = "yes",
    have_diabetes = "yes",
    have_hypertension = "no",
    smoking_history_type = "none",
    have_q_waves = "yes",
    have_st_t_changes = "no"
)

Calculate 2021 PRECISE Simple PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2021 Predictive Risk scorE for CAD In Southeast Asians with chEst pain (PRECISE) simple model.

Usage

calculate_precise_2021_simple_ptp(
  age,
  sex,
  chest_pain_type,
  have_neck_radiation,
  have_diabetes,
  have_hypertension,
  smoking_history_type
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_neck_radiation

Input characters (no, yes) to indicate if the patient has chest pain radiating to the neck.

  • no stands for not chest pain radiating to the neck.

  • yes stands for having chest pain radiating to the neck.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

smoking_history_type

Input characters (current, past, none) to indicate the smoking history of the patient.

  • current stands for being a current smoker.

  • past stands for being a past smoker.

  • none stands for not having a smoking history (non-smoker).

Details

The predictive model is based on patients a mixed Asian cohort within Singapore with stable chest pain.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2021 Predictive Risk scorE for CAD In Southeast Asians with chEst pain (PRECISE) simple model.

Examples

# 40 year old female with typical chest pain
# radiating to the neck, has diabetes
# but no hypertension and a non-smoker

calculate_precise_2021_simple_ptp(
    age = 40,
    sex = "female",
    chest_pain_type = "typical",
    have_neck_radiation = "yes",
    have_diabetes = "yes",
    have_hypertension = "no",
    smoking_history_type = "none"

)

Calculate 2017 PROMISE Minimal-Risk Score for obstructive CAD

Description

This function returns a symptomatic (have chest pain or dyspnoea) patient's minimal risk score for obstructive coronary artery disease based on the 2017 PROMISE Minimal-Risk Score.

Usage

calculate_prms_2017_ptp(
  age,
  sex,
  hdl_mg_dl,
  is_minority_ethnicity,
  have_diabetes,
  have_hypertension,
  have_dyslipidemia,
  have_smoking_history,
  have_family_history,
  have_stress_symptoms = NA
)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

hdl_mg_dl

Input positive numeric value to indicate the patient's high-density lipoprotein (HDL) in mg/dL.

is_minority_ethnicity

Input characters (no, yes) to indicate if the patient is from a racial or minority ethnicity (or patient is not a non-Hispanic/Latino White).

  • no stands for patient is a non-Hispanic/Latino White.

  • yes stands for patient is not a non-Hispanic/Latino White. E.g. Blacks, Asians, etc.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

have_family_history

Input characters (no, yes) to indicate if the patient has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

have_stress_symptoms

Input characters (no, yes) to indicate if the patient has symptoms related to physical or mental stress. It can be set to NA if the patient results are inconclusive or have not taken any stress test such as exercise treadmill testing, stress echocardiography, or stress nuclear imaging.

  • no stands for no symptoms (negative results) related to physical or mental stress.

  • yes stands for having symptoms (positive results) related to physical or mental stress.

  • NA stands for inconclusive results or patient has not taken any stress test

Default: NA

Details

The predictive model is based on CCTA images from 4632 patients in the Prospective Multicenter imaging Study for Evaluation of Chest Pain (PROMISE) trial.

Value

A numeric value representing the patient's minimal risk score for obstructive CAD based on the 2017 PROMISE Minimal-Risk Score.

Examples

# 50 year old white female with chest pain
# a medical history of hypertension, and a
# high-density lipoprotein cholesterol level of 70 mg/dL
calculate_prms_2017_ptp(
    age = 50,
    sex = "female",
    hdl_mg_dl = 70,
    is_minority_ethnicity = "no",
    have_diabetes = "no",
    have_hypertension = "yes",
    have_dyslipidemia = "no",
    have_smoking_history = "no",
    have_family_history = "no",
    have_stress_symptoms = "no"
)

# 40 year old non-white male with chest pain
# a medical history of diabetes, unknown stress symptoms and a
# high-density lipoprotein cholesterol level of 70 mg/dL
calculate_prms_2017_ptp(
    age = 40,
    sex = "male",
    hdl_mg_dl = 70,
    is_minority_ethnicity = "yes",
    have_diabetes = "yes",
    have_hypertension = "no",
    have_dyslipidemia = "no",
    have_smoking_history = "no",
    have_family_history = "no",
    have_stress_symptoms = NA
)

Calculate 2019 Reeh Basic PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2019 Reeh et. al. basic model.

Usage

calculate_reeh_2019_basic_ptp(age, sex, symptom_type)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

symptom_type

Input characters (typical, atypical, nonanginal, dyspnoea) to indicate the symptom characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

  • dyspnoea stands for the patient having dyspnoea.

Details

The predictive model is based on 3903 patients free of CAD and heart failure and suspected of angina, who were referred to a single, large, urban university hospital for assessment in 2012–15.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2019 Reeh et. al. basic model.

Examples

# 40 year old female with typical chest pain
calculate_reeh_2019_basic_ptp(
    age = 40,
    sex = "female",
    symptom_type = "typical"
)

Calculate 2019 Reeh Clinical PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2019 Reeh et. al. clinical model.

Usage

calculate_reeh_2019_clinical_ptp(
  age,
  sex,
  symptom_type,
  have_dyslipidemia,
  have_family_history,
  have_diabetes
)

Arguments

age

Input integer value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

symptom_type

Input characters (typical, atypical, nonanginal, dyspnoea) to indicate the symptom characteristics of the patient.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

  • dyspnoea stands for the patient having dyspnoea.

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_family_history

Input characters (no, yes) to indicate if the patient has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

Details

The predictive model is based on 3903 patients free of CAD and heart failure and suspected of angina, who were referred to a single, large, urban university hospital for assessment in 2012–15.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2019 Reeh et. al. clinical model.

Examples

# 40 year old female with typical chest pain
calculate_reeh_2019_clinical_ptp(
    age = 40,
    sex = "female",
    symptom_type = "typical",
    have_dyslipidemia = "no",
    have_family_history = "no",
    have_diabetes = "no"
)

Calculate 2020 Winther Basic PTP for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2020 Winther et. al. basic model (Basic_PTP).

Usage

calculate_winther_2020_basic_ptp(age, sex, chest_pain_type)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (no chest pain, typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • no chest pain stands for the patient having no chest pain.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

Details

The predictive model is based on > 40000 symptomatic patients from 2008 to 2017 from 13 hospitals in Western Denmark. These patients are registered under the Western Denmark Heart Registry.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2020 Winther et. al. basic model (Basic_PTP).

Examples

# 40 year old Male with typical chest pain
calculate_winther_2020_basic_ptp(
    age = 40,
    sex = "male",
    chest_pain_type = "typical"
)

# 40 year old Male with nonanginal chest pain
calculate_winther_2020_basic_ptp(
    age = 40,
    sex = "male",
    chest_pain_type = "nonanginal"
)

Calculate 2020 Winther CACS-CL PTP model for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on 2020 Winther et. al. Coronary Artery Calcium Score-Weighted Clinical Likelihood (CACS-CL) model.

Usage

calculate_winther_2020_cacs_cl_ptp(
  age,
  sex,
  chest_pain_type,
  have_dyspnoea,
  have_family_history,
  have_smoking_history,
  have_dyslipidemia,
  have_hypertension,
  have_diabetes,
  coronary_calcium_score,
  allow_na_symptom_score = TRUE,
  max_na_num_of_rf = 0
)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (no chest pain, typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • no chest pain stands for the patient having no chest pain.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_dyspnoea

Input characters (no, yes) to indicate if the patient only has dyspnoea symptoms.

  • no stands for not having dyspnoea symptoms.

  • yes stands for having dyspnoea symptoms.

have_family_history

Input characters (no, yes) to indicate if the patient has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

coronary_calcium_score

Input non-negative numeric to indicate the total coronary calcium score of the patient.

allow_na_symptom_score

A logical evaluating to TRUE or FALSE indicating whether we can allow chest_pain_type or have_dyspnoea to be NA when calculating the score

max_na_num_of_rf

Input integer 0 to 5 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

Details

The predictive model is based on > 40000 symptomatic patients from 2008 to 2017 from 13 hospitals in Western Denmark. These patients are registered under the Western Denmark Heart Registry.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2020 Winther et. al. Coronary Artery Calcium Score-Weighted Clinical Likelihood (CACS-CL) model.

Examples

# 40 year old Male with nonanginal chest pain and coronary calcium score of 0
calculate_winther_2020_cacs_cl_ptp(
    age = 40,
    sex = "male",
    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",
    coronary_calcium_score = 0,
    allow_na_symptom_score = TRUE,
    max_na_num_of_rf = 0
)

Calculate 2020 Winther RF-CL PTP model for obstructive CAD

Description

This function returns a patient's pre-test probability (PTP) of obstructive coronary artery disease based on the 2020 Winther et. al. Risk Factor-Weighted Clinical Likelihood (RF-CL) model.

Usage

calculate_winther_2020_rf_cl_ptp(
  age,
  sex,
  chest_pain_type,
  have_dyspnoea,
  have_family_history,
  have_smoking_history,
  have_dyslipidemia,
  have_hypertension,
  have_diabetes,
  allow_na_symptom_score = TRUE,
  max_na_num_of_rf = 0
)

Arguments

age

Input numeric value to indicate the age of the patient.

sex

Input characters (female, male) to indicate the sex of the patient.

  • female

  • male

chest_pain_type

Input characters (no chest pain, typical, atypical, nonanginal) to indicate the chest pain characteristics of the patient.

  • no chest pain stands for the patient having no chest pain.

  • typical stands for the patient having typical chest pain.

  • atypical stands for the patient having atypical chest pain.

  • nonanginal stands for the patient having nonanginal or non-specific chest pain.

have_dyspnoea

Input characters (no, yes) to indicate if the patient only has dyspnoea symptoms.

  • no stands for not having dyspnoea symptoms.

  • yes stands for having dyspnoea symptoms.

have_family_history

Input characters (no, yes) to indicate if the patient has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

have_smoking_history

Input characters (no, yes) to indicate if the patient has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

have_dyslipidemia

Input characters (no, yes) to indicate if the patient has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having dyslipidemia.

have_hypertension

Input characters (no, yes) to indicate if the patient has hypertension.

  • no stands for not having hypertension.

  • yes stands for having hypertension.

have_diabetes

Input characters (no, yes) to indicate if the patient has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

allow_na_symptom_score

A logical evaluating to TRUE or FALSE indicating whether we can allow chest_pain_type or have_dyspnoea to be NA when calculating the score

max_na_num_of_rf

Input integer 0 to 5 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

Details

The predictive model is based on > 40000 symptomatic patients from 2008 to 2017 from 13 hospitals in Western Denmark. These patients are registered under the Western Denmark Heart Registry.

Value

A numeric value representing the patient's PTP for obstructive CAD based on the 2020 Winther et. al. Risk Factor-Weighted Clinical Likelihood (RF-CL) model.

Examples

# 40 year old Male with nonanginal chest pain
calculate_winther_2020_rf_cl_ptp(
    age = 40,
    sex = "male",
    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",
    allow_na_symptom_score = TRUE,
    max_na_num_of_rf = 0
)

Check If Non-negative

Description

Check if the input variable is a non-negative number

Check if the input variable is an integer

Usage

check_if_non_negative(
  x,
  allow_na = TRUE,
  arg = rlang::caller_arg(x),
  call = rlang::caller_env()
)

check_if_integer(
  x,
  allow_na = TRUE,
  arg = rlang::caller_arg(x),
  call = rlang::caller_env()
)

Arguments

x

Input variable to check if it is an integer

allow_na

Input boolean to determine if NA or NaN is allowed. Default: TRUE

arg

An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

The variable itself or an error message if variable is not non-negative

The variable itself or an error message if variable is not non-negative

See Also

caller_arg, stack cli_abort

caller_arg, stack cli_abort


Check If Numeric

Description

Check if the input variable is numeric

Usage

check_if_numeric(
  x,
  allow_na = TRUE,
  arg = rlang::caller_arg(x),
  call = rlang::caller_env()
)

Arguments

x

Input variable to check if it is numeric

allow_na

Input boolean to determine if NA or NaN is allowed. Default: TRUE

arg

An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

The variable itself or an error message if variable is not numeric

See Also

caller_arg, stack cli_abort


Check If Positive

Description

Check if the input variable is a positive number

Usage

check_if_positive(
  x,
  allow_na = TRUE,
  arg = rlang::caller_arg(x),
  call = rlang::caller_env()
)

Arguments

x

Input variable to check if it is positive number

allow_na

Input boolean to determine if NA or NaN is allowed. Default: TRUE

arg

An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

The variable itself or an error message if variable is not positive

See Also

caller_arg, stack cli_abort


Is Integer Value

Description

Function to check if the input value is an integer.

Usage

is_integer_value(input_value, allow_na = FALSE)

Arguments

input_value

The input value

allow_na

If true, NA values are ignored and output is considered TRUE. Default: FALSE

Value

A boolean indicating TRUE when the input value is an integer and FALSE otherwise.

Examples


# An integer
is_integer_value(1)

# Not an integer
is_integer_value(1.1)

# Not numeric
is_integer_value("1")

# NA cases
is_integer_value(NA, allow_na = FALSE)
is_integer_value(NA, allow_na = TRUE)


Round To Nearest Digit

Description

A function that does symmetric rounding to the nearest digits.

Usage

round_to_nearest_digit(number, digits = 0)

Arguments

number

Input numeric value

digits

Input integer indicating the number of decimal places to be used. By default, it rounds off to the nearest integer. Default: 0

Value

A numeric value rounded off to a number of decimal places specified in the input digits.

Examples

round_to_nearest_digit(0.5)
round_to_nearest_digit(1.5)
round_to_nearest_digit(-0.5)
round_to_nearest_digit(-1.5)
round_to_nearest_digit(1021.125, digits = 2)