Using CVD Prevent

library(cvdprevent)

Time periods

Listing time periods

The CVD Prevent audit outputs data around four times a year. To see which are the four latest available periods for standard indicators you can use the function cvd_time_period_list():

cvd_time_period_list() |> 
  dplyr::filter(IndicatorTypeName == 'Standard') |> 
  dplyr::slice_max(order_by = TimePeriodID, n = 4) |> 
  dplyr::select(TimePeriodID, TimePeriodName) |> 
  gt::gt()
TimePeriodID TimePeriodName
18 To June 2024
17 To March 2024
17 To March 2024
15 To December 2023

There are two main types of indicator reported; ‘Standard’ (ID1) and ‘Outcomes’ (ID2). Pass in an ID value for the optional parameter, indicator_type_id to get a list of time periods for which the indicator type was reported.

cvd_time_period_list(indicator_type_id = 2) |> 
  dplyr::slice_max(order_by = TimePeriodID, n = 4) |> 
  dplyr::select(IndicatorTypeID, IndicatorTypeName, TimePeriodID, TimePeriodName) |> 
  gt::gt()
IndicatorTypeID IndicatorTypeName TimePeriodID TimePeriodName
2 Outcomes 16 Jan 2023 - Dec 2023
2 Outcomes 14 Jul 2022 - Jun 2023
2 Outcomes 13 Oct 2022 - Sep 2023
2 Outcomes 12 Apr 2022 - Mar 2023

Listing system levels per period

Data can be reported at different geographies (aka System Levels) in each period; typically ranging from individual GP practices to national level (England). To get the available system levels we can use the cvd_time_period_system_levels() function.

cvd_time_period_system_levels() |> 
  dplyr::slice_max(order_by = TimePeriodID) |> 
  dplyr::select(TimePeriodID, TimePeriodName, SystemLevelID, SystemLevelName) |> 
  gt::gt()
TimePeriodID TimePeriodName SystemLevelID SystemLevelName
18 To June 2024 1 England
18 To June 2024 4 PCN
18 To June 2024 5 Practice
18 To June 2024 6 Region
18 To June 2024 7 ICB
18 To June 2024 8 Sub-ICB

Areas

List available system levels for a given time period

To find out which system levels are reported for a specific time period you can use the cvd_area_system_level() function, providing the required time_period_id, (NB, time_period_id defaults to the first time period if not supplied).

cvd_area_system_level(time_period_id = 17) |> 
  dplyr::select(SystemLevelID, SystemLevelName) |> 
  gt::gt()
SystemLevelID SystemLevelName
1 England
6 Region
7 ICB
8 Sub-ICB
4 PCN
5 Practice

List all available reporting periods for each system level

Use the cvd_area_system_level_time_periods() function to show a list of all reporting periods for each system level. Here we show the latest four reporting periods at the GP practice system level.

cvd_area_system_level_time_periods() |> 
  dplyr::filter(SystemLevelName == 'Practice') |> 
  dplyr::slice_max(order_by = TimePeriodID, n = 4) |> 
  dplyr::select(SystemLevelID, SystemLevelName, TimePeriodID, TimePeriodName) |> 
  gt::gt()
SystemLevelID SystemLevelName TimePeriodID TimePeriodName
5 Practice 18 To June 2024
5 Practice 17 To March 2024
5 Practice 15 To December 2023
5 Practice 10 To September 2023

List areas for a time period and system level or parent area

To list four of the Primary Care Networks (PCN) (SystemLevelID = 4) for which data is available at time period 17 use the cvd_area_list() function.

cvd_area_list(time_period_id = 17, system_level_id = 4) |> 
  dplyr::select(SystemLevelName, AreaID, AreaCode, AreaName) |> 
  dplyr::slice_head(n = 4) |> 
  gt::gt()
SystemLevelName AreaID AreaCode AreaName
PCN 1103 U60176 3 Centres PCN
PCN 1103 U60176 3 Centres PCN
PCN 920 U72999 4 Doncaster PCN
PCN 920 U72999 4 Doncaster PCN

Either parent area or system level must be specified.

View details for a specific area

To view details for a specific area use cvd_area_details() with the required parameters of ‘time_period_id’ and ‘area_id’. The return from this function is a list of three named tibbles:

# get the list from the function
returned_list <- cvd_area_details(time_period_id = 17, area_id = 1103)

The tibbles first need extracting from the returned list object, done here using the list$object notation. To view area details:

returned_list$area_details |> 
  dplyr::select(AreaCode, AreaName, SystemLevelID) |> 
  gt::gt()
