Skip to main content

Python implementation of 2024 AHA PREVENT calculator

Project description

PyPREVENT :anatomical_heart:

2024 updates from AHA on ASCVD (Atherosclerotic and Cardiovascular Disease), CVD (cardiovascular disease) and Heart Failure (HF)


Python- 3.7 --> 3.12 Rust

Introduction

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)[^1][^2]. 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.

Installation

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

TL;DR

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,
)

Examples

A longer, and more thorough example is located here.

Implementation Status

Formula Status
10 yr ASCVD (individual) :white_check_mark:
10 yr ASCVD (batch) :white_check_mark:
30 yr ASCVD (individual) :white_check_mark:
30 yr ASCVD (batch) :white_check_mark:
10 yr Heart Failure (individual) :white_check_mark:
10 yr Heart Failure (batch) :white_check_mark:
30 yr Heart Failure (individual) :white_check_mark:
30 yr Heart Failure (batch) :white_check_mark:
10 yr CVD (individual) :white_check_mark:
10 yr CVD (batch) :white_check_mark:
30 yr CVD (individual) :white_check_mark:
30 yr CVD (batch) :white_check_mark:

Program Structure

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.

[^1]: 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 [^2]: 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyprevent-0.1.5.tar.gz (3.0 MB view hashes)

Uploaded Source

Built Distributions

pyprevent-0.1.5-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-cp312-none-win_amd64.whl (203.7 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

pyprevent-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-cp312-cp312-macosx_11_0_arm64.whl (318.8 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyprevent-0.1.5-cp311-none-win_amd64.whl (205.5 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pyprevent-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-cp311-cp311-macosx_11_0_arm64.whl (321.3 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyprevent-0.1.5-cp310-none-win_amd64.whl (205.4 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pyprevent-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-cp310-cp310-macosx_11_0_arm64.whl (321.1 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyprevent-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-cp39-cp39-macosx_11_0_arm64.whl (321.2 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyprevent-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-cp38-cp38-macosx_11_0_arm64.whl (320.3 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyprevent-0.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pyprevent-0.1.5-cp37-cp37m-macosx_11_0_arm64.whl (320.4 kB view hashes)

Uploaded CPython 3.7m macOS 11.0+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page