
Retrieve details for a specific NHS area and time period
Source:R/cvd_api_functions.R
cvd_area_details.RdReturns detailed information about a single NHS area for a given reporting period, including its own details, as well as any parent and child areas. This allows you to understand the heirarchical context (e.g., parent ICB, child PCNs or Practices) for the specified area.
Arguments
- time_period_id
Integer (required). The reporting period for which area details should be returned. Use
cvd_time_period_list()to find valid IDs.- area_id
Integer (required). The AreaID to return details for. Use
cvd_area_list()orcvd_area_search()to find valid IDs.
Value
A named list with up to three tibbles:
- area_details
A tibble with details about the specified area.
- area_parent_details
A tibble with details about the parent area(s), if available.
- area_child_details
A tibble with details about child area(s), if available.
If no data is found, returns a tibble describing the error.
area_details, area_parent_details and area_child_details typically contain the following columns:
- AreaCode
Character. ONS or internal code for the NHS area (e.g., "E54000015").
- AreaID
Integer. Unique identifier for the NHS area.
- AreaName
Character. Full name of the NHS area (e.g., "NHS Leicester, Leicestershire and Rutland Integrated Care Board").
- AreaOdsCode
Character. ODS (Organisation Data Service) code for the area (e.g., "QK1").
- SystemLevelID
Integer. Unique identifier for the system level (e.g., 7 = ICB).
- SystemLevelName
Character. Name of the system level (e.g., "ICB").
Details
This function is useful for navigating NHS area heirarchies, such as finding all practices within a PCN, or determining the parent ICB for a given area. The result is a list of tibbles, so you can extract and work with each component separately.
Examples
# \donttest{
# Retrieve details for 'Leicester, Leicestershire and Rutland ICB' (area_id = 8037)
# in time period 17
returned_list <- cvd_area_details(time_period_id = 17, area_id = 8037)
# View details for the area
returned_list$area_details |> dplyr::select(AreaCode, AreaName)
#> # A tibble: 1 × 2
#> AreaCode AreaName
#> <chr> <chr>
#> 1 E54000015 NHS Leicester, Leicestershire and Rutland Integrated Care Board
# View details for the parent area(s)
returned_list$area_parent_details |> dplyr::select(AreaID, AreaName, SystemLevelID)
#> # A tibble: 1 × 3
#> AreaID AreaName SystemLevelID
#> <int> <chr> <int>
#> 1 7922 Midlands 6
# View details for the child area(s)
returned_list$area_child_details |> dplyr::select(AreaID, AreaName, SystemLevelID)
#> # A tibble: 3 × 3
#> AreaID AreaName SystemLevelID
#> <int> <chr> <int>
#> 1 7994 NHS Leicester, Leicestershire and Rutland ICB - 03W 8
#> 2 8009 NHS Leicester, Leicestershire and Rutland ICB - 04C 8
#> 3 8014 NHS Leicester, Leicestershire and Rutland ICB - 04V 8
# }