
CVD Prevent is an R package that provides a user-friendly interface to the NHS CVDPREVENT API. This enables analysts, researchers and healthcare professionals to access and work with England-wide primary care cardiovascular disease (CVD) audit data directly from R.
The Cardiovascular Disease Prevention Audit (CVDPREVENT) automatically extracts routinely held GP data. The Data & Improvement Tool provides open access to the data, with clear, actionable insights for those tasked with improving cardiovascular health.
You can install the latest development version from GitHub with:
# install.packages("pak")
pak::pak("craig-parylo/cvdprevent")Or install the latest stable release from CRAN:
pak::pak("cvdprevent")library(cvdprevent)
# List all available indicators (first 4 shown)
cvd_indicator_list(time_period_id = 22, system_level_id = 1) |>
dplyr::select(dplyr::any_of(c(
"IndicatorID",
"IndicatorCode",
"IndicatorShortName"
))) |>
dplyr::slice_head(n = 4)
#> # A tibble: 4 × 3
#> IndicatorID IndicatorCode IndicatorShortName
#> <int> <chr> <chr>
#> 1 1 CVDP001AF AF: Prevalence (CVDP001AF)
#> 2 2 CVDP002HYP Hypertension: Treated to appropriate threshold (age…
#> 3 3 CVDP003HYP Hypertension: Treated to appropriate threshold (age…
#> 4 4 CVDP004HYP Hypertension: BP monitoring (CVDP004HYP)Typical outputs are tibbles, making them easy to filter and manipulate:
# List the latest four time periods for 'Standard' indicators
cvd_time_period_list() |>
dplyr::filter(IndicatorTypeName == "Standard") |>
dplyr::slice_max(order_by = TimePeriodID, n = 4) |>
dplyr::select(TimePeriodID, TimePeriodName)
#> # A tibble: 4 × 2
#> TimePeriodID TimePeriodName
#> <int> <chr>
#> 1 26 To June 2025
#> 2 24 To March 2025
#> 3 22 To December 2024
#> 4 20 To September 2024See the package vignette for more examples and guidance:
vignette("using_cvdprevent", package = "cvdprevent")cvdprevent is designed to work seamlessly with the tidyverse, and depends on:
Install these with:
# install the packages
pak::pak(c(
"httr2",
"jsonlite",
"dplyr",
"purrr",
"tidyr",
"tibble",
"cli",
"glue"
))Contributions, suggestions or bug reports are welcome! Please:
This package is licensed under the MIT License. See LICENSE for details.
For more information, see the package website or the API documentation.