AreaCode AreaName SystemLevelID
U60176 3 Centres PCN 4

View details for the parent of this area:

returned_list$area_parent_details |> 
  dplyr::select(AreaID, AreaName, SystemLevelID) |> 
  gt::gt()
AreaID AreaName SystemLevelID
7959 NHS West Yorkshire ICB - X2C4Y 8

View details for the children of this area:

returned_list$area_child_details |> 
  dplyr::select(AreaID, AreaName, SystemLevelID) |> 
  gt::gt()
AreaID AreaName SystemLevelID
1929 Calder View Surgery 5
1932 North Road Suite,Ravensthorpe Health Ctr 5
1938 Mirfield Health Centre 5
1939 Eightlands Surgery 5
1978 Dr Mahmood & Partners 5

List areas without parent details

Some areas do not have parent details but do have data reported in a given period, which may mean they are missed when searching for areas. This function provides a convenient way of accessing these details for a given ‘time_period_id’ and ‘system_level_id’.

Here we report four GP practices without any parent PCN:

cvd_area_unassigned(time_period_id = 17, system_level_id = 5) |> 
  dplyr::slice_head(n = 4) |> 
  dplyr::select(SystemLevelName, AreaID, AreaName) |> 
  gt::gt()
SystemLevelName AreaID AreaName
Practice 4877 27@Northgate
Practice 2569 Beauchief Medical Practice
Practice 2040 Bramley Village Health & Wellbeing Ctr
Practice 5680 Central Clinic

The top system_level (England) does not have a parent either:

cvd_area_unassigned(time_period_id = 17, system_level_id = 1) |> 
  dplyr::select(SystemLevelName, AreaID, AreaName) |> 
  gt::gt()
SystemLevelName AreaID AreaName
England 1 England

Search for area by keyword

To find details for an area where you don’t know its ID number you can perform a partial name search using cvd_area_search() and specify a time period to search.

cvd_area_search(partial_area_name = 'foo', time_period_id = 17) |> 
  dplyr::select(AreaID, AreaName, AreaCode) |> 
  gt::gt()
AreaID AreaName AreaCode
7327 HILLFOOT HEALTH N82116
1991 Hillfoot Surgery B86011
6155 Waterfoot Medical Practice P81132

Area details

Nested

To get details for areas, including all system areas within the area, you can use the function cvd_area_nested_subsystems() . An area ID is a required parameter. Here we request details for North West NHS Region which returns a named list:

return_list <- cvd_area_nested_subsystems(area_id = 7665) 
return_list |> summary()
#>         Length Class  Mode
#> level_1 7      tbl_df list
#> level_2 7      tbl_df list
#> level_3 7      tbl_df list
#> level_4 7      tbl_df list
#> level_5 7      tbl_df list

The named tibble level_1 provides details about our requested area, which can be accessed using the return_list$indicators:

return_list$level_1 |> 
  gt::gt()
AreaCode AreaID AreaName AreaOdsCode ParentAreaID SystemLevelID SystemLevelName
E40000010 7665 North West Y62 1 6 Region

The next level down are areas that are children of the region:

return_list$level_2 |> 
  gt::gt()
AreaCode AreaID AreaName AreaOdsCode ParentAreaID SystemLevelID SystemLevelName
E54000007 33 Greater Manchester Health and Social Care Partnership NA 7665 2 STP
E54000008 37 Cheshire and Merseyside QYG 7665 2 STP
E54000048 42 Healthier Lancashire and South Cumbria QE1 7665 2 STP
E54000057 8030 NHS Greater Manchester Integrated Care Board QOP 7665 7 ICB
E54000048 8034 NHS Lancashire and South Cumbria Integrated Care Board QE1 7665 7 ICB
E54000008 8068 NHS Cheshire and Merseyside Integrated Care Board QYG 7665 7 ICB

The next level down are the children of these areas … and so on.

Flat

Alternatively, you can request a flat output grouped on system level using the cvd_area_flat_subsystem() function:

cvd_area_flat_subsystems(area_id = 5) |> 
  dplyr::glimpse()
