About the project

One verified library for the world's cardiovascular risk scores

Why it exists

Cardiovascular risk scores guide prevention and treatment decisions worldwide, and dozens have been published: SCORE2 in Europe, PREVENT and the Pooled Cohort Equations in the United States, QRISK3 in the United Kingdom, PREDICT in New Zealand, the WHO charts for most of the world, and many more.

Implementations of these scores already exist, but they are fragmented: spread across languages, packages and web calculators, each covering a few scores with its own argument names, units and conventions. More importantly, their outputs are rarely shown to match the equations of the original papers. In the course of this work, defects were found in existing implementations and even in published worked examples; all are documented in the verification reports. A researcher comparing scores across a cohort has no easy way to know which numbers to trust.

PyCVDRisk addresses both problems. Every score is implemented from its original publication, every coefficient cites its source, and every implementation is checked against that publication and, where one exists, against an independent reference. Today 23 of the 49 scores are verified against the developers' software, or an independent package and the developers' material; the rest against the developers' published material alone, or in part.

Why Python, and one API

Most contemporary research workflows, from cohort analysis to machine learning, run in Python. A library there can be used directly on a data frame of a million patients, alongside the rest of the analysis, rather than through a web form or a bridge to another language.

All scores share one interface: the same argument names and units, vectorised over NumPy arrays, with risks returned as fractions and invalid inputs returned as NaN. Comparing SCORE2, PREVENT and QRISK3 on the same patients is three function calls on the same data frame.

Transparency

Each score has a verification report describing the sources used, what was compared, the agreement reached and every discrepancy found, including errors in the original publications. The reports are part of the repository and can be reproduced. The papers themselves are not redistributed: each score lists the documents it was checked against, with a link to the publisher.

Read the verification reports →

Paper and citation

A manuscript describing the library and its verification is in preparation; it will be linked here on publication. Until then, please cite the software using the citation file in the repository.

CITATION.cff →

Contributing

PyCVDRisk is open source and welcomes contributions from clinicians, epidemiologists and developers.

Report a discrepancy
If an output differs from a paper, a calculator or another implementation, open an issue with the inputs, both results and the source. Discrepancies are the most valuable contribution: each one either exposes an error or is documented in the verification report.
Propose a new score
Suggest a published risk equation with its reference. A score is added only when its full equation or point table is available, so it can be verified to the same standard as the existing ones.
Provide a reference
Authors' code, official calculators and worked examples let a paper-checked score be upgraded to reference-verified. Pointers to such material are especially welcome.
Improve the code
Pull requests are welcome. Each change to a score must keep its tests and its verification against the source passing.

Contact

PyCVDRisk is developed by Mohamad AlJasem. For questions, collaborations or to discuss a contribution, write to mohamad@aljasem.eu.org.

Image credits are listed on the credits page.