Skip to main content

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

Project description

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

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

cvd_risk_scores-1.0.2.tar.gz (8.0 kB view details)

Uploaded Source

File details

Details for the file cvd_risk_scores-1.0.2.tar.gz.

File metadata

  • Download URL: cvd_risk_scores-1.0.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for cvd_risk_scores-1.0.2.tar.gz
Algorithm Hash digest
SHA256 580383314f8021bdf0e57128b4cdaf026ebd91d39c7a98222d91ee36de1bd036
MD5 fd82fcc2c8b44d2a90094ef49074d3bc
BLAKE2b-256 3b8a6822d07a17103a154b401fc6010f0edcc384481c3e3e8fa06d73625213c0

See more details on using hashes here.

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