2024 updates from AHA on ASCVD (Atherosclerotic and Cardiovascular Disease), CVD (cardiovascular disease) and Heart Failure (HF)
The PyPREVENT Equations package offers 2024 updates from the American Heart Association (AHA) on Atherosclerotic and Cardiovascular Disease (ASCVD), Cardiovascular Disease (CVD), and Heart Failure (HF)12. It's a mixed Rust and Python module, leveraging the speed of Rust for equation implementation and the flexibility of Python for ease of use.
Requirements:
- Python 3.7 to 3.12 on a Silicon Mac / Linux system (more compatibility coming soon)
To install the package, pip install using:
pip install pyprevent
import pyprevent
pyprevent.calculate_30_yr_ascvd_risk(
sex="MALE",
age=40,
total_cholesterol=200,
hdl_cholesterol=50,
systolic_bp=120,
has_diabetes=False,
current_smoker=False,
bmi=25,
egfr=70,
on_htn_meds=False,
on_cholesterol_meds=False,
)
A longer, and more thorough example is located here.
Formula | Status |
---|---|
10 yr ASCVD (individual) | ✅ |
10 yr ASCVD (batch) | ✅ |
30 yr ASCVD (individual) | ✅ |
30 yr ASCVD (batch) | ✅ |
10 yr Heart Failure (individual) | ✅ |
10 yr Heart Failure (batch) | ✅ |
30 yr Heart Failure (individual) | ✅ |
30 yr Heart Failure (batch) | ✅ |
10 yr CVD (individual) | ✅ |
10 yr CVD (batch) | ✅ |
30 yr CVD (individual) | ✅ |
30 yr CVD (batch) | ✅ |
This is a mixed Rust and Python module.
The rust source code is used to implement the equations. This is a lower level language that requires compilation prior to being run -- and thus is many times faster than pure python.
The rust source code is located in the /src directory. The individual functions are written in their respective files, and registered to the rust_aha_formulas python module within the lib.rs file.
The python source is located in the /pyprevent directory.
Unit tests are implemented in the /tests directory using slash.
Footnotes
-
Khan SS, Matsushita K, Sang Y, et al. Development and Validation of the American Heart Association Predicting Risk of Cardiovascular Disease EVENTs (PREVENTTM) Equations. Circulation 2023. DOI: 10.1161/CIRCULATIONAHA.123.067626 ↩
-
Khan SS, Coresh J, Pencina MJ, et al. Novel Prediction Equations for Absolute Risk Assessment of Total Cardiovascular Disease Incorporating Cardiovascular-Kidney-Metabolic Health: A Scientific Statement From the American Heart Association. Circulation 2023;148(24):1982-2004. DOI: 10.1161/CIR.0000000000001191 ↩