Cardiovascular risk scores from across the world, verified, in Python
🌐 Website • 🚀 Quick start • 📊 Scores • 🔬 Verification • 🤝 Contributing
🫀 What is PyCVDRisk?
PyCVDRisk (cvd-risk on PyPI) is a Python library of 30 published cardiovascular risk scores from the
Americas, Europe, the Middle East and the Asia-Pacific region: SCORE2, PREVENT, the Pooled Cohort Equations,
QRISK3, Framingham, the WHO charts, PREDICT and many more, under one fast, vectorised API.
Implementations of these scores already exist, but they are scattered across languages, packages and web calculators, and their outputs are rarely shown to match the equations of the original papers. PyCVDRisk is built so that every number can be traced and checked:
- 📖 Implemented from the source. Every coefficient, baseline survival and point table comes from the original publication or its supplement, and the code cites the table it came from.
- ✅ Verified, not just implemented. 19 of the 30 scores are verified against an independent reference implementation (the authors' own code or calculator, official charts, or an established R package); the rest are checked line by line against their papers.
- 🔍 Transparent. Each score ships a verification report recording what was compared, the agreement reached and every discrepancy found, including errors in the original publications.
- ⚡ Fast and vectorised. Plain functions over NumPy arrays: pass one patient or a million.
- 🛡️ Safe by default. Invalid inputs return
NaNinstead of being silently clamped.
📦 Installation
pip install cvd-risk
Requires Python 3.10+ and NumPy.
🚀 Quick start
from cvd_risk import score2, prevent, qrisk3
# SCORE2 (Europe): two patients at once
score2(age=[50, 62], sex=["male", "female"], smoker=[1, 0], sbp=[140, 130],
total_chol=[5.5, 6.1], hdl_chol=[1.3, 1.6], diabetes=0, region="low")
# array([0.0591, 0.0379]) 10-year risk as a fraction
# PREVENT (AHA 2024)
prevent(age=50, sex="female", sbp=160, bp_treated=1, total_chol=5.2, hdl_chol=1.4,
statin=0, diabetes=1, smoker=0, egfr=90, bmi=35, years=10, outcome="total_cvd")
# QRISK3 (UK)
qrisk3(age=64, sex="female", ethnicity="indian", smoking="non", bmi=27, chol_hdl_ratio=4.0,
sbp=140, sbp_sd=8, townsend=0)
Works directly on data frames:
import pandas as pd
df = pd.read_csv("cohort.csv")
df["score2"] = score2(df.age, df.sex, df.smoker, df.sbp, df.total_chol, df.hdl_chol,
df.diabetes, region="moderate")
Conventions shared by every score: cholesterol in mmol/L, blood pressure in mmHg, any argument may be an array, and risks are returned as fractions in [0, 1].
📊 The scores
✅ Reference-verified: matches an independent implementation. 📄 Paper-checked: no independent implementation exists, so the score is checked against every rule, table and worked example of its paper. Each score's page on the website has a runnable example.
Primary prevention
| Score | Region | Year | Function | Evidence |
|---|---|---|---|---|
| SCORE2 | Europe | 2021 | score2 |
✅ Reference-verified (report) |
| SCORE2-OP | Europe | 2021 | score2_op |
✅ Reference-verified (report) |
| SCORE2 Asia-Pacific | Asia-Pacific | 2024 | score2_asia_pacific |
✅ Reference-verified (report) |
| SCORE | Europe | 2003 | score |
✅ Reference-verified (report) |
| Globorisk | Global, 182 countries | 2015-2017 | globorisk |
✅ Reference-verified (report) |
| WHO 2019 | Global, 21 regions / 190 countries | 2019 | who2019 |
✅ Reference-verified (report) |
| WHO/ISH | Global, 14 WHO subregions | 2007 | who_ish |
✅ Reference-verified (report) |
| PREVENT | United States | 2024 | prevent |
✅ Reference-verified (report) |
| Pooled Cohort Equations | United States | 2013 | pce |
✅ Reference-verified (report) |
| Framingham | Framingham, Massachusetts | 2008 | framingham |
✅ Reference-verified (report) |
| Reynolds | United States (Boston) | 2007-2008 | reynolds |
📄 Paper-checked (report) |
| QRISK3 | United Kingdom | 2017 | qrisk3 |
✅ Reference-verified (report) |
| QRISK2 | United Kingdom | 2014 | qrisk2 |
✅ Reference-verified (report) |
| FINRISK | Finland | 2016 | finrisk |
📄 Paper-checked (report) |
| ADRS | United Arab Emirates | 2024 | adrs |
📄 Paper-checked (report) |
| PROCAM | Germany | 2002 | procam |
📄 Paper-checked (report) |
| REGICOR | Spain | 2003 | regicor |
📄 Paper-checked (report) |
| PREDICT | New Zealand | 2018-2022 | predict_cvd, predict_cvd_bmi, predict_cvd_policy, predict_t2d, predict_bleed, predict_post_cvd, predict_post_acs |
📄 Paper-checked (report) |
| LIFE-CVD2 | Europe | 2024 | life_cvd2 |
✅ Reference-verified (report) |
Diabetes, kidney disease, established CVD and atrial fibrillation
| Score | Region | Year | Function | Evidence |
|---|---|---|---|---|
| SCORE2-Diabetes | Europe | 2023 | score2_diabetes |
✅ Reference-verified (report) |
| SCORE2-CKD | Europe | 2022 | score2_ckd |
✅ Reference-verified (report) |
| SMART-REACH | International | 2018 | smart_reach |
✅ Reference-verified (report) |
| DIAL2 | Europe (derived in Sweden) | 2023 | dial2 |
📄 Paper-checked (report) |
| CHA2DS2-VASc | Europe | 2010 | cha2ds2_vasc |
📄 Paper-checked (report) |
| CHADS2 | United States | 2001 | chads2 |
📄 Paper-checked (report) |
| HAS-BLED | Europe | 2010 | has_bled |
📄 Paper-checked (report) |
Acute chest pain and coronary syndromes
| Score | Region | Year | Function | Evidence |
|---|---|---|---|---|
| HEART | Netherlands | 2008 | heart |
✅ Reference-verified (report) |
| TIMI | United States (Boston) | 2000 | timi |
✅ Reference-verified (report) |
| EDACS | Australia & New Zealand | 2014 | edacs |
✅ Reference-verified (report) |
| GRACE | International, 14 countries | 2003-2004 | grace_hospital, grace_6month |
📄 Paper-checked (report) |
🔬 How each score is verified
- Transcribed from the source. Coefficients and tables are taken from the original publication, never from secondary sources, and each cites its table or line.
- Checked against the paper. The implementation reproduces the worked examples, printed tables and risk charts its paper provides. Errors found in the publications are documented, not silently corrected.
- Verified independently. Where an independent implementation exists, outputs are compared directly, across thousands of simulated patients wherever the reference can be run.
The full reports are in reference/.
📝 Citing PyCVDRisk
A paper describing the library and its verification is in preparation. Until it is published, please cite the
software using CITATION.cff (GitHub's
"Cite this repository" button gives BibTeX and APA).
🤝 Contributing
Contributions from clinicians, epidemiologists and developers are welcome:
- 🐞 Report a discrepancy. If an output differs from a paper, calculator or other implementation, open an issue with the inputs, both results and the source.
- ➕ Propose a score. Suggest a published risk equation with its reference; it is added once its full equation or point table is available and can be verified.
- 📚 Provide a reference. Authors' code, official calculators and worked examples let a paper-checked score become reference-verified.
- 🛠️ Improve the code. Pull requests must keep the tests and the verification against the source passing.
Contact: Mohamad AlJasem, mohamad@aljasem.eu.org
⚖️ License
MIT, except the QRISK2 and QRISK3 modules (src/cvd_risk/qrisk2, src/cvd_risk/qrisk3), which are derived
from ClinRisk's code and licensed under LGPL-3.0-or-later.
⚠️ PyCVDRisk is intended for research and education. It is not a medical device and is not a substitute for clinical judgement.
Metadata
Release files for cvd-risk 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cvd_risk-2.0.0.tar.gz | 1.6 MB | With provenance | Details for cvd_risk-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cvd_risk-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for cvd_risk-2.0.0-py3-none-any.whl |
Total release size: 3.3 MB
Release files / cvd_risk-2.0.0.tar.gz
| Download URL | cvd_risk-2.0.0.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49f1ebd1e74157df1f93a23b40bec388d41e7202ed4467afeb8ee7eb549109f0
|
|
BLAKE2b-256 checksum How to use checksums |
eae7b7b069a2a369d1b63e17bfc35ca7fefd8be9a95a12654fb4acd76b558628
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / cvd_risk-2.0.0-py3-none-any.whl
| Download URL | cvd_risk-2.0.0-py3-none-any.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c189d400e7ec479f7a8cbf0e0f8fcf673735f9734166344356dbc62405425df0
|
|
BLAKE2b-256 checksum How to use checksums |
1aaf91932b049d5e628ff2a1d88ea60fed02d005035e6de7d6331658f915d6bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for cvd-risk 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cvd_risk-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.