
Check local authority code and name combinations
Source:R/check_geog_combos.R
check_geog_la_combos.RdChecks that all old_la_code, new_la_code, and la_name combinations in the data file are valid against the standard geographies lookup.
Details
No geographic_level distinction is made (unlike most other geography checks). All rows are filtered the same way before checking: rows where old_la_code is NA are excluded, and rows where new_la_code is "x" (the GSS not-available code) are excluded. All remaining combinations — including those with blank or NA new_la_code — are checked and will fail if not found in the lookup.
Rows where old_la_code is "z" combined with a valid
acceptable_extra_geog_options entry are also accepted, to accommodate
geographies that have no old LA code.
The restricted_level parameter is not used here because the
old_la_code NA filter only applies when restricted_level is NULL. If
"Local authority" were set as the restricted level, LA-level rows with a
NA old_la_code would be checked without that filter and incorrectly fail,
since not all LAs have an old code.
If any of the three LA columns is absent from the data, the check passes immediately.
See also
Other check_geog:
check_geog_country_combos(),
check_geog_eda_combos(),
check_geog_ignored_rows(),
check_geog_la_col_present(),
check_geog_lad_combos(),
check_geog_lep_combos(),
check_geog_level_completed(),
check_geog_lsip_combos(),
check_geog_na(),
check_geog_na_code(),
check_geog_other_code_dupes(),
check_geog_other_dupes(),
check_geog_overcompleted_cols(),
check_geog_pcon_combos(),
check_geog_region_col_present(),
check_geog_region_combos(),
check_geog_region_for_la(),
check_geog_region_for_lad(),
check_geog_ward_combos()
Examples
check_geog_la_combos(example_data)
#> check result
#> 1 geog_la_combos PASS
#> message
#> 1 At least one of the old_la_code / new_la_code / la_name columns is not present in this data file.
#> guidance_url
#> 1 NA
check_geog_la_combos(example_data, verbose = TRUE)
#> ✔ At least one of the old_la_code / new_la_code / la_name columns is not present in this data file.
#> check result
#> 1 geog_la_combos PASS
#> message
#> 1 At least one of the old_la_code / new_la_code / la_name columns is not present in this data file.
#> guidance_url
#> 1 NA