#> Rows: 75
#> Columns: 14
#> $ AreaCode                   <chr> "E54000038", "E54000038", "E54000038", "E54…
#> $ AreaID                     <int> 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5…
#> $ AreaName                   <chr> "Somerset", "Somerset", "Somerset", "Somers…
#> $ AreaOdsCode                <chr> "QSL", "QSL", "QSL", "QSL", "QSL", "QSL", "…
#> $ ParentAreaID               <int> 7670, 7670, 7670, 7670, 7670, 7670, 7670, 7…
#> $ SystemLevelID              <int> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2…
#> $ SystemLevelName            <chr> "STP", "STP", "STP", "STP", "STP", "STP", "…
#> $ SubSystems_AreaCode        <chr> "E38000150", "U47425", "U17153", "U84175", …
#> $ SubSystems_AreaID          <int> 105, 528, 613, 677, 688, 743, 786, 868, 963…
#> $ SubSystems_AreaName        <chr> "NHS Somerset CCG", "West Somerset PCN", "W…
#> $ SubSystems_AreaOdsCode     <chr> "11X", NA, NA, NA, NA, NA, NA, NA, NA, NA, …
#> $ SubSystems_ParentAreaID    <int> 5, 105, 105, 105, 105, 105, 105, 105, 105, …
#> $ SubSystems_SystemLevelID   <int> 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5…
#> $ SubSystems_SystemLevelName <chr> "CCG", "PCN", "PCN", "PCN", "PCN", "PCN", "…

Indicators

An Indicator represents a cardiovascular disease health indicator as defined by NHS England. An example of an Indicator is CVDP001AF, ‘Prevalence of GP recorded atrial fibrillation in patients aged 18 and over’. Indicators have unique Indicator IDs. Each indicator is further broken down into Metrics.

A Metric represents a further breakdown of an indicator by inequality markers. An example of an inequality marker is ‘Age Group - Male, 40-59’. Metrics have unique Metric IDs with each representing a combination of Indicator and Metric Category.

A Metric Category describes the inequality markers which the Metric applies to. Each Metric Category has a unique ID for each combination of Name and Metric Category Type.

A Metric Category belongs to a Metric Category Type which groups the Metric Categories into one entity. Each Metric Category Type has a unique ID.

For example, ‘Male - 40-59’ is a Metric Category in the ‘Age Group’ Metric Category Type. Age Group will also contain categories for ‘18-39’, ‘40-59’, ‘60-79’, ‘80+’. Assigning Metric Categories to Metric Category Type allows comparison of all metrics in one inequality marker (in this case Age Group), or displaying Metric Categories in the same Metric Category Type alongside each other.

Listing indicators

To get a list of all available indicators for a given time period and system level you can use the cvd_indicator_list() function and specify which time period and system level you are interested in.

Here we access the first four indicators for time point 17 and GP practice level (system level 5).

cvd_indicator_list(time_period_id = 17, system_level_id = 5) |> 
  dplyr::select(IndicatorID, IndicatorCode, IndicatorShortName) |> 
  dplyr::slice_head(n = 4) |> 
  gt::gt()
IndicatorID IndicatorCode IndicatorShortName
13 CVDP002CKD CKD: uncoded case finder
20 CVDP005HYP Hypertension: high risk case finder
23 CVDP010CHOL Cholesterol: CKD treated with LLT
24 CVDP001SMOK Smoking: record of smoking status

Listing metrics for each indicator

To list all metrics for each indicator you can use the cvd_indicator_metric_list() function and specify which time period and system level you are interested in.

Here we access the metrics for the prevalence of atrial fibrillation (Indicator ID 1) and focussing on just those metrics available for the 40-59 years age group:

cvd_indicator_metric_list(time_period_id = 17, system_level_id = 1) |>
  dplyr::filter(IndicatorID == 1, MetricCategoryName == '40-59') |> 
  dplyr::count(IndicatorID, IndicatorShortName, MetricID, MetricCategoryName, CategoryAttribute) |> 
  dplyr::select(-n) |> 
  gt::gt()
IndicatorID IndicatorShortName MetricID MetricCategoryName CategoryAttribute
1 AF: prevalence 173 40-59 Female
1 AF: prevalence 175 40-59 Male
1 AF: prevalence 187 40-59 Persons

List all indicator data for a given area

To access all indicator data for a given area and time period you can use the cvd_indicator() function. The return from the API includes four sets of data which are grouped together as four tibbles within a named list object. The four tibbles include:

Here we look at ‘3 Centres PCN’ (area ID 1103) for time period 17:

return_list <- cvd_indicator(time_period_id = 17, area_id = 1103) 
return_list |> summary()
#>                   Length Class  Mode
#> indicators        14     tbl_df list
#> metric_categories  7     tbl_df list
#> metric_data       19     tbl_df list
#> timeseries_data    7     tbl_df list

Indicators

We can extract the tibbles using the list$object notation. To illustrate, we obtain the first four indicators from the return_list$indicators list item:

