Skip to contents

Returns all areas for a given time period and parent area or system level. Only areas which have data for the specified time period will be returned.

Usage

cvd_area_list(time_period_id = 1, parent_area_id, system_level_id)

Arguments

time_period_id

integer - specifies time period for which to return areas (compulsory)

parent_area_id

integer - specifies the area of which children will be returned (optional)

system_level_id

integer - specifies which system levels to return areas for (optional)

Value

Tibble of area details

Details

Either parent area or system level must be specified: If parent area is specified, all children areas of that parent will be returned. If system level is specified, all areas within that system level will be returned.

Parent area takes precedence over system level - if parent area is specified, system level is ignored.

CVD Prevent API documentation: Area lists

Examples

# list four PCNs with data available at time period 17
cvd_area_list(time_period_id = 17, system_level_id = 4) |>
  dplyr::select(SystemLevelName, AreaID, AreaCode, AreaName) |>
  dplyr::slice_head(n = 4)
#> # A tibble: 4 × 4
#>   SystemLevelName AreaID AreaCode AreaName       
#>   <chr>            <int> <chr>    <chr>          
#> 1 PCN               1103 U60176   3 Centres PCN  
#> 2 PCN               1103 U60176   3 Centres PCN  
#> 3 PCN                920 U72999   4 Doncaster PCN
#> 4 PCN                920 U72999   4 Doncaster PCN