| Title: | The Acute COPD Exacerbation Prediction Tool (ACCEPT) |
|---|---|
| Description: | Allows clinicians to predict the rate and severity of future acute exacerbation in Chronic Obstructive Pulmonary Disease (COPD) patients, based on the clinical prediction models published in Adibi et al. (2020) <doi:10.1016/S2213-2600(19)30397-2> and Safari et al. (2022) <doi:10.1016/j.eclinm.2022.101574>. |
| Authors: | Amin Adibi [aut, cre], Mohsen Sadatsafavi [aut, cph], Abdollah Safari [aut], Ainsleigh Hill [aut] |
| Maintainer: | Amin Adibi <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.1 |
| Built: | 2026-06-02 09:10:36 UTC |
| Source: | https://github.com/resplab/accept |
A flexible version of ACCEPT 2.0 model, which imputes predictors using MICE approach.
accept( newdata, format = "tibble", version = "accept3", prediction_interval = FALSE, return_predictors = FALSE, country = NULL, obs_modsev_risk = NULL, ... )accept( newdata, format = "tibble", version = "accept3", prediction_interval = FALSE, return_predictors = FALSE, country = NULL, obs_modsev_risk = NULL, ... )
newdata |
new patient data with missing values to be imputed before prediction with the same format as accept samplePatients. |
format |
default is "tibble". Can also be set to "json". |
version |
indicates which version of ACCEPT needs to be called. Options include "accept1", "accept2", "accept3" (default). |
prediction_interval |
default is FALSE. If set to TRUE, returns prediction intervals of the predictions. |
return_predictors |
default is FALSE. IF set to TRUE, returns the predictors along with prediction results. |
country |
Required for accept3 version. Three-letter ISO country code (e.g., "CAN", "USA", "GBR"). Supported countries: ARG, AUS, BRA, CAN, COL, DEU, DNK, ESP, FRA, GBR, ITA, JPN, KOR, MEX, NLD, NOR, SWE, USA. For unsupported countries, provide obs_modsev_risk parameter or add it as a column in the data. |
obs_modsev_risk |
Observed moderate-to-severe exacerbation risk for unsupported countries. Can be provided as a parameter or as a column in newdata. |
... |
for other versions of accept. |
patientData with prediction.
results <- accept(newdata = samplePatients, country = "CAN") results_us <- accept(newdata = samplePatients, country = "USA") # For unsupported country with obs_modsev_risk parameter results_custom <- accept(newdata = samplePatients, country = "XXX", obs_modsev_risk = 0.2)results <- accept(newdata = samplePatients, country = "CAN") results_us <- accept(newdata = samplePatients, country = "USA") # For unsupported country with obs_modsev_risk parameter results_custom <- accept(newdata = samplePatients, country = "XXX", obs_modsev_risk = 0.2)
Predicts COPD exacerbation rate by severity level based on Acute COPD Exacerbation Tool (ACCEPT)
accept1( patientData, random_sampling_N = 100, lastYrExacCol = "LastYrExacCount", lastYrSevExacCol = "LastYrSevExacCount", ... )accept1( patientData, random_sampling_N = 100, lastYrExacCol = "LastYrExacCount", lastYrSevExacCol = "LastYrSevExacCount", ... )
patientData |
patient data matrix. Can have one or many patients in it |
random_sampling_N |
number of random sampling. Default is 100. |
lastYrExacCol |
the column specifying last year all exacerbation count |
lastYrSevExacCol |
the column specifying last year severe exacerbation count |
... |
for backward compatibility |
patientData with prediction
results <- accept1(samplePatients)results <- accept1(samplePatients)
Predicts COPD exacerbation rate by severity level based on the updated accept2 model, which improves accuracy in patients without an exacerbation history.
accept2( patientData, random_sampling_N = 100, lastYrExacCol = "LastYrExacCount", lastYrSevExacCol = "LastYrSevExacCount", KeepSGRQ = TRUE, KeepMeds = TRUE, ... )accept2( patientData, random_sampling_N = 100, lastYrExacCol = "LastYrExacCount", lastYrSevExacCol = "LastYrSevExacCount", KeepSGRQ = TRUE, KeepMeds = TRUE, ... )
patientData |
patient data matrix. Can have one or many patients in it |
random_sampling_N |
number of random sampling. Default is 100. |
lastYrExacCol |
the column specifying last year all exacerbation count |
lastYrSevExacCol |
the column specifying last year severe exacerbation count |
KeepSGRQ |
default is TRUE. If set to false, the reduced model without SGRQ will be used. |
KeepMeds |
default is TRUE. If set to false, the reduced model without medication predictors will be used. |
... |
for backward compatibility |
patientData with prediction
results <- accept2(samplePatients)results <- accept2(samplePatients)
This function provides country-specific exacerbation risk predictions by applying recalibration adjustments to the ACCEPT 2.0 model. It accounts for differences in healthcare systems, diagnostic practices, and baseline risk across 18 countries.
accept3( country, ID, age, male, BMI, smoker, mMRC = NA, CVD, ICS, LABA, LAMA, LastYrExacCount, LastYrSevExacCount, FEV1, SGRQ = NA, oxygen, obs_modsev_risk )accept3( country, ID, age, male, BMI, smoker, mMRC = NA, CVD, ICS, LABA, LAMA, LastYrExacCount, LastYrSevExacCount, FEV1, SGRQ = NA, oxygen, obs_modsev_risk )
country |
Three-letter ISO country code (e.g., "CAN", "USA", "GBR"). Supported countries: ARG, AUS, BRA, CAN, COL, DEU, DNK, ESP, FRA, GBR, ITA, JPN, KOR, MEX, NLD, NOR, SWE, USA. For unsupported countries, observed moderate-to-severe risk is used for recalibration. |
ID |
A unique character string identifying the patient |
age |
Patient's age (40-90 years) |
male |
Whether the patient is male (TRUE/FALSE) |
BMI |
Body mass index (10-60) |
smoker |
Whether the patient is currently a smoker (TRUE/FALSE) |
mMRC |
Modified Medical Research Council dyspnea scale (0-4) |
CVD |
Whether the patient has cardiovascular disease (TRUE/FALSE) |
ICS |
Whether the patient is on inhaled corticosteroids (TRUE/FALSE) |
LABA |
Whether the patient is on long acting beta agonist (TRUE/FALSE) |
LAMA |
Whether the patient is on long acting muscarinic antagonist (TRUE/FALSE) |
LastYrExacCount |
Total number of exacerbations in the previous year |
LastYrSevExacCount |
Number of severe exacerbations in the previous year |
FEV1 |
Forced expiratory volume in 1 second in percent predicted (10-120) |
SGRQ |
St. George's Respiratory Questionnaire score (0-100). Either this or mMRC should be provided. |
oxygen |
Whether the patient has had supplemental oxygen therapy within the past year (TRUE/FALSE) |
obs_modsev_risk |
Observed moderate-to-severe exacerbation risk in the local population. Only used for countries not in the supported list. If NA, country-specific intercept is used. |
ACCEPT 3.0 builds upon ACCEPT 2.0 by adding country-specific recalibration to improve prediction accuracy across diverse healthcare settings. The model uses empirically-derived country-specific intercepts for 18 countries. For other countries, users can provide observed local risk data for recalibration.
The recalibration applies transformation slopes of 0.9162 for moderate-to-severe exacerbations and 0.9626 for severe exacerbations.
Returns a list containing:
ID: Patient identifier
predicted_exac_probability: Recalibrated probability of moderate-to-severe exacerbation
predicted_severe_exac_probability: Recalibrated probability of severe exacerbation
When called through accept() with version="accept3", returns a tibble that also includes:
predicted_exac_rate: Recalibrated rate of moderate-to-severe exacerbation (calculated as -log(1-p))
predicted_severe_exac_rate: Recalibrated rate of severe exacerbation (calculated as -log(1-p))
# Single patient prediction for Canada result <- accept3( country = "CAN", ID = "P001", age = 65, male = TRUE, BMI = 25, smoker = FALSE, mMRC = 2, CVD = TRUE, ICS = TRUE, LABA = TRUE, LAMA = TRUE, LastYrExacCount = 1, LastYrSevExacCount = 0, FEV1 = 45, oxygen = FALSE, obs_modsev_risk = NA ) # For unsupported country with local risk data result <- accept3( country = "CHN", ID = "P002", age = 70, male = FALSE, BMI = 22, smoker = TRUE, mMRC = 3, CVD = FALSE, ICS = TRUE, LABA = TRUE, LAMA = FALSE, LastYrExacCount = 2, LastYrSevExacCount = 1, FEV1 = 35, oxygen = TRUE, obs_modsev_risk = 0.35 )# Single patient prediction for Canada result <- accept3( country = "CAN", ID = "P001", age = 65, male = TRUE, BMI = 25, smoker = FALSE, mMRC = 2, CVD = TRUE, ICS = TRUE, LABA = TRUE, LAMA = TRUE, LastYrExacCount = 1, LastYrSevExacCount = 0, FEV1 = 45, oxygen = FALSE, obs_modsev_risk = NA ) # For unsupported country with local risk data result <- accept3( country = "CHN", ID = "P002", age = 70, male = FALSE, BMI = 22, smoker = TRUE, mMRC = 3, CVD = FALSE, ICS = TRUE, LABA = TRUE, LAMA = FALSE, LastYrExacCount = 2, LastYrSevExacCount = 1, FEV1 = 35, oxygen = TRUE, obs_modsev_risk = 0.35 )
Useful for supporting accept_model class in vetiver
## S3 method for class 'accept_model' handler_predict(vetiver_model, ...)## S3 method for class 'accept_model' handler_predict(vetiver_model, ...)
vetiver_model |
A deployable [vetiver_model()] object |
... |
any other inputs |
A 'handler_startup' function should return invisibly, while a 'handler_predict' function should return a function with the signature 'function(req)'. The request body ('req$body') consists of the new data at prediction time; this function should return predictions either as a tibble or as a list coercable to a tibble via [tibble::as_tibble()].
Creates bar graph comparing no treatment with azithromycin treatment
plotExacerbations( patientResults, type = "rate", interval = "PI", colors = c("#007bff", "rgb(204,204,204)") )plotExacerbations( patientResults, type = "rate", interval = "PI", colors = c("#007bff", "rgb(204,204,204)") )
patientResults |
patient results vector, produced by accept. |
type |
string: either "probability" or "rate" |
interval |
string: either "CI" or "PI" PI = Predicted Interval CI = Confidence Interval |
colors |
vector: a vector of colors to be used in the graph must be length 2 can use hexadecimal, rgb, or R color codes |
a bar graph
## Not run: results <- accept1(samplePatients[1,]) plotExacerbations(results) ## End(Not run)## Not run: results <- accept1(samplePatients[1,]) plotExacerbations(results) ## End(Not run)
Creates heatmap of number of exacerbations
plotHeatMap(patientResults, n = 10, shortened = TRUE)plotHeatMap(patientResults, n = 10, shortened = TRUE)
patientResults |
patient results vector, produced by accept. |
n |
how many exacerbations to consider |
shortened |
boolean |
a heatmap
## Not run: results <- accept1(samplePatients[1,]) plotHeatMap(results) ## End(Not run)## Not run: results <- accept1(samplePatients[1,]) plotHeatMap(results) ## End(Not run)
Model predictions
## S3 method for class 'accept_model' predict(object, ...)## S3 method for class 'accept_model' predict(object, ...)
object |
a model object |
... |
new data for which the prediction is needed |
prediction results from ACCEPT model
Predicts probability of observing n exacerbations in the next year
predictCountProb(patientResults, n = 10, shortened = TRUE)predictCountProb(patientResults, n = 10, shortened = TRUE)
patientResults |
patient results vector, produced by accept. |
n |
how many exacerbations |
shortened |
boolean: Shortened results groups into 0, 1, 2, and 3 or more exacerbations |
a matrix of probabilities with the number of exacerbations as rows and number of severe exacerbations as columns
results <- accept2(samplePatients[1,]) predictCountProb (results)results <- accept2(samplePatients[1,]) predictCountProb (results)
A dataset containing sample patient characteristics to run the prediction model variables are as follows:
A data frame with 2 rows and 19 variables
ID. A unique character string identifying a patients
male. whether the patient is male
age. the age of the patient (40–90)
smoker. whether the patient is currently a smoker
oxygen. whether the patient has had supplemental oxygen therapy within the past year (0,1)
FEV1. forced expiratory volume in 1 second in percent predicted
BMI. body mass index (10–60)
SGRQ. St. George’s Respiratory Questionnaire score (0–100)
statin. whether the patient is taking statins due to cardiovascular conditions
LAMA. whether the patient is on long acting muscarinic antagonist
LABA. whether the patient is on long acting beta agonist
ICS. whether the patient is on inhaled corticosteroids
LastYrExacCount. total number of exacerbations in the previous year
LastYrSevExacCount. number of severe exacerbations in the previous year
NLP functionalities require a paid OpenAI API key to communicate with Open AI models.
set_openai_api_key(key, overwrite = FALSE, temporary = FALSE)set_openai_api_key(key, overwrite = FALSE, temporary = FALSE)
key |
an OpenAI API key. For more information on keys see the OpenAI API blog |
overwrite |
Option to overwrite any existing OpenAI keys already stored locally. |
temporary |
Option to not store thew API key for use across sessions. |
## Not run: set_openai_api_key("YOUR_OPENAI_API_KEY") # This will set the key permanently until overwritten again set_openai_api_key("YOUR_OPENAI_API_KEY") ## End(Not run)## Not run: set_openai_api_key("YOUR_OPENAI_API_KEY") # This will set the key permanently until overwritten again set_openai_api_key("YOUR_OPENAI_API_KEY") ## End(Not run)
View saved API key'
show_openai_api_key()show_openai_api_key()
show_openai_api_key()show_openai_api_key()
Create a vetiver model object description
## S3 method for class 'accept_model' vetiver_create_description(model)## S3 method for class 'accept_model' vetiver_create_description(model)
model |
model name |
the description of the model
Useful for supporting accept_model class in vetiver
## S3 method for class 'accept_model' vetiver_create_meta(model, metadata)## S3 method for class 'accept_model' vetiver_create_meta(model, metadata)
model |
a trained model object |
metadata |
list containing additional metadata to store with the pin |
The vetiver_create_meta function returns a 'vetiver_meta()' list.
Create a vetiver input data prototype
## S3 method for class 'accept_model' vetiver_ptype(model, ...)## S3 method for class 'accept_model' vetiver_ptype(model, ...)
model |
a vetiver model object |
... |
any other inputs |
A 'vetiver_ptype' method returns a zero-row dataframe, and 'vetiver_create_ptype()' returns either such a zero-row dataframe, 'NULL', or the dataframe passed to 'save_prototype'.