return_list$indicators |> 
  dplyr::select(IndicatorID, IndicatorCode, IndicatorShortName) |> 
  dplyr::arrange(IndicatorID) |> 
  dplyr::slice_head(n = 4) |> 
  gt::gt()
IndicatorID IndicatorCode IndicatorShortName
2 CVDP002HYP Hypertension: treatment to recommended age specific (79 and under) threshold
3 CVDP003HYP Hypertension: treatment to recommended age specific (80 and over) threshold
4 CVDP004HYP Hypertension: BP monitoring
7 CVDP002AF AF: treatment with anticoagulants

Category

Here we access category details for:

  • indicator 7: (AF: treatment with anticoagulants)

  • metric categories 7 & 8 (people aged 40-59 years by gender)

return_list$metric_categories |> 
  dplyr::filter(IndicatorID == 7, MetricCategoryID %in% c(7, 8)) |> 
  dplyr::select(IndicatorID, MetricCategoryTypeName, 
                CategoryAttribute, MetricCategoryName, MetricID) |> 
  gt::gt()
IndicatorID MetricCategoryTypeName CategoryAttribute MetricCategoryName MetricID
7 Age group Male 40-59 126
7 Age group Female 40-59 132

Category data

Here we access the data for each of the above categories:

return_list$metric_data |> 
  dplyr::filter(MetricID %in% c(126, 132)) |>
  dplyr::select(MetricID, Value, Numerator, Denominator) |> 
  gt::gt()
MetricID Value Numerator Denominator
126 100 15 15
132 100 10 10

Time series

A set of time-series data area also supplied for returned metrics, which provide results for all available time periods. This data is accessible from the timeseries_data object.

Here we show the time-series for the two categories of metric shown above as a plot.

return_list$timeseries_data |> 
  dplyr::filter(MetricID %in% c(126, 132), !is.na(Value)) |> 
  # prepare for plotting
  dplyr::mutate(
    EndDate = as.Date(EndDate, format = '%a, %d %b %Y 00:00:00 GMT'),
    MetricID = MetricID |> as.factor()
  ) |> 
  ggplot2::ggplot(ggplot2::aes(
    x = EndDate, 
    y = Value, 
    group = MetricID , 
    colour = MetricID)) +
  ggplot2::geom_point() +
  ggplot2::geom_line()

Tags

Indicators are searchable by one or more Tag, supplied by the optional argument tag_id. Tag ID can be a single ID number or a vector or IDs, shown here as a vector of IDs 12 and 13 (hypertension and blood pressure measures).

return_list <- 
  cvd_indicator(time_period_id = 17, area_id = 3, tag_id = c(3, 4))

return_list$indicators |> 
  dplyr::select(IndicatorID, IndicatorCode, IndicatorShortName) |> 
  dplyr::arrange(IndicatorID) |> 
  dplyr::slice_head(n = 4) |> 
  gt::gt()
IndicatorID IndicatorCode IndicatorShortName
2 CVDP002HYP Hypertension: treatment to recommended age specific (79 and under) threshold
3 CVDP003HYP Hypertension: treatment to recommended age specific (80 and over) threshold
4 CVDP004HYP Hypertension: BP monitoring
11 CVDP001HYP Hypertension: prevalence

See also List indicator tags.

List indicator tags

Indicators have one or more tags that can be used to filter related indicators. To get a list of these tags you can use the cvd_indicator_tags() function

cvd_indicator_tags() |> 
  dplyr::arrange(IndicatorTagID) |> 
  dplyr::slice_head(n = 5) |> 
  gt::gt()
IndicatorTagID IndicatorTagName
1 prevalence
2 atrial fibrillation
3 hypertension
4 blood pressure measures
5 cardiovascular disease

Get meta-data for an indicator

To get details and meta-data for a specific indicator, use the cvd_indicator_details() function, specifying the indicator ID of interest. Meta-data includes details such as copyright information, source of the data, definitions and method of calculating confidence intervals.

cvd_indicator_details(indicator_id = 7) |>
  dplyr::select(IndicatorID, MetaDataTitle, MetaData) |> 
  dplyr::slice_head(n=5) |> 
  gt::gt()
