Skip to contents

Returns national and area data for the provided metric, area, and time period.

Usage

cvd_indicator_nationalarea_metric_data(
  metric_id = 1,
  time_period_id = 17,
  area_id = 739
)

Arguments

metric_id

integer - metric for which to return data (compulsory)

time_period_id

integer - time period for which to return data (compulsory)

area_id

integer - area for which to return data (compulsory)

Value

List of named tibbles (area, target) where target is only provided if data is available.

Details

The returned object is a list containing named tibbles. The two possible tibbles are:

  • area: contains metric data for the specified area in comparison with national metric data.

  • target: contains details on how to reach target values, including:

    • target value as a percentage (stored as a whole number up to 100)

    • target patients (the number of additional patients needed to reach the target percentage)

Note that the target tibble is only provided if data is available for both national and the chosen area.

CVD Prevent API documentation: Indicator national vs area metric data

Examples

# Compare performance against metric 150  (AF: treatment with anticoagulants
# - all people) in 'Chester South PCN' (area ID 553) with national
# performance:
return_list <- cvd_indicator_nationalarea_metric_data(
    metric_id = 150,
    time_period_id = 17,
    area_id = 553
)

# See what the list contains
return_list |> summary()
#>        Length Class  Mode
#> area   7      tbl_df list
#> target 3      tbl_df list

# Extract the `area` details
area_data <- return_list$area
area_data |> gt::gt()
AreaCode AreaID AreaName HighestPriorityNotificationType NationalLevel NotificationCount Value
E92000001 1 England NA Y 0 91.48
U68943 553 Chester South PCN NA N 0 88.57
# Extract `target` details target_data <- return_list$target target_data |> gt::gt()
TargetLabel TargetPatients TargetValue
Upper threshold for QOF 45 95