Skip to main content
PyCVDRisk

Cardiovascular risk scores from across the world, verified, in Python

PyPI version Python versions CI License Website

🌐 Website • 🚀 Quick start • 🌍 One call for any country • 📊 Scores • 🔬 Verification • 🤝 Contributing


🫀 What is PyCVDRisk?

PyCVDRisk (cvd-risk on PyPI) is a Python library of 40 published cardiovascular risk scores from the Americas, Europe, the Middle East, Africa and the Asia-Pacific region: SCORE2, PREVENT, the Pooled Cohort Equations, QRISK3, Framingham, the WHO charts, PREDICT, China-PAR, the Japanese scores 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 original model. 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, its supplement or the developers' own code, and the code cites where it came from.
  • ✅ Verified against the developers. 29 of the 40 scores are checked against the developers' own code, calculator or charts, most of them patient by patient on thousands of synthetic patients.
  • 🔍 Transparent. Each score ships a verification report recording what was compared, the agreement reached and every discrepancy found, including errors in the publications, the official calculators and other packages.
  • ⚡ Fast and vectorised. Plain functions over NumPy arrays: pass one patient or a million.
  • 🛡️ Safe by default. Invalid inputs return NaN instead 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")
# 0.1286

# 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)
# 0.1135

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].

🌍 One call for any country

uniscore gives each person the score their country's guideline body recommends: PREVENT (USA), QRISK3 (UK), SCORE2/SCORE2-OP (the 55 ESC countries of SCORE2 Fig 5), SCORE2 Asia-Pacific (48 countries) and WHO 2019 everywhere else. The routing table, with a source for every country, is src/cvd_risk/uniscore/routing.csv.

from cvd_risk import uniscore, guideline_score
uniscore(["USA", "DEU", "JPN", "BRA"], age=60, sex="female", sbp=135, total_chol=5.8,
         hdl_chol=1.4, smoker=0, diabetes=0, bp_treated=1, statin=0, egfr=85, bmi=29)
# array([0.0706, 0.0438, 0.0519, 0.0430])
guideline_score(["USA", "DEU", "JPN", "BRA"])
# ['prevent', 'score2', 'score2_asia_pacific', 'who2019']

📊 The scores

Every score is checked against the strongest reference that exists:

Level Reference
🅰️ A the developers' own code, calculator or charts
🅱️ B an independent package or calculator
📄 C the paper's worked examples, printed tables and point rules

✅ marks a score with level-A evidence; 🔁 one whose best evidence is an independent package; 📄 one checked against its paper alone. Each score's page on the website has a runnable example, and each report records exactly what was compared.

Primary prevention

Score Region Year Function Evidence
SCORE2 Europe 2021 score2 ✅ A + B + C (report)
SCORE2-OP Europe 2021 score2_op ✅ A + B (report)
SCORE2 Asia-Pacific Asia-Pacific 2024 score2_asia_pacific ✅ A + B (report)
SCORE Europe 2003 score ✅ A (report)
LIFE-CVD2 Europe 2024 life_cvd2 ✅ A (report)
PREVENT United States 2024 prevent ✅ A + C + B (report)
Pooled Cohort Equations United States 2013 pce ✅ A + C + B (report)
Framingham Framingham, Massachusetts 2008 framingham ✅ A + C + B (report)
Reynolds United States (Boston) 2007-2008 reynolds ✅ A (men) + C (report)
QRISK3 United Kingdom 2017 qrisk3 ✅ A + B (report)
QRISK2 United Kingdom 2014 qrisk2 ✅ A (report)
ASSIGN 1.0 and 2.0 Scotland 2007-2025 assign ✅ A + C (report)
FINRISKI 2.0 Finland 2020 finrisk ✅ A + C (report)
REGICOR Spain 2003 regicor ✅ A + C (report)
CUORE Italy 2007 cuore ✅ A + C (report)
PROCAM Germany 2007 procam, procam_stroke 📄 C (report)
ADRS United Arab Emirates 2024 adrs 📄 C (report)
China-PAR China 2016 china_par ✅ A + C (report)
Hisayama Japan 2022 hisayama, hisayama_points, hisayama_points_risk ✅ A (point score) + B + C (report)
EPOCH-JAPAN Japan 2021 epoch_japan 🔁 C + B (report)
JALS Japan 2019 jals, jals_risk 🔁 C + B (report)
Suita Japan 2014 suita, suita_risk 📄 C (+ partial B) (report)
Suita CVD Japan 2020 suita_cvd, suita_cvd_risk 📄 C (+ partial B) (report)
PREDICT (7 equations) New Zealand 2018-2022 predict_cvd, predict_cvd_bmi, predict_cvd_policy ✅ A + C (report)
Globorisk Global, 182 countries 2015-2017 globorisk ✅ A (report)
WHO 2019 Global, 21 regions / 190 countries 2019 who2019 ✅ A + B (report)
WHO/ISH Global, 14 WHO subregions 2007 who_ish ✅ A + B (report)

Diabetes, kidney disease and established vascular disease

Score Region Year Function Evidence
SCORE2-Diabetes Europe 2023 score2_diabetes ✅ A + B + C (report)
SCORE2-CKD Europe 2022 score2_ckd ✅ A + C + B (report)
DIAL2 Europe (derived in Sweden) 2023 dial2 ✅ A + C (report)
PREDICT diabetes, after CVD, after ACS, bleeding New Zealand 2017-2021 predict_t2d, predict_post_cvd, predict_post_acs, predict_bleed ✅ A + C (report)
SMART-REACH International 2018 smart_reach ✅ A (report)
SMART2 Europe and five other world regions 2022 smart2 ✅ A (report)

Atrial fibrillation

Score Region Year Function Evidence
CHA2DS2-VASc Europe 2010 cha2ds2_vasc 🔁 C (every input) + B (report)
CHADS2 United States 2001 chads2 🔁 C (every input) + B (report)
HAS-BLED Europe 2010 has_bled 🔁 C (every input) + B (report)

Acute chest pain and coronary syndromes

Score Region Year Function Evidence
TIMI UA/NSTEMI United States (Boston) 2000 timi ✅ A + C + B (report)
GRACE 2.0 International 2014 grace2 ✅ A + C (report)
GRACE 6-month and in-hospital International, 14 countries 2003-2004 grace_6month, grace_hospital ✅ A (6-month) + C (report)
HEART Netherlands 2008 heart 🔁 C (every input) + B (report)
EDACS Australia & New Zealand 2014 edacs 🔁 C (every input) + B (report)

In numbers: 29 scores have level-A evidence (Reynolds for men only), 7 more rest on an independent package, and 4 on their papers alone. For pure point scores with no developer software (CHADS2, CHA2DS2-VASc, HAS-BLED, HEART, EDACS), every possible input combination is checked against the paper's table.

🔬 How each score is verified

  1. Transcribed from the source. Coefficients and tables are taken from the original publication, its supplement or the developers' code, never from secondary sources, and each cites its table or line.
  2. Checked against the developers. Where the developers' code, calculator or charts exist, outputs are compared directly: their code is run unmodified, their calculators are queried patient by patient, and their charts are reproduced cell by cell.
  3. Checked against the paper. The implementation reproduces the worked examples, printed tables and risk charts its paper provides, and mutation tests confirm that a change in the last printed digit of a coefficient is detected.
  4. Discrepancies are documented, not hidden. Errors in publications, official calculators and other packages are recorded with their evidence; the package follows the publication unless the developers have issued a correction.

The full reports, the sources and the owner actions still open are in reference/README.md.

📝 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 score move up to level A.
  • 🛠️ 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cvd-risk 2.0.1
File Size Uploaded Provenance Actions
cvd_risk-2.0.1.tar.gz 1.7 MB With provenance Details for cvd_risk-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cvd-risk 2.0.1
File Interpreter ABI Platform Actions
cvd_risk-2.0.1-py3-none-any.whl Python 3 none any Details for cvd_risk-2.0.1-py3-none-any.whl

Total release size: 3.3 MB

Release files / cvd_risk-2.0.1.tar.gz

Download URL cvd_risk-2.0.1.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
0f05688ff3f57fdfe75bef5fa50347cecbb11ecf89792adba3b3f100b3913c03
BLAKE2b-256 checksum
How to use checksums
231f333b2703e9116538b1eff69af1815ab22dedd62e3bc74673cdfac93501bb
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 25, 2026.

Transparency log

Release files / cvd_risk-2.0.1-py3-none-any.whl

Download URL cvd_risk-2.0.1-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
91b6d66f2ab22071bc3e24950ccea3193c4ceb210792b3a7598284c5886bd493
BLAKE2b-256 checksum
How to use checksums
79130d83475eb29f8cae087a1390e532c4a94415ea09a02b587d7d7dc9ada112
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 25, 2026.

Transparency log

Security for cvd-risk 2.0.1

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.

Select from 2 files

Attestation for cvd_risk-2.0.1.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 25, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page