IndicatorID MetaDataTitle MetaData
7 Copyright Produced by Office for Health Improvement and Disparities, and NHS Benchmarking Network. Source: Cardiovascular Disease Prevention Audit (CVDPREVENT), NHS Digital Copyright © 2021, Re-used with the permission of the NHS Digital. All rights reserved
7 Data source Cardiovascular Disease Prevention Audit (CVDPREVENT)
7 Definition The percentage of patients aged 18 and over with GP recorded atrial fibrillation and a record of a CHA2DS2-VASc score of 2 or more who are currently treated with anticoagulation drug therapy
7 Indicator title Patients with high risk atrial fibrillation who are receiving anticoagulation therapy
7 Purpose/rationale Atrial fibrillation (AF) is a major risk factor for stroke and contributes to one in five strokes. Strokes where AF is a contributory factor are often more severe with higher mortality and greater disability. For people with AF who are at most risk of stroke in most cases the benefits of anticoagulation significantly outweigh the risks of bleeding. https://www.stroke.org.uk/professionals/atrial-fibrillation-information-and-resources

Sibling area data

To find performance for sibling areas (areas that share a common parent area, such as GP practices within a PCN or PCNs within an ICB), you can use the cvd_indicator_sibling() function, specifying a time period, area and metric.

Here we get data for Metric 126 (relating to indicator 2- Hypertension treatment) for siblings to ‘3 Centres PCN’ (ID 1103):

cvd_indicator_sibling(time_period_id = 17, area_id = 1103, metric_id = 126) |>
  dplyr::select(AreaID, AreaName, Value, LowerConfidenceLimit, UpperConfidenceLimit) |> 
  gt::gt()
AreaID AreaName Value LowerConfidenceLimit UpperConfidenceLimit
1103 3 Centres PCN 100.00 84.21 100.00
1023 The Valleys Health & Social Care PCN 93.75 73.68 100.00
315 Tolson Care Partnership PCN 90.91 64.29 100.00
709 Spen Health & Wellbeing PCN 90.91 72.00 96.00
523 Dewsbury & Thornhill PCN 88.89 58.33 100.00
607 The Mast PCN 88.89 58.33 100.00
1055 Greenwood PCN 86.67 61.11 94.44
606 Batley Birstall PCN 86.67 61.11 94.44
1334 Viaduct Care PCN 69.23 43.75 87.50

Child area data

To find performance for child areas (areas that are organisationally one level lower than the specified area), you can use the cvd_indicator_child_data() function, specifying a time period, area and metric.

Here we get data for Metric 126 (relating to indicator 17 - Hypertension treatment) for the children of ‘NHS Shropshire, Telford and Wrekin CCG’ (ID 126):

cvd_indicator_child_data(time_period_id = 17, area_id = 74, metric_id = 126) |> 
  dplyr::select(AreaID, AreaName, Value, LowerConfidenceLimit, UpperConfidenceLimit) |> 
  gt::gt()
AreaID AreaName Value LowerConfidenceLimit UpperConfidenceLimit
226 Wrekin PCN 100.00 80.00 100.00
899 Se Shropshire PCN 100.00 88.00 100.00
435 Newport And Central PCN 93.33 72.22 100.00
1373 Shrewsbury PCN 92.31 75.86 96.55
1201 North Shropshire PCN 91.30 73.08 96.15
848 Sw Shropshire PCN 90.91 64.29 100.00
1338 Teldoc PCN 80.00 60.71 89.29
731 South East Telford PCN 77.78 57.14 90.48

All indicator data for a given time and area

Use function cvd_indicator_data() along with the indicator ID and specifying the time period and area to get all metric data. The return includes national level data as comparison.

Here we look at ‘AF: treatment with anticoagulants’ (indicator ID 7) in time period 17 for ‘Leicester Central PCN’ (area_id 701) focussed on metrics by gender:

cvd_indicator_data(time_period_id = 17, indicator_id = 7, area_id = 701) |> 
  dplyr::filter(MetricCategoryTypeName == 'Sex') |> 
  dplyr::select(MetricID, MetricCategoryName, AreaData.AreaName, AreaData.Value, NationalData.AreaName, NationalData.Value) |> 
  gt::gt()
MetricID MetricCategoryName AreaData.AreaName AreaData.Value NationalData.AreaName NationalData.Value
150 Persons Leicester Central PCN 95.40 England 91.48
125 Female Leicester Central PCN 94.67 England 91.17
124 Male Leicester Central PCN 95.96 England 91.74

All metric data for a given time and area

Use function cvd_indicator_metric_data() along with the metric ID and specifying the time period and area to get all data. The return includes national level data as comparison.

Here we retrieve metric data for AF: treatment with anticoagulants for ‘Alliance PCN’ (area ID 399) in time period 1 for metric 126 (breakdown by age group- males aged 40-59):

cvd_indicator_metric_data(metric_id = 126, time_period_id = 1, area_id = 399) |> 
  dplyr::select(IndicatorShortName, CategoryAttribute, MetricCategoryName, AreaData.Value, NationalData.Value) |> 
  gt::gt()
IndicatorShortName CategoryAttribute MetricCategoryName AreaData.Value NationalData.Value
AF: treatment with anticoagulants Male 40-59 NA 82.5

All indicator metric data for system level and time period

Perhaps one of the most useful functions when looking to do a cross-sectional system-wide analysis, cvd_indicator_raw_data() returns all metric data for a specified indicator system level and time period.

Here we return all metric data for indicator ‘AF: treatment with anticoagulants’ (indicator ID 7) in time period 17 at GP practice level (system level ID 5):

cvd_indicator_raw_data(indicator_id = 7, time_period_id = 17, system_level_id = 5) |> 
  dplyr::slice_head(n = 5) |> 
  dplyr::select(AreaCode, AreaName, Value) |> 
  gt::gt()
AreaCode AreaName Value
P87657 (IRLAM) SALFORD CARE CTRS MEDICAL PRACTI 97.01
P87620 1/Monton Medical Practice 92.09
P87004 1/SALFORD MEDICAL PRACTICE 97.37
N84035 15 Sefton Road 87.85
L81051 168 Medical Group 91.84

Benchmark metric data with national results

To return metric data for a given area and time period along with national results to compare against use function cvd_indicator_nationalarea_metric_data().

Here we compare performance against metric 150 (AF: treatment with anticoagulants - all people) in ‘Chester South PCN’ (area ID 553) with national performance:

cvd_indicator_nationalarea_metric_data(metric_id = 150, time_period_id = 17, area_id = 553) |> 
  gt::gt()
AreaCode AreaID AreaName NationalLevel Value TargetData
E92000001 1 England Y 91.48 45
U68943 553 Chester South PCN N 88.57 95

List priority group indicators

Priority groups are collections of Indicators which are displayed in the Regional & ICS insights page of the CVD PREVENT website and can be accessed from the API using the cvd_indicator_priority_groups() function.

Here we return one indicator from each of the priority groups:

cvd_indicator_priority_groups() |>
  dplyr::select(PriorityGroup, PathwayGroupName, PathwayGroupID, IndicatorID, IndicatorName) |>
  dplyr::slice_head(by = PathwayGroupID) |> 
  gt::gt(row_group_as_column = T)
PriorityGroup PathwayGroupName PathwayGroupID IndicatorID IndicatorName
ABC Hypertension 5 4 Percentage of patients aged 18 and over with GP recorded hypertension, who have had a blood pressure reading within the preceding 12 months
ABC Cholesterol 6 22 Percentage of patients aged 18 and over with no GP recorded CVD and a GP recorded QRISK score of 10% or more, on lipid lowering therapy
ABC Atrial Fibrilation 7 7 Percentage of patients aged 18 and over with GP recorded atrial fibrillation and a record of a CHA2DS2-VASc score of 2 or more, who are currently treated with anticoagulation drug therapy
CKD Chronic Kidney Disease 9 29 Percentage of patients aged 18 and over with GP recorded CKD (G3a to G5), with a record of an eGFR test in the preceding 12 months
Prevalence NA NA 12 Prevalence of GP recorded cardiovascular disease (wide definition) in patients aged 18 and over
Prevalence Familial Hypercholesterolaemia 8 9 Prevalence of GP recorded possible, probable or confirmed familial hypercholesterolaemia, all ages
Smoking and BMI Smoking 10 24 Percentage of patients aged 18 and over with GP recorded CVD or CVD risk factors who are GP recorded current smokers or have no smoking status recorded, whose notes record smoking status in the preceding 12 months.

List pathway group indicators

Pathway groups are sub-groupings of Priority Groups visible in the Regional & ICS insights page of the CVD PREVENT website and can be accessed from the API using the cvd_indicator_pathway_group() function.

Here we return the indicators within the ‘Chronic Kidney Disease’ pathway group (ID 9):

cvd_indicator_pathway_group(pathway_group_id = 9) |> 
  dplyr::select(PathwayGroupName, PathwayGroupID, IndicatorCode, IndicatorID, IndicatorName) |>
  dplyr::group_by(PathwayGroupName) |> 
  gt::gt(row_group_as_column = T)
PathwayGroupID IndicatorCode IndicatorID IndicatorName
Chronic Kidney Disease 9 CVDP002CKD 13 Percentage of GP registered patients aged 18 and over, with 2 low eGFRs with no GP recorded CKD (G3a to G5)
9 CVDP001CKD 8 Prevalence of GP recorded CKD (G3a to G5) in patients aged 18 and over
9 CVDP006CKD 29 Percentage of patients aged 18 and over with GP recorded CKD (G3a to G5), with a record of an eGFR test in the preceding 12 months
9 CVDP005CKD 19 Percentage of patients aged 18 and over with GP recorded CKD (G3a to G5), hypertension and proteinuria, currently treated with renin-angiotensin system antagonists
9 CVDP007CKD 31 Percentage of patients aged 18 and over with GP recorded CKD (G3a to G5) with an ACR of less than 70 mg/mmol, in whom the last blood pressure reading (measured in the preceding 12 months) is less than 140/90 mmHg.
9 CVDP010CHOL 23 Percentage of patients aged 18 and over with GP recorded CKD (G3a to G5), who are currently treated with lipid lowering therapy.

List Indicator Group indicators

Indicator Groups are further groups of indicators which are classified by IndicatorGroupTypeID which indicates what type of indicator, e.g. Priority Group.

Here we list the indicators under Indicator Group ID 13 (Monitoring) which lists ‘Key Question’ Indicator Group indicators:

cvd_indicator_group(indicator_group_id = 13) |> 
  dplyr::select(IndicatorGroupID, IndicatorGroupName, IndicatorGroupTypeName, IndicatorID, IndicatorName) |> 
  dplyr::group_by(IndicatorGroupID, IndicatorGroupName) |> 
  gt::gt()
IndicatorGroupTypeName IndicatorID IndicatorName
13 - Monitoring
Key Question 4 Percentage of patients aged 18 and over with GP recorded hypertension, who have had a blood pressure reading within the preceding 12 months
Key Question 29 Percentage of patients aged 18 and over with GP recorded CKD (G3a to G5), with a record of an eGFR test in the preceding 12 months

Return time series data for a metric and area

To get data over all available time points for a given metric use the cvd_indicator_metric_timeseries() function whilst specifying an area ID.

Here we visualise data for Salford South East PCN (area ID 705) for ‘AF: treatment with anticoagulants’ for women people aged 60-79 years (metric ID 130):

cvd_indicator_metric_timeseries(metric_id = 130, area_id = 705) |> 
   # prepare for plotting
  dplyr::mutate(TimePeriodName = stats::reorder(TimePeriodName, TimePeriodID)) |>  
  ggplot2::ggplot(ggplot2::aes(
    x = TimePeriodName,
    y = Value, 
    group = AreaName , 
    colour = AreaName)) +
  ggplot2::geom_point() +
  ggplot2::geom_line() +
  ggplot2::theme(
    axis.text.x = ggplot2::element_text(angle = 45, hjust = 1)
  )

Or we can view the details of the time-series performance for this metric:

cvd_indicator_metric_timeseries(metric_id = 130, area_id = 705) |>
  dplyr::select(AreaName, TimePeriodName, TimePeriodID, Value) |> 
  tidyr::pivot_wider(
    names_from = AreaName,
    values_from = Value
  ) |> 
  gt::gt()
TimePeriodName TimePeriodID England Salford South East PCN
To March 2020 1 88.20 85.90
To March 2021 2 88.60 86.00
To September 2021 3 88.90 88.80
To March 2022 4 89.33 90.00
To June 2022 5 89.37 90.24
To September 2022 6 89.64 90.60
To December 2022 7 89.99 91.72
To March 2023 8 90.97 90.12
To June 2023 9 90.99 90.96
To December 2023 15 91.15 92.22
To March 2024 17 92.21 93.92
To June 2024 18 92.23 92.93

Return time series data for an indicator and area - inequalities

To see time series data for all metric breakdowns for an indicator use the cvd_indicator_person_timeseries() function along with the indicator ID and specify an area.

Here we view time-series metric data for indicator ‘AF: treatment with anticoagulants’ (ID 7) in Salford South East PCN (area ID 705), focussed just on the age group inequalities metrics:

cvd_indicator_person_timeseries(indicator_id = 7, area_id = 705) |> 
  dplyr::filter(
    MetricCategoryTypeName == 'Age group',
    !is.na(Value)
  ) |> 
  dplyr::mutate(TimePeriodName = stats::reorder(TimePeriodName, TimePeriodID)) |>
  ggplot2::ggplot(
    ggplot2::aes(
      x = TimePeriodName,
      y = Value,
      group = MetricCategoryName,
      colour = MetricCategoryName
    )
  ) +
  ggplot2::geom_point() +
  ggplot2::geom_line() +
  ggplot2::theme(
    axis.text.x = ggplot2::element_text(angle = 45, hjust = 1)
  )

Or we can view the details of the time-series performance for these metrics:

cvd_indicator_person_timeseries(indicator_id = 7, area_id = 705) |> 
  dplyr::filter(
    MetricCategoryTypeName == 'Age group',
    !is.na(Value)
  ) |> 
  dplyr::select(MetricCategoryName, TimePeriodName, TimePeriodID, 
                Value) |>
  tidyr::pivot_wider(
    names_from = MetricCategoryName,
    values_from = Value
  ) |> 
  gt::gt()
TimePeriodName TimePeriodID 40-59 60-79 80+
To March 2020 1 78.30 82.30 85.00
To March 2021 2 91.30 82.30 84.80
To September 2021 3 78.00 86.90 87.20
To March 2022 4 76.60 86.81 90.23
To June 2022 5 82.35 86.82 88.56
To September 2022 6 80.00 86.56 90.60
To December 2022 7 76.32 87.50 90.58
To March 2023 8 72.73 87.42 91.06
To June 2023 9 71.11 88.51 91.29
To December 2023 15 74.42 88.94 90.61
To March 2024 17 80.49 91.51 92.45
To June 2024 18 82.93 91.63 92.24

Return system level comparisons for a metric

Use the cvd_indicator_metric_systemlevel_comparison() function to return metric performance for a specified time period for all organisations in the same system level, for example for all GP practices or for all PCNs.

Here we return performance for metric ‘AF: DOAC & VitK’ in people aged 40-59 years (metric ID 1270) in time period 17 for Salford South East PCN (area ID 705) and all other PCNs - truncated to a sample of four PCN performances:

cvd_indicator_metric_systemlevel_comparison(metric_id = 1270, time_period_id = 17, area_id = 705) |> 
  dplyr::filter(AreaID %in% c(705:709), !is.na(Value)) |> 
  dplyr::select(SystemLevelName, AreaID, AreaName, Value) |> 
  gt::gt()
SystemLevelName AreaID AreaName Value
PCN 705 Salford South East PCN 80.49
PCN 707 Haringey - North East PCN 88.00
PCN 708 Teesdale PCN 100.00
PCN 709 Spen Health & Wellbeing PCN 85.71

Metric area breakdown

Use cvd_indicator_metric_area_breakdown() function to return the data Area Breakdown chart.

Here we return performance for metric ‘AF: DOAC & VitK’ in men aged 60-79 years (metric ID 128) in time period 17 for Salford South East PCN (area ID 705):

cvd_indicator_metric_area_breakdown(metric_id = 128, time_period_id = 17, area_id = 705) |> 
  dplyr::select(SystemLevelName, AreaID, AreaName, Value) |> 
  gt::gt()
SystemLevelName AreaID AreaName Value
England 1 England 92.49
PCN 705 Salford South East PCN 90.00

Misc

List external resources

To return a list of all external resources used by the API use function cvd_external_resource(). Here we show the first five external resources:

cvd_external_resource() |> 
  dplyr::filter(ExternalResourceID < 10) |> 
  dplyr::select(ExternalResourceCategory, ExternalResourceSource, ExternalResourceTitle) |> 
  dplyr::group_by(ExternalResourceCategory) |> 
  gt::gt(row_group_as_column = T)
ExternalResourceSource ExternalResourceTitle
Data Packs Public Health England Cardiovascular Disease Prevention Data Packs
NHS England Equality and Health Inequality Packs
Toolkits NHS Digital Weight Management Programme General Practice Toolkit
Primary Care Cardiovascular Society CVD – identification and treatment of people at high risk
Stratification tools UCL Partners Search and risk stratification tools

Show data availability

To show data availability for a given system level in a given time period then use the cvd_data_availability() function.

NB, data appears to be only available up to time period 6 (to September 2022).

cvd_data_availability(time_period_id = 6, system_level_id = 5) |>
  dplyr::select(IndicatorShortName, IsAvailable, SystemLevelName, MetricCategoryTypeID) |> 
  dplyr::slice_head(n = 5) |> 
  gt::gt()
IndicatorShortName IsAvailable SystemLevelName MetricCategoryTypeID
AF: prevalence N Practice 4
AF: prevalence N Practice 2
AF: prevalence N Practice 1
AF: prevalence N Practice 3
Hypertension: treatment to recommended age specific (79 and under) threshold Y Practice 4