Skip to main content

CircleCI License: MIT

CVD-risk-scores

A Python package for computing cardiovascular disease risk using clinically validated models.

Note: This is a work in progress

Install

This package is available on PyPI

pip install cvd-risk-scores

Getting started

CVD-risk-scores is based upon the torch philosophy of callable objects. Each RiskModel subclass is a callable upon initialisation, taking an array-like of subjects, each defined by some variables of interest, and returning an array-like of float values corresponding to cardiovascular risk scores.

import cvd_risk_scores

# Instantiate the risk model we are interested in
risk_model = cvd_risk_scores.FraminghamRiskScore()

# Define our subject, in this case using a dictionary
subject = {
  "gender": "female",
  "age": 61,
  "SBP_nt": 124,
  "SBP_t": 0,
  "TotalChol": 180,
  "HDL": 47,
  "smoker": True,
  "diabetes": False
}

# Create a numpy array from features values
data = np.array([list(subject.values())])

# Alternatively:
#data = np.array([
#  ["female", 61, 124, 0, 180, 47, True, False]
#])

# define a dictionary mapping our own column names to the names
# expected by the risk score model.
# if data is either a numpy array or a list of lists,
# the `columns_map` mapping must present the columns
# in the correct order so that data can be cast to a pandas DataFrame.
columns_map = {
  "gender": "sex",
  "age": "age",
  "SBP_nt": "SBP_nt",
  "SBP_t": "SBP_t",
  "TotalChol": "tch",
  "HDL": "HDL",
  "smoker": "smoking",
  "diabetes": "diabetes"
}

# Compute the risk score
risk_score = risk_model(data=data, columns_map=columns_map)

About

CVD-risk-scores is a Python package for computing cardiovascular disease risk using clinically validated models. It exposes an object-based API for interacting with risk models that is inspired by the torch paradigm of callable objects.

Available risk models:

  • Framingham Risk Score

References

[1] D'Agostino, Ralph B Sr et al. “General cardiovascular risk profile for use in primary care: the Framingham Heart Study.” Circulation vol. 117,6 (2008): 743-53. doi:10.1161/CIRCULATIONAHA.107.699579

Metadata

Release files for cvd-risk-scores 1.0.2

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-scores 1.0.2
File Size Uploaded
cvd_risk_scores-1.0.2.tar.gz 8.0 kB Details

Release files / cvd_risk_scores-1.0.2.tar.gz

Download URL cvd_risk_scores-1.0.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
580383314f8021bdf0e57128b4cdaf026ebd91d39c7a98222d91ee36de1bd036
BLAKE2b-256 checksum
How to use checksums
3b8a6822d07a17103a154b401fc6010f0edcc384481c3e3e8fa06d73625213c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.1.0

1 release file

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