Skip to content

Commit

Permalink
Merge branch 'master' into remove_whitespace_ui
Browse files Browse the repository at this point in the history
  • Loading branch information
cjrace authored Jul 10, 2024
2 parents 0ce3f53 + 1f7de20 commit f1fbd73
Show file tree
Hide file tree
Showing 5 changed files with 8,830 additions and 61 deletions.
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
Hey, thanks for raising a PR! We're excited to see what you've done!
To help us review the changes, please complete each section in this template by replacing '...' with details to help the reviewers of this pull request.
-->

# Brief overview of changes

...

## Why are these changes being made?

...

## Detailed description of changes

...

## Additional information for reviewers

...

## Issue ticket number/s and link

...
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Code for updating geography lookups =================================
# source functions and dependencies

source("R/standard-data-prep/utils.R")
source("R/manual_scripts/utils.R")

# PCON LA =====================================================================
# Ward PCON LAD LA ============================================================
# Download latest from: https://geoportal.statistics.gov.uk/search?q=LUP_WPC&sort=Date%20Created%7Ccreated%7Cdesc
# ...and save into /data/downloaded_source_data
# Then add the file path into the function below to update the lookup to
Expand All @@ -12,11 +12,11 @@ source("R/standard-data-prep/utils.R")
# Last title of file used on Open Geography Portal (in case it's helpful):
# Ward to Westminster Parliamentary Constituency to Local Authority District to UTLA

# Files used so far: 2017, 2019, 2020, 2021, 2022, 2023
# Files used so far: 2017, 2019, 2020, 2021, 2022, 2023, 2024

write_updated_lookup(
new_lookup = tidy_downloaded_lookup(
open_geography_file = "data/downloaded_source_data/2023.csv",
open_geography_file = "data/downloaded_source_data/Ward_to_Westminster_Parliamentary_Constituency_to_LAD_to_UTLA_(July_2024)_Lookup_in_UK.csv",
shorthand_lookup = open_geog_shorthand_lookup
),
lookup_filepath = "data/ward_lad_la_pcon_hierarchy.csv"
Expand Down
3 changes: 2 additions & 1 deletion R/standard-data-prep/utils.R → R/manual_scripts/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ tidy_downloaded_lookup <- function(
shorthand_lookup) {
# Read in the downloaded open geography file --------------------------------
message("Reading in new data from: ", open_geography_file)
new_data <- read_csv(open_geography_file, show_col_types = FALSE)
new_data <- read_csv(open_geography_file, show_col_types = FALSE) %>%
select(-ends_with("NMW")) # remove Welsh name cols

# Extract the year from columns ---------------------------------------------
new_year <- names(new_data) %>%
Expand Down
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,14 @@ There is a GitHub action workflow that automatically runs this against PRs to en

The standard geographies used in this tool are sourced from (or developed with) the Office for National Statistics (ONS). As such, they are maintained in line with the ONS's [open geography portal](https://geoportal.statistics.gov.uk/).

#### Updating pcon_la or lad_lsip lookups
#### Updating ward_pcon_lad_la or lad_lsip lookups

There's an R script in the R/standard-data-prep folder containing functions to update both the pcon_la and lad_lsip lookups. To use this, download the latest version of the file from the searches linked in the comments of that script, and then save a copy of that data in a new folder called /data/downloaded_source_data/. The functions will then append any new data from that CSV into the lookup files.
There's an R script in the `R/manual_scripts/` folder containing functions to update both the geography lookups. To use this, download the latest version of the file from the searches linked in the comments of that script, and then save a copy of that data in a new folder called `/data/downloaded_source_data/`. The functions will then append any new data from that CSV into the lookup files.

#### Local skills improvement plan area (LSIP)

These were developed in direct communications with the ONS ([ONS Geography e-mail](mailto:[email protected])) and they provided the basis for the code and name file used in this tool. At the time of writing, this has not been added to the open geography portal, although boundary files have been ([LSIP boundary map files](https://geoportal.statistics.gov.uk/search?collection=Dataset&sort=name&tags=all(BDY_LSIP%2CAUG_2023))).

#### Wards

The Ward to LAD lookup has been downloaded from the [Open Geography Portal administrative lookups](https://geoportal.statistics.gov.uk/search?q=LUP_WD_LAD&sort=Title%7Ctitle%7Cdesc).

For example, in March 2024 we downloaded and used the 'Ward to Local Authority District (May 2023) Lookup in the United Kingdom' data set.

#### PCon 2024 lookup

We have recently added a lookup including provisional 2024 Parliamentary Constituency boundaries. This is available in the `data/pcon_2024_v2.csv` file, and further information on that file can be found on the [Open Geography Portal](https://geoportal.statistics.gov.uk/datasets/ons::postcode-to-new-westminster-parliamentary-constituencies-may-2024-lookup-in-the-uk/about).

Long term we aim to remove this and instead update the Ward > PCon > LAD > LA lookup once that is released by ONS.

---

## Contact
Expand Down
Loading

0 comments on commit f1fbd73

Please sign in to comment.