From dcde077896d223e7ec80db563d9af279265397cf Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 16 Dec 2024 09:58:04 +0000 Subject: [PATCH 01/24] First draft completed - internet-access First draft completed - internet-access, styled and rendered --- R/data.R | 18 ++++++++++++++ data-raw/healthy-places/internet-access.R | 24 +++++++++++++++++++ data/places_internet_access.rda | Bin 0 -> 293 bytes man/places_internet_access.Rd | 28 ++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-places/internet-access.R create mode 100644 data/places_internet_access.rda create mode 100644 man/places_internet_access.Rd diff --git a/R/data.R b/R/data.R index 327711a..8ab70d9 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,24 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Percentage of Households without Internet Access (2021/22) +#' +#' A dataset containing statistics on the percentage of households without +#' internet access in Northern Irish Council Areas. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{no_internet_access_percentage}{Percentage of households without access +#' to the internet} +#' \item{year}{Financial Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"places_internet_access" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-places/internet-access.R b/data-raw/healthy-places/internet-access.R new file mode 100644 index 0000000..f8cc3bc --- /dev/null +++ b/data-raw/healthy-places/internet-access.R @@ -0,0 +1,24 @@ +# ---- Load packages ---- +library(tidyverse) + +# ---- Get data ---- +# Internet access +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/HHIBALGD/CSV/1.0/" +internet_access_raw <- read_csv(url) + +places_internet_access <- internet_access_raw |> + filter( + `Financial Year` == "2021/22", + `Statistic Label` == "Households with Home Internet Access: No", + `LGD2014` != "N92000002" + ) |> + select( + ltla24_code = `LGD2014`, + no_internet_access_percentage = VALUE, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(places_internet_access, overwrite = TRUE) diff --git a/data/places_internet_access.rda b/data/places_internet_access.rda new file mode 100644 index 0000000000000000000000000000000000000000..78f27e6b00a7aca3bc85d1438fb4e963b726e47b GIT binary patch literal 293 zcmV+=0owjTT4*^jL0KkKSx8Czb^rl5|G@vdNd{F#|KLOc5J11D+@L@J0s*i9<}4*7 zO{s~dAYuWa0002mf+^}F2w+T11j(jM0T@h}Ac{zlv=eG*3{4DbXbl>AMuC$o&n(kR zGQ~>xR(wLlk``lAibN5zM!erpw$2Qpq)##n*U~BKk*y|t`HjxYaRq}z?owl^6 r6lE3|LU$AP8e|bPae~Y;yoG3^nB>p=9&%uC< literal 0 HcmV?d00001 diff --git a/man/places_internet_access.Rd b/man/places_internet_access.Rd new file mode 100644 index 0000000..11039a8 --- /dev/null +++ b/man/places_internet_access.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{places_internet_access} +\alias{places_internet_access} +\title{Percentage of Households without Internet Access (2021/22)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{no_internet_access_percentage}{Percentage of households without access +to the internet} +\item{year}{Financial Year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +places_internet_access +} +\description{ +A dataset containing statistics on the percentage of households without +internet access in Northern Irish Council Areas. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 5e8f1a7..d8cce60 100644 --- a/metadata.md +++ b/metadata.md @@ -68,6 +68,6 @@ | Healthy Places | Neighbourhood noise | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: TO DO | :x: | -| Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | +| Healthy Places | Internet access | 2021/22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of households without access to the internet at home. | :heavy_check_mark:| | Healthy Places | Transport noise: Daytime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: - Separate data was not available for day & night, so just one metric has been used | :heavy_check_mark: | | Healthy Places | Transport noise: Nighttime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: - Separate data was not available for day & night, so just one metric has been used | :heavy_check_mark: | From 86b6f71a3dc3b8d287b2d7ad0760bb7f1282fbd1 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 17 Dec 2024 09:39:04 +0000 Subject: [PATCH 02/24] First draft completed - air-pollution First draft completed - air-pollution. Code updated from original script, styled and rendered. --- R/data.R | 16 +++++++++++ data-raw/healthy-places/air-pollution.R | 34 +++++++++++++++--------- data/places_air_pollution.rda | Bin 0 -> 380 bytes man/places_air_pollution.Rd | 27 +++++++++++++++++++ metadata.md | 2 +- 5 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 data/places_air_pollution.rda create mode 100644 man/places_air_pollution.Rd diff --git a/R/data.R b/R/data.R index 327711a..a8336fb 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,22 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Air pollution (2019) +#' +#' A dataset containing population-weighted annual mean PM2.5 data for 2019, by +#' Northern Irish Council Area. Uses the anthropogenic component. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{air_pollution_weighted}{Population-weighted annual mean PM2.5} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://uk-air.defra.gov.uk/data/pcm-data} +"places_air_pollution" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-places/air-pollution.R b/data-raw/healthy-places/air-pollution.R index a9bf171..9b28593 100644 --- a/data-raw/healthy-places/air-pollution.R +++ b/data-raw/healthy-places/air-pollution.R @@ -1,13 +1,15 @@ +# ---- Load packages ---- library(tidyverse) library(geographr) -# Lookup -lookup <- - boundaries_lad |> - select(-geometry) |> - st_drop_geometry() |> - filter(str_detect(lad_code, "^N")) +# ---- Get data ---- +# LA Codes +ltla_lookup <- lookup_ltla_ltla |> + filter(str_detect(ltla23_code, "N")) |> + select(ltla23_code, ltla23_name) + +# Air Pollution # Source: https://uk-air.defra.gov.uk/data/pcm-data air_pollution_raw <- read_csv( @@ -19,14 +21,20 @@ air_pollution_raw <- air_pollution <- air_pollution_raw |> select( - lad_name = `Local Authority`, + ltla23_name = `Local Authority`, air_pollution_weighted = `PM2.5 2019 (anthropogenic)` ) -# Join -air_pollution <- - lookup |> - left_join(air_pollution, by = "lad_name") |> - select(-lad_name) +# Join datasets +places_air_pollution <- + ltla_lookup |> + left_join(air_pollution, by = "ltla23_name") |> + select( + ltla24_code = ltla23_code, + air_pollution_weighted, + -ltla23_name + ) |> + mutate(year = "2019") -write_rds(air_pollution, "data/vulnerability/health-inequalities/northern-ireland/healthy-places/air-pollution.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(places_air_pollution, overwrite = TRUE) diff --git a/data/places_air_pollution.rda b/data/places_air_pollution.rda new file mode 100644 index 0000000000000000000000000000000000000000..ac81542ca8bba3b7a1552d2dbb715892dafbf4c1 GIT binary patch literal 380 zcmV-?0fYWRT4*^jL0KkKS;~#l<^Ta0|Ns9x|APimf8kU?5K_PI-lIT703ZNCg5iiM z5CuVD0x7To7+Mh&13(P`00003KmarV20+p3Xd?SoPzEYR+C@~3$k;OrRErOjevv8UfzcR>5P)igAlgK4BI|#;N+#BJ zR$n#5Ag^l9Q?nB7ik8CbWTC2ngcQYOz<_}Bn7oCMZ`92!HStfRh^rVJ2qFb Date: Tue, 17 Dec 2024 11:21:20 +0000 Subject: [PATCH 03/24] First draft completed - road-safety First draft completed - road-safety, styled and rendered. --- R/data.R | 16 ++++++++ data-raw/healthy-places/road-safety.R | 51 ++++++++++++++++++++++++++ data/places_road_safety.rda | Bin 0 -> 319 bytes man/places_road_safety.Rd | 27 ++++++++++++++ metadata.md | 2 +- 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-places/road-safety.R create mode 100644 data/places_road_safety.rda create mode 100644 man/places_road_safety.Rd diff --git a/R/data.R b/R/data.R index 327711a..31056f8 100644 --- a/R/data.R +++ b/R/data.R @@ -285,6 +285,22 @@ #' "places_personal_crime" +#' Road safety (2023) +#' +#' A dataset containing number of people killed or seriously injured in each +#' Northern Irish Council Area in 2023 (latest available data). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{road_accident_count}{Number of people killed or seriously injured, per Local Authority} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://www.psni.police.uk/about-us/our-publications-and-reports/official-statistics/road-traffic-collision-statistics} +"places_road_safety" + #' Rate of Self-Harm Related Admissions per 100,000 (2018/19-2022/23) #' #' A dataset containing statistics on the rate of self-harm related admissions diff --git a/data-raw/healthy-places/road-safety.R b/data-raw/healthy-places/road-safety.R new file mode 100644 index 0000000..45d2f41 --- /dev/null +++ b/data-raw/healthy-places/road-safety.R @@ -0,0 +1,51 @@ +# ---- Load packages ---- +library(tidyverse) +library(geographr) +library(readxl) + +# ---- Get data and clean ---- +# LA Codes +ltla_lookup <- lookup_ltla_ltla |> + filter(str_detect(ltla23_code, "N")) |> + select(ltla23_code, ltla23_name) + +# Road Safety Data +# Source: https://www.psni.police.uk/about-us/our-publications-and-reports/official-statistics/road-traffic-collision-statistics + +url <- "https://www.psni.police.uk/sites/default/files/2024-03/2023%20Key%20Statistics%20tables.xlsx" +temp_file <- tempfile(fileext = ".xlsx") +download.file(url, temp_file, mode = "wb") + +road_safety_raw <- read_excel(temp_file, sheet = 6, skip = 5) + +road_safety <- road_safety_raw |> + select( + ltla23_name = `Area`, + accident_count = `Total...11` + ) |> + slice(1:11) |> + mutate( + ltla23_name = ltla23_name |> + str_replace_all("&", "and") |> + str_replace_all("Belfast City", "Belfast") |> + str_replace_all("Lisburn & Castlereagh City", "Lisburn and Castlereagh") + ) + +# Join datasets +places_road_safety <- ltla_lookup |> + left_join(road_safety, by = "ltla23_name") |> + mutate( + accident_count = case_when( + is.na(accident_count) & ltla23_code == "N09000007" ~ 615, + TRUE ~ accident_count + ), + year = "2023" + ) |> + select( + ltla24_code = ltla23_code, + road_accident_count = accident_count, + year + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(places_road_safety, overwrite = TRUE) diff --git a/data/places_road_safety.rda b/data/places_road_safety.rda new file mode 100644 index 0000000000000000000000000000000000000000..f2957da80df57d92ac53dd86d032afb77a48d820 GIT binary patch literal 319 zcmV-F0l@x3T4*^jL0KkKS=TB)xv8(9_TwGziGkC#j~&Z%{=~Q_-aK5vH1Hh{(}|XvDyV znlfYrl8`je000000000}an#6vQw1OK2U-J{!rWz-HULCn93Nh4Rbiq0D+rBLCs*Iz z!2mWeLQl)3X|Xlf;g=>^u=Z`Q1a1qe0e}Et6p@l-41vI4e9kfuEixQH`G;HX&eI-1 z6OtjMYe;_{7|~*+I*{|J5C&!Kiim=uTT{E{L_zdF24A`TuX;;SjNZIPNNbfJasXTeg|7er literal 0 HcmV?d00001 diff --git a/man/places_road_safety.Rd b/man/places_road_safety.Rd new file mode 100644 index 0000000..6db758a --- /dev/null +++ b/man/places_road_safety.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{places_road_safety} +\alias{places_road_safety} +\title{Road safety (2023)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{road_accident_count}{Number of people killed or seriously injured, per Local Authority} +\item{year}{Year} + +... +} +} +\source{ +\url{https://www.psni.police.uk/about-us/our-publications-and-reports/official-statistics/road-traffic-collision-statistics} +} +\usage{ +places_road_safety +} +\description{ +A dataset containing number of people killed or seriously injured in each +Northern Irish Council Area in 2023 (latest available data). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 9641652..9c1d8e5 100644 --- a/metadata.md +++ b/metadata.md @@ -67,7 +67,7 @@ | Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). Need to contact aeqteam@daera-ni.gov.uk and ask for raw data in Figure 1 of report | :heavy_exclamation_mark: | -| Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | +| Healthy Places | Road Safety | 2023 | [PSNI](https://www.psni.police.uk/about-us/our-publications-and-reports/official-statistics/road-traffic-collision-statistics)| [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Number of people seriously injured or killed by Local Authority area. | :heavy_check_mark: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | | Healthy Places | Transport noise: Daytime | 2017 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | From c8c2de1d0a3e5d21b5dfc2f0612dabf322ba607e Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 7 Jan 2025 11:29:22 +0000 Subject: [PATCH 04/24] First draft completed - high-blood-pressure First draft completed - high-blood-pressure, styled and rendered. Prevalence per 1k converted to % --- R/data.R | 18 ++++++++++++ data-raw/healthy-lives/high-blood-pressure.R | 27 ++++++++++++++++++ data-raw/healthy-lives/hypertension.R | 26 ----------------- data/lives_high_blood_pressure.rda | Bin 0 -> 500 bytes man/lives_high_blood_pressure.Rd | 28 +++++++++++++++++++ metadata.md | 2 +- 6 files changed, 74 insertions(+), 27 deletions(-) create mode 100644 data-raw/healthy-lives/high-blood-pressure.R delete mode 100644 data-raw/healthy-lives/hypertension.R create mode 100644 data/lives_high_blood_pressure.rda create mode 100644 man/lives_high_blood_pressure.Rd diff --git a/R/data.R b/R/data.R index 327711a..f4c40c4 100644 --- a/R/data.R +++ b/R/data.R @@ -35,6 +35,24 @@ #' "lives_gsce_attainment" +#' Percentage of Adults Diagnosed with High Blood Pressure (2023-2024) +#' +#' A dataset containing statistics on percentage of adults diagnosed with high +#' blood pressure, by Council (2023-2024). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{high_blood_pressure_percentage}{Percentage of adults diagnosed with +#' high blood pressure} +#' \item{year}{Time period - Financial year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"lives_high_blood_pressure" + + #' Percentage of Babies Born Not at a Healthy Birth Weight (2022-2023) #' #' A dataset containing percentage babies born not at a healthy birth weight. diff --git a/data-raw/healthy-lives/high-blood-pressure.R b/data-raw/healthy-lives/high-blood-pressure.R new file mode 100644 index 0000000..0e49167 --- /dev/null +++ b/data-raw/healthy-lives/high-blood-pressure.R @@ -0,0 +1,27 @@ +# ---- Load packages ---- +library(tidyverse) + +# ---- Get and clean data ---- +# High Blood Pressure Data +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +high_blood_pressure_raw <- read_csv(url) + +lives_high_blood_pressure <- high_blood_pressure_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Disease` == "Hypertension", + `Financial Year` == "2023/24", + `LGD2014` != "N92000002" + ) |> + rowwise() |> + mutate(high_blood_pressure_percentage = VALUE / 10) |> + select( + ltla24_code = LGD2014, + high_blood_pressure_percentage, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_high_blood_pressure, overwrite = TRUE) diff --git a/data-raw/healthy-lives/hypertension.R b/data-raw/healthy-lives/hypertension.R deleted file mode 100644 index 0b53fdb..0000000 --- a/data-raw/healthy-lives/hypertension.R +++ /dev/null @@ -1,26 +0,0 @@ -library(tidyverse) -library(httr) -library(readODS) - -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Disease%20Prevalence%20(Quality%20Outcomes%20Framework)%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) - -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "A4:AL15" - ) - -hypertension <- - raw |> - as_tibble() |> - select( - lad_code = `LGD2014 Code`, - hypertension_per_1000 = `Hypertension Register: Raw Prevalence per 1,000 patients` - ) - -# Save -write_rds(hypertension, "data/vulnerability/health-inequalities/northern-ireland/healthy-lives/hypertension.rds") \ No newline at end of file diff --git a/data/lives_high_blood_pressure.rda b/data/lives_high_blood_pressure.rda new file mode 100644 index 0000000000000000000000000000000000000000..b5d199b85b9de5b30261eadefe12e0fc936bbcd1 GIT binary patch literal 500 zcmV@T4*^jL0KkKSxBkn>;M7G|NsC0N?}25|KL=sFh{@V-|#|!fC>VE5Kt9> z6aXkF+5@lwk%j>(Nrs`I)b$%lrkOGT&}bPAG62v3(007WPsWd|-MnC`nG&BGPfM^W>000>YKrDnJ1!Z%BxyDeekwTydg%FT| z04RVpjSy~xB7BuH)lG!RZBtvO1w@?qgxY(l$SeUN$ZEn7Q5|B2puql}zZ^}G>Lfr& zCtODy!XDRxA3q6|xOk4m#>by0bi0*ULt8Ngb3mgcfwaIBv4~9s0)c~A;|N(1f=ULG z0&@kZ<}nbNkR*wP;6Q}t$gcoR2?bEpu!M{YINT~X_s-ntMJ;oMb z>0m2~*?nymhQ$>|^`xor%vHXvB_k_|L>mPAXM{2(Y?7OZnhrNr{bkLFffhuT$S@%p z0Y*Z|`GCt^geA!%noUc7B$k-!v`L1j_+S+#RV5LeLowfxy;_94RR^Uu_j$QG`?zmB qeY-pL7H(ZBe`sHK1?(6eFyeH@D#&Zim@o?;;_gVN3K9twJiUNjj?b Date: Tue, 7 Jan 2025 11:49:20 +0000 Subject: [PATCH 05/24] First draft completed - cancer First draft completed - cancer, styled and rendered. Prevalence per 1k converted to %. --- R/data.R | 16 ++++++++++++++++ data-raw/healthy-people/cancer.R | 25 ------------------------- data/people_cancer.rda | Bin 0 -> 483 bytes man/people_cancer.Rd | 26 ++++++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 data/people_cancer.rda create mode 100644 man/people_cancer.Rd diff --git a/R/data.R b/R/data.R index 327711a..f0c5405 100644 --- a/R/data.R +++ b/R/data.R @@ -179,6 +179,22 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_anxiety" +#' Cancer Registrations Percentage (2023-2024) +#' +#' A dataset containing statistics on cancer registration percentages, per +#' Council (2023-2024). +#' +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{cancer_percentage}{Percentage of people with cancer per Council} +#' \item{year}{Time period - Financial year} +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"people_cancer" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/cancer.R b/data-raw/healthy-people/cancer.R index 72bff33..e69de29 100644 --- a/data-raw/healthy-people/cancer.R +++ b/data-raw/healthy-people/cancer.R @@ -1,25 +0,0 @@ -library(tidyverse) -library(httr) -library(readODS) - -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Disease%20Prevalence%20(Quality%20Outcomes%20Framework)%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) - -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:AL15" - ) - -cancer <- - raw |> - as_tibble() |> - select( - lad_code = `LGD2014 Code`, - cancer_per_1000_patients = `Cancer Register: Raw Prevalence per 1,000 patients` - ) - -write_rds(cancer, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/cancer.rds") \ No newline at end of file diff --git a/data/people_cancer.rda b/data/people_cancer.rda new file mode 100644 index 0000000000000000000000000000000000000000..a586d41b3db8727af5413b988994072470254355 GIT binary patch literal 483 zcmV<90UZ89T4*^jL0KkKS@!uRH2?w3|L_0*c>o1T|KP+SkVU`e-{fe5qQF29P!R$m zfFlBdumO>UfRzxZk*WHV(^F4LA7R!E^x1VV^N zK!6lL8pepWq+JOqOK&u2$AZ#~Mg>H#2Tf~{I>qQDJq^G@ExBo^Y7EOakEG_w1ri`6 z6TT==qC^`2L?_K9~_JK}G18IOOk%&zM1qKafu!|-zNkM|H z!$qVqxmg5+HVNxORudRDPQ$4fpjcf}FN|ybp2KvnmrWz)!u0@DNR=aPA~+Xw$WXjU zvPjrSl5Lof+ulqjq+*|I7O!44@cM3_Sbj-x1CD0T|?@3V-Kb=KtB?k~-edTsn1@Qc2NXS(&8C!%Z< Z&`eQcFw@Ie*ff8Oxgwk>NPB#f8h}xL)nEVs literal 0 HcmV?d00001 diff --git a/man/people_cancer.Rd b/man/people_cancer.Rd new file mode 100644 index 0000000..c7d9d99 --- /dev/null +++ b/man/people_cancer.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_cancer} +\alias{people_cancer} +\title{Cancer Registrations Percentage (2023-2024)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{cancer_percentage}{Percentage of people with cancer per Council} +\item{year}{Time period - Financial year} +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_cancer +} +\description{ +A dataset containing statistics on cancer registration percentages, per +Council (2023-2024). +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 9641652..d168570 100644 --- a/metadata.md +++ b/metadata.md @@ -41,7 +41,7 @@ | Healthy People | Anxiety | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of anxiety out of 10. | :heavy_check_mark: | | Healthy People | Life Satisfaction | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of life satisfaction out of 10.| :heavy_check_mark: | | Healthy People | Life Worthwhileness | 2022-23 | [ONS](https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4) | [OGL3](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) | :heavy_check_mark: Indicator: Average personal ratings on feelings of life worthwhileness out of 10. | :heavy_check_mark: | -| Healthy People | Cancer | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. | :x: | +| Healthy People | Cancer | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of people with cancer| :heavy_check_mark: | | Healthy People | Cardiovascular Conditions: Atrial Fibrillation | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | | Healthy People | Cardiovascular Conditions: CHD | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | | Healthy People | Cardiovascular Conditions: Heart Failure | 2021 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :x: This indicator not overtly present in or acting as a substitute for a similar indicator in England's Health Index. To check at the end.| :x: | From 3d3bafae208ae2e032b67876d26fc378a18bef6f Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 7 Jan 2025 12:20:55 +0000 Subject: [PATCH 06/24] First draft completed - dementia First draft completed - dementia, styled and rendered. Prevalence per 1k converted to %. --- R/data.R | 17 +++++++++++++ data-raw/healthy-people/dementia.R | 38 +++++++++++++++-------------- data/people_dementia.rda | Bin 0 -> 480 bytes man/people_dementia.Rd | 28 +++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 data/people_dementia.rda create mode 100644 man/people_dementia.Rd diff --git a/R/data.R b/R/data.R index 327711a..45e08a9 100644 --- a/R/data.R +++ b/R/data.R @@ -179,6 +179,23 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_anxiety" +#' Percentage of People with Dementia +#' +#' A dataset containing statistics on the percentage of people medically +#' diagnosed with dementia, by Council (2023-24). +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{dementia_percentage}{Percentage of people medically diagnosed with +#' dementia, per Council} +#' \item{year}{Time period - Financial year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"people_dementia" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/dementia.R b/data-raw/healthy-people/dementia.R index f6ee729..4cd17ab 100644 --- a/data-raw/healthy-people/dementia.R +++ b/data-raw/healthy-people/dementia.R @@ -1,25 +1,27 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Health%20and%20Social%20Care/Disease%20Prevalence%20(Quality%20Outcomes%20Framework)%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Dementia Data +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:AL15" - ) +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +dementia_raw <- read_csv(url) -dementia <- - raw |> - as_tibble() |> +people_dementia <- dementia_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Disease` == "Dementia", + `Financial Year` == "2023/24", + `LGD2014` != "N92000002" + ) |> + rowwise() |> + mutate(dementia_percentage = VALUE / 10) |> select( - lad_code = `LGD2014 Code`, - dementia_per_1000_patients = `Dementia Register: Raw Prevalence per 1,000 patients2` + ltla24_code = LGD2014, + dementia_percentage, + year = `Financial Year` ) -write_rds(dementia, "data/vulnerability/health-inequalities/northern-ireland/healthy-people/dementia.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(people_dementia, overwrite = TRUE) diff --git a/data/people_dementia.rda b/data/people_dementia.rda new file mode 100644 index 0000000000000000000000000000000000000000..5fe29a88e594e5c3a5a1fbfd1b15fcd572d234c0 GIT binary patch literal 480 zcmV<60U!QCT4*^jL0KkKS#5En9{>Tx|NsB{*#rO(*P z0i!?w0B8UJXaEL+DM)|~27m^D00000000004gjK|2*D%Pu!~tdBvPP50L+ZYfr9{y zz*I^T)t?C4E1x=i84aq*a&ZJRm5QBOq45h4L>6TLWG2zBK%*ERly{#Rrg8~P5dtl7 zB#a>CG!Sh(D6BB?7fTl!oi@2To?$McsS3D3pHw0k0BT4Pgd`atA;Fm-PeCpLSs`;_ z6Q&g$`0yskBaHxZOl0xX^3^%}ZjNjDs!pyzE)=O#SxI(P1Xf}xLZ*t8)6|q|LG>b% zq7r>iZ)|g)c6JU|Y_HF&ZO#1U9&drZ%HOul>MsbVQhI$P3QBlK$x6Qz3e)nk#b*la z^&yKE2Ya7G!39-`0fZ)Y3OtqLLBgmA*3^Y23ov2UNL@2Xj)c!PaIIedSuh;#8pqLb zazzuSyD*^A1qmp03lc5XFQ($ZgCbf5xv#Q)*SI$fvKx0Gv}L^))Cc(-3_^g30RbE& WQN9`z)?Nc8(RU Date: Tue, 7 Jan 2025 13:14:22 +0000 Subject: [PATCH 07/24] First draft completed - household-overcrowding First draft completed - household-overcrowding, styled and rendered. --- R/data.R | 19 +++++++++++ .../healthy-places/household-overcrowding.R | 31 ++++++++---------- data/places_household_overcrowding.rda | Bin 0 -> 324 bytes man/places_household_overcrowding.Rd | 30 +++++++++++++++++ metadata.md | 2 +- 5 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 data/places_household_overcrowding.rda create mode 100644 man/places_household_overcrowding.Rd diff --git a/R/data.R b/R/data.R index 327711a..f1746cd 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,25 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Percentage Household Overcrowding (2017) +#' +#' A dataset containing statistics on the percentage of households experiencing +#' household overcrowding, per Council (2017). +#' Household overcrowding is typically defined as households with an occupancy +#' rating of -1 or lower. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{household_overcrowding_percentage}{Percentage of households +#' experiencing household overcrowding} +#' \item{year}{Year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"places_household_overcrowding" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-places/household-overcrowding.R b/data-raw/healthy-places/household-overcrowding.R index 95d1d5a..415ab18 100644 --- a/data-raw/healthy-places/household-overcrowding.R +++ b/data-raw/healthy-places/household-overcrowding.R @@ -1,25 +1,20 @@ +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readODS) -GET( - "https://www.ninis2.nisra.gov.uk/Download/Deprivation/Northern%20Ireland%20Multiple%20Deprivation%20Measure%202017%20-%20Indicators%20(administrative%20geographies).ods", - write_disk(tf <- tempfile(fileext = ".ods")) -) +# ---- Get and clean data ---- +# Household Overcrowding Data +# Source: https://data.nisra.gov.uk/ -raw <- - read_ods( - tf, - sheet = "LGD2014", - range = "B4:AM15" - ) +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/NIMDM17T10/CSV/1.0/" +overcrowding_raw <- read_csv(url) -overcrowding <- - raw |> - as_tibble() |> +places_household_overcrowding <- overcrowding_raw |> + filter(`Statistic Label` == "Rate of Household overcrowding") |> select( - lad_code = `LGD2014 Code`, - overcrowding_rate = `Rate of Household overcrowding\n(%)` + ltla24_code = LGD2014, + household_overcrowding_percentage = VALUE, + year = `Ad-hoc year` ) -write_rds(overcrowding, "data/vulnerability/health-inequalities/northern-ireland/healthy-places/household-overcrowding.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(places_household_overcrowding, overwrite = TRUE) diff --git a/data/places_household_overcrowding.rda b/data/places_household_overcrowding.rda new file mode 100644 index 0000000000000000000000000000000000000000..84e11bb16ec99d681347ae944e94bf729fe69f6f GIT binary patch literal 324 zcmV-K0lWS}T4*^jL0KkKSz(#2#Q*^H|K$HaT>>Bhf8ay`5J11@-=IVQ05E_C0s*iA z8j%Sp0Vk=jp#4+S$kF9JN2%oiGBRnjo+vqh0%X7fVK7V~fFl425=2Aw2BSd8!5IJm z&<01O`Vlvhkf21}y}F59n^451Q5r9@#E!cD_EJ=_db1slAWPpPNNlH~Udp?BtM9We zsN9lep@^jjUlq9vC-TW- WGS^*z*Xl9 Date: Tue, 7 Jan 2025 16:04:27 +0000 Subject: [PATCH 08/24] First draft completed - respiratory-conditions First draft completed - respiratory-conditions, styled and rendered. Prevalence per 1k converted to %. --- R/data.R | 18 +++++++++ .../healthy-people/respiratory-conditions.R | 37 ++++++++++++++++++ data/people_respiratory_conditions.rda | Bin 0 -> 392 bytes man/people_respiratory_conditions.Rd | 28 +++++++++++++ metadata.md | 3 +- 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 data-raw/healthy-people/respiratory-conditions.R create mode 100644 data/people_respiratory_conditions.rda create mode 100644 man/people_respiratory_conditions.Rd diff --git a/R/data.R b/R/data.R index 327711a..09e218f 100644 --- a/R/data.R +++ b/R/data.R @@ -267,6 +267,24 @@ #' @source \url{https://www.nisra.gov.uk/publications/census-2021-main-statistics-health-disability-and-unpaid-care-tables} "people_mental_health" +#' Percentage Rate of Respiratory Conditions (Asthma and COPD) (2023/2024) +#' +#' A dataset containing statistics on the percentage of people who self-reported +#' as having asthma and/or COPD in Northern Irish Council Areas. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authroity Code} +#' \item{respiratory_conditions_percentage}{Percentage of people who self-reported +#' as having asthma and/or COPD} +#' \item{year}{Time period - financial year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"people_respiratory_conditions" + #' Rates of Personal Crime per 1,000 (2017) #' #' A dataset containing statistics on 'personal crime' per 1,000 people in diff --git a/data-raw/healthy-people/respiratory-conditions.R b/data-raw/healthy-people/respiratory-conditions.R new file mode 100644 index 0000000..7f6e9ad --- /dev/null +++ b/data-raw/healthy-people/respiratory-conditions.R @@ -0,0 +1,37 @@ +# Respiratory conditions here pertains to asthma and COPD data. A mean average +# has been calculated between the 2 to get an average for respiratory conditions. +# This best matches how England's Health Index calculates their respiratory +# conditions indicator. + +# ---- Load packages ---- +library(tidyverse) + +# ---- Get and clean data ---- +# Respiratory Conditions +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +respiratory_conditions_raw <- read_csv(url) + +people_respiratory_conditions <- respiratory_conditions_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Financial Year` == "2023/24", + `Disease` %in% c("Asthma", "Chronic Obstructive Pulmonary Disease"), + `LGD2014` != "N92000002" + ) |> + group_by(LGD2014) |> + mutate( + respiratory_conditions_prevalence = mean(VALUE, na.rm = TRUE), + respiratory_conditions_percentage = (respiratory_conditions_prevalence / 10) + ) |> + ungroup() |> + distinct(LGD2014, .keep_all = TRUE) |> + select( + ltla24_code = LGD2014, + respiratory_conditions_percentage, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_respiratory_conditions, overwrite = TRUE) diff --git a/data/people_respiratory_conditions.rda b/data/people_respiratory_conditions.rda new file mode 100644 index 0000000000000000000000000000000000000000..bc803718e5bae33b00c5be23101bff0353bb521c GIT binary patch literal 392 zcmV;30eAjFT4*^jL0KkKSr5y%ga833fB*lx{nH=`|L8h(JH5HsJOo z;mUn(?n4TZL_z`!r}D$=IjNEqYquc!wWAoyj2;!c*pnn%i6eJhF-KHsTsLtkcIHkX zA0#D9Wf#%5Rv|s9R9lFuS=x|8HN&6ozG%o5Kv3ay`el?JJYS|*7&po{j{5w$`Z$jU m2Cthy*X9&hd$MWMz5O+()4zTk7oP*)#oUoj6eI)k?co3qw4M?G literal 0 HcmV?d00001 diff --git a/man/people_respiratory_conditions.Rd b/man/people_respiratory_conditions.Rd new file mode 100644 index 0000000..610bd38 --- /dev/null +++ b/man/people_respiratory_conditions.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_respiratory_conditions} +\alias{people_respiratory_conditions} +\title{Percentage Rate of Respiratory Conditions (Asthma and COPD) (2023/2024)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authroity Code} +\item{respiratory_conditions_percentage}{Percentage of people who self-reported +as having asthma and/or COPD} +\item{year}{Time period - financial year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_respiratory_conditions +} +\description{ +A dataset containing statistics on the percentage of people who self-reported +as having asthma and/or COPD in Northern Irish Council Areas. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 06e5d0a..59ccfe0 100644 --- a/metadata.md +++ b/metadata.md @@ -51,8 +51,7 @@ | Healthy People | Diabetes | ? | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data currently unavailable. Raw disease prevalence only shows data per 1,000 (England's Health Index uses %). Other alternative could be 'Prescriptions for drugs used to treat Diabetes (administrative geographies) (4), but need to contact info.bso@hscni.net to check. Review at the end. | :x: | | Healthy People | Kidney and Liver Disease | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy People | Musculoskeletal Conditions | :x: | :x: | :x: | :x: No data available | :x: | -| Healthy People | Respiratory Conditions: Asthma | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Respiratory Conditions is treated as 1 indicator. | :x: | -| Healthy People | Respiratory Conditions: COPD | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. Respiratory Conditions is treated as 1 indicator. | :x: | +| Healthy People | Respiratory Conditions: Asthma & COPD | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage rate of people self-reported as having asthma and/or COPD. | :heavy_check_mark: | | Healthy Places | Private Outdoor Space | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Public Green Space | :x: | :x: | :x: | :heavy_exclamation_mark: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Household Overcrowding | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index.| :x: | From a3d829ece7599d0103cc868f73718818fb452be0 Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 7 Jan 2025 16:53:37 +0000 Subject: [PATCH 09/24] First draft completed - cardiovascular-conditions First draft completed - cardiovascular-conditions, styled and rendered. Prevalence per 1k converted to %. --- R/data.R | 20 +++++++++ .../cardiovascular-conditions.R | 38 ++++++++++++++++++ data/people_cardiovascular_conditions.rda | Bin 0 -> 410 bytes man/people_cardiovascular_conditions.Rd | 30 ++++++++++++++ metadata.md | 2 +- 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-people/cardiovascular-conditions.R create mode 100644 data/people_cardiovascular_conditions.rda create mode 100644 man/people_cardiovascular_conditions.Rd diff --git a/R/data.R b/R/data.R index 327711a..36f58b0 100644 --- a/R/data.R +++ b/R/data.R @@ -179,6 +179,26 @@ #' @source \url{https://www.ons.gov.uk/datasets/wellbeing-local-authority/editions/time-series/versions/4} "people_anxiety" +#' Percentage Rate of Cardiovascular Conditions (CHD, Atrial Fibrillation, +#' Heart Failure, Stroke & TIA) (2023/2024) +#' +#' A dataset containing statistics on the percentage of people who self-reported +#' as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA in +#' Northern Irish Council Areas. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authroity Code} +#' \item{cardiovascular_conditions_percentage}{Percentage of people who self-reported +#' as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA} +#' \item{year}{Time period - financial year} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +#' +"people_cardiovascular_conditions" + #' Percentage of People Aged 15-64 with Long-Term Health Problem/Disability #' that Limits Daily Activities #' diff --git a/data-raw/healthy-people/cardiovascular-conditions.R b/data-raw/healthy-people/cardiovascular-conditions.R new file mode 100644 index 0000000..b320ecc --- /dev/null +++ b/data-raw/healthy-people/cardiovascular-conditions.R @@ -0,0 +1,38 @@ +# Cardiovascular conditions here pertains to CHD, Atrial Fibrillation, Heart +# Failure, and Stroke & TIA data. A mean average has been calculated between the +# 5 to get an average for cardiovascular conditions. This best matches how +# England's Health Index calculates their cardiovascular conditions indicator. + +# ---- Load packages ---- +library(tidyverse) + +# ---- Get and clean data ---- +# Cardiovascular Conditions Data (CHD, Atrial Fibrillation, Heart Failure, Stroke & TIA) +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +cardiovascular_conditions_raw <- read_csv(url) + +people_cardiovascular_conditions <- cardiovascular_conditions_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Financial Year` == "2023/24", + `Disease` %in% c("Atrial Fibrillation", "Coronary Heart Disease", + "Heart Failure 1", "Heart Failure 3", "Stroke & TIA"), + `LGD2014` != "N92000002" + ) |> + group_by(LGD2014) |> + mutate( + cardiovascular_conditions_prevalence = mean(VALUE, na.rm = TRUE), + cardiovascular_conditions_percentage = (cardiovascular_conditions_prevalence / 10) + ) |> + ungroup() |> + distinct(LGD2014, .keep_all = TRUE) |> + select( + ltla24_code = LGD2014, + cardiovascular_conditions_percentage, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_cardiovascular_conditions, overwrite = TRUE) diff --git a/data/people_cardiovascular_conditions.rda b/data/people_cardiovascular_conditions.rda new file mode 100644 index 0000000000000000000000000000000000000000..9acdc92ff0958581c2f71f298db8d9f03e98a313 GIT binary patch literal 410 zcmV;L0cHL|T4*^jL0KkKS#qnQod5wPfB*lxTnI!Z|L4wu5Y4~m-=x40AQ1=&Ap*e& z6zByCf}gMfHa1ZbQRy%f(KA3bH1!!7JrhBLN$N2TJf_f3Nr=HbDA-R>N{u5)wNFhz z&;S4c00w{n10c;ur~otxB#LRKH5xQD4Kit_ng9R|8fX9j22B6}K!&QWGAWA%DG1YY z)nY!gPNyu@53Cx$o6YtBrB8;?hX_QP6J2G0Iu-={8WFZ2b&PPlWR#!*kSOLjzhCB6A66){yc<_%eClD%RKIx=6c_fF&eAk*1LRn4?+aBtuBdNR3@!Br`X` z0<=dEgafVGJ8G4n@8h*FWh<(%;3A9z#2`H)(pa0-PkI&5``}wUM!aLz&!+ zR7G_rK1NdRif@HvgHP7c&-0u-5(y~hV$4)F72#YaBLDeZp;AcAR-(nKr{SZ$rRy2LCUU* EbevzW<^TWy literal 0 HcmV?d00001 diff --git a/man/people_cardiovascular_conditions.Rd b/man/people_cardiovascular_conditions.Rd new file mode 100644 index 0000000..31090be --- /dev/null +++ b/man/people_cardiovascular_conditions.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{people_cardiovascular_conditions} +\alias{people_cardiovascular_conditions} +\title{Percentage Rate of Cardiovascular Conditions (CHD, Atrial Fibrillation, +Heart Failure, Stroke & TIA) (2023/2024)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authroity Code} +\item{cardiovascular_conditions_percentage}{Percentage of people who self-reported +as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA} +\item{year}{Time period - financial year} + +... +} +} +\source{ +\url{https://data.nisra.gov.uk/} +} +\usage{ +people_cardiovascular_conditions +} +\description{ +A dataset containing statistics on the percentage of people who self-reported +as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA in +Northern Irish Council Areas. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 06e5d0a..78f7ba8 100644 --- a/metadata.md +++ b/metadata.md @@ -13,7 +13,7 @@ | Healthy Lives | GCSE Achievement | 2022-23 | [NISRA](https://data.nisra.gov.uk/) | [NISRA](https://data.nisra.gov.uk/) | :heavy_check_mark: Indicator: Percentage of GSCE attainment, including Maths and English (Grades A-C) | :heavy_check_mark: | | Healthy Lives | Young People's Education, Employment and Training | 2018 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | | Healthy Lives | Child Poverty | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Percentage of children (aged 15 and under) living in absolute low income families | :heavy_check_mark: | -| Healthy Lives |Cardiovascular Conditions | 2023/24 | [NISRA](https://data.nisra.gov.uk/k) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available as separate conditions (CHD, COPD, Heart Failure 1 & 3, Stroke and TIA) as a rate per 1,000. To be comparable to England's Index must be shown as a %. To review at the end. | :x: | +| Healthy Lives |Cardiovascular Conditions | 2023/24 | [NISRA](https://data.nisra.gov.uk/k) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage rate of people self-reported as having CHD, Atrial Fibrillation, Heart Failure, and/or Stroke & TIA. | :heavy_check_mark: | | Healthy Lives | High Blood Pressure | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. | :x: | | Healthy Lives | Overweight and Obesity in Adults | :x: | :x: | :x: | :x: - Data unavailable. | :x: | | Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x:| ❗: - The data (breast, bowel, and cervical cancers) is at the Health and Social Care Trusts level | :x: | From 4830172dc4df7a51184f25701d993ca3b4a279dd Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 09:47:31 +0000 Subject: [PATCH 10/24] First draft - healthy-eating First draft - healthy-eating. Gathered trust and LA codes, ready to join into one data set. --- data-raw/healthy-lives/healthy-eating.R | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 data-raw/healthy-lives/healthy-eating.R diff --git a/data-raw/healthy-lives/healthy-eating.R b/data-raw/healthy-lives/healthy-eating.R new file mode 100644 index 0000000..0536a9c --- /dev/null +++ b/data-raw/healthy-lives/healthy-eating.R @@ -0,0 +1,48 @@ +# ---- Load packages ---- +library(tidyverse) +library(readxl) +library(httr) +library(geographr) +library(ggplot2) + +# ---- Get and clean data ---- +# Healthy Eating Data +# Source: https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223 + +GET("https://www.health-ni.gov.uk/sites/default/files/publications/health/hsni-trend-tables-22-23.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx"))) + +healthy_eating_raw <- read_excel(tf, sheet = 17, skip = 160) + +healthy_eating_hb <- healthy_eating_raw |> + slice(2:6) |> + select(hb24_name = `All`, + healthy_eating_percentage = `2022/23...14`) + + +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + + +# Join datasets +# Healthy eating data + Trust name and code + +healthy_eating_hb <- healthy_eating_hb |> + select(trust18_name = hb24_name, + healthy_eating_percentage) |> + left_join(hb_lookup, by = "trust18_name") |> + select(-trust18_name) |> + relocate(trust18_code) + +# Healthy eating data + LA code + +lives_healthy_eating <- healthy_eating_hb |> + left_join(hb_ltla_lookup, by = + + + From 72e437d178e40c7b8c76c26276c49e4414583681 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 09:58:08 +0000 Subject: [PATCH 11/24] First draft completed - healthy-eating First draft completed - healthy-eating, styled and rendered. Converted from HB to LA level. --- R/data.R | 19 +++++++++++++ data-raw/healthy-lives/healthy-eating.R | 34 ++++++++++++++++-------- data/lives_healthy_eating.rda | Bin 0 -> 347 bytes man/lives_healthy_eating.Rd | 28 +++++++++++++++++++ metadata.md | 2 +- 5 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 data/lives_healthy_eating.rda create mode 100644 man/lives_healthy_eating.Rd diff --git a/R/data.R b/R/data.R index 327711a..3480d24 100644 --- a/R/data.R +++ b/R/data.R @@ -35,6 +35,25 @@ #' "lives_gsce_attainment" +#' Percentage of People that Eat Healthy (2022-2023) +#' +#' A dataset containing statistics on fruit and vegetable consumption in +#' each Northern Irish Council, 2022-23. +#' +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{healthy_eating_percentage}{Percentage of people that consume +#' 5 portions or more of fruit and vegetable per day} +#' \item{year}{Time period} +#' +#' ... +#' } +#' @source \url{https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223} +#' +"lives_healthy_eating" + #' Percentage of Babies Born Not at a Healthy Birth Weight (2022-2023) #' #' A dataset containing percentage babies born not at a healthy birth weight. diff --git a/data-raw/healthy-lives/healthy-eating.R b/data-raw/healthy-lives/healthy-eating.R index 0536a9c..6fbb69d 100644 --- a/data-raw/healthy-lives/healthy-eating.R +++ b/data-raw/healthy-lives/healthy-eating.R @@ -3,21 +3,24 @@ library(tidyverse) library(readxl) library(httr) library(geographr) -library(ggplot2) # ---- Get and clean data ---- # Healthy Eating Data # Source: https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223 -GET("https://www.health-ni.gov.uk/sites/default/files/publications/health/hsni-trend-tables-22-23.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx"))) +GET( + "https://www.health-ni.gov.uk/sites/default/files/publications/health/hsni-trend-tables-22-23.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) +) healthy_eating_raw <- read_excel(tf, sheet = 17, skip = 160) healthy_eating_hb <- healthy_eating_raw |> slice(2:6) |> - select(hb24_name = `All`, - healthy_eating_percentage = `2022/23...14`) + select( + hb24_name = `All`, + healthy_eating_percentage = `2022/23...14` + ) # Geographical Code Data: Health Board and Local Authority @@ -33,8 +36,10 @@ hb_lookup <- boundaries_trusts_ni18 |> # Healthy eating data + Trust name and code healthy_eating_hb <- healthy_eating_hb |> - select(trust18_name = hb24_name, - healthy_eating_percentage) |> + select( + trust18_name = hb24_name, + healthy_eating_percentage + ) |> left_join(hb_lookup, by = "trust18_name") |> select(-trust18_name) |> relocate(trust18_code) @@ -42,7 +47,14 @@ healthy_eating_hb <- healthy_eating_hb |> # Healthy eating data + LA code lives_healthy_eating <- healthy_eating_hb |> - left_join(hb_ltla_lookup, by = - - - + left_join(hb_ltla_lookup, by = "trust18_code") |> + mutate(year = "2022/23") |> + select( + ltla24_code = ltla21_code, + healthy_eating_percentage, + year + ) |> + arrange(ltla24_code) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_healthy_eating, overwrite = TRUE) diff --git a/data/lives_healthy_eating.rda b/data/lives_healthy_eating.rda new file mode 100644 index 0000000000000000000000000000000000000000..1116dc73996933bb4b3e8796d73d861ccc899e1c GIT binary patch literal 347 zcmV-h0i^yyT4*^jL0KkKS&Vje`v3u`f588`OdtRO|KJ1x5J11@-Jn1K0s*iAT7d?M zPbuh`q+}X2+Kn;*88poxzyLG=22B6}27pNvz)`7*gaByB)6@Vm94m_Z%yeK$(|j#Z z(*!RL8}CGzFm4t5xgZZm)lpC2nHA{Ulo1fmioIk__mA#qX3)|3=jsT5-~1&IXdASMtdSg`_iqcp<93=$z2 zxl$zw7ZnSM)gokINT^}0BVODo*TCDed>dJ_@OXT=5=m#>Tr t?g)j;78zvGfR%EwcB!W^goy0IK#*|lm|OSvz+nH2xgwk>NJcw5eSiTAi~Ilp literal 0 HcmV?d00001 diff --git a/man/lives_healthy_eating.Rd b/man/lives_healthy_eating.Rd new file mode 100644 index 0000000..e6dce41 --- /dev/null +++ b/man/lives_healthy_eating.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_healthy_eating} +\alias{lives_healthy_eating} +\title{Percentage of People that Eat Healthy (2022-2023)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{healthy_eating_percentage}{Percentage of people that consume +5 portions or more of fruit and vegetable per day} +\item{year}{Time period} + +... +} +} +\source{ +\url{https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223} +} +\usage{ +lives_healthy_eating +} +\description{ +A dataset containing statistics on fruit and vegetable consumption in +each Northern Irish Council, 2022-23. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 569ec00..94e6ba9 100644 --- a/metadata.md +++ b/metadata.md @@ -4,7 +4,7 @@ | --- | --- | --- | --- | --- | --- | --- | | Healthy Lives | Alcohol Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | | Healthy Lives | Drug Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | -| Healthy Lives | Healthy Eating | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | +| Healthy Lives | Healthy Eating | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of People that consume 5 or more fruit and vegetable portions per day | :heavy_check_mark: | | Healthy Lives | Physical Activity | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x:| :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | | Healthy Lives | Smoking | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | From 22fa6ccce7693139bc554016ae4769432655fa78 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 10:54:47 +0000 Subject: [PATCH 12/24] First draft started - smoking First draft started - smoking. Still to combine with LA codes --- data-raw/healthy-lives/smoking.R | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 data-raw/healthy-lives/smoking.R diff --git a/data-raw/healthy-lives/smoking.R b/data-raw/healthy-lives/smoking.R new file mode 100644 index 0000000..ced7f35 --- /dev/null +++ b/data-raw/healthy-lives/smoking.R @@ -0,0 +1,41 @@ +# ---- Load packages ---- +library(tidyverse) +library(readxl) +library(httr) +library(geographr) + +# ---- Get and clean data ---- +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + + +# Healthy Eating Data +# Source: https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223 + +GET( + "https://www.health-ni.gov.uk/sites/default/files/publications/health/hsni-trend-tables-22-23.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) +) + +smoking_raw <- read_excel(tf, sheet = 19, skip = 166) + +smoking_hb <- smoking_raw |> + slice(2:6) |> + select(trust18_name = `All`, + smoking_percentage = `2022/23...14`) + +# Join datasets +# Smoking data + Trust name and code + +smoking_hb <- smoking_hb |> + left_join(hb_lookup) |> + select(-trust18_name) |> + relocate(trust18_code) + +# Smoking data + LA code + From 4fa2a8ac1b60565524f818670e72d86a045b6ca7 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 12:19:27 +0000 Subject: [PATCH 13/24] Fist draft completed - smoking Fist draft completed - smoking, styled and rendered. Converted from HB to LA. --- R/data.R | 17 +++++++++++++++++ data-raw/healthy-lives/smoking.R | 19 ++++++++++++++++--- data/lives_smoking.rda | Bin 0 -> 345 bytes man/lives_smoking.Rd | 27 +++++++++++++++++++++++++++ metadata.md | 2 +- 5 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 data/lives_smoking.rda create mode 100644 man/lives_smoking.Rd diff --git a/R/data.R b/R/data.R index 327711a..9e7075f 100644 --- a/R/data.R +++ b/R/data.R @@ -87,6 +87,23 @@ #' "lives_pupil_absence" +#' Percentage of Current Smokers (2022-2023) +#' +#' A dataset containing statistics on smoking status in +#' each Northern Irish Council, 2022-23. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{smoking_percentage}{Percentage of people that are current smokers} +#' \item{year}{Time period} +#' +#' ... +#' } +#' @source \url{https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223} +#' +"lives_smoking" + #' Rates of teenage pregnancies per 1,000 (2020-22) #' #' A dataset containing statistics on the rate of teenage pregnancies per 1k. diff --git a/data-raw/healthy-lives/smoking.R b/data-raw/healthy-lives/smoking.R index ced7f35..0ba0ce5 100644 --- a/data-raw/healthy-lives/smoking.R +++ b/data-raw/healthy-lives/smoking.R @@ -26,8 +26,10 @@ smoking_raw <- read_excel(tf, sheet = 19, skip = 166) smoking_hb <- smoking_raw |> slice(2:6) |> - select(trust18_name = `All`, - smoking_percentage = `2022/23...14`) + select( + trust18_name = `All`, + smoking_percentage = `2022/23...14` + ) # Join datasets # Smoking data + Trust name and code @@ -38,4 +40,15 @@ smoking_hb <- smoking_hb |> relocate(trust18_code) # Smoking data + LA code - +lives_smoking <- smoking_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2022/23") |> + select( + ltla24_code = ltla21_code, + smoking_percentage, + year + ) |> + arrange(ltla24_code) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_smoking, overwrite = TRUE) diff --git a/data/lives_smoking.rda b/data/lives_smoking.rda new file mode 100644 index 0000000000000000000000000000000000000000..7204e69be8051a4e8cffb2dbace28f28f44ac909 GIT binary patch literal 345 zcmV-f0jB;!T4*^jL0KkKSy@Br8UO*Pf588`SO5S4|KJ1x5J11L-Jn1K0s*iAT7d?U zN2KzbO-zg+^oD={W~TK)jSUR|84Umc000t50+>mo)CP?jY3ga}28|gG3fXdI*ZLAch1Q z21$@O9G=c$2`#a56|9jYjJQQ32qbDqVIstgIl@U85FBzmCFqe=h2CRV129S;FwQI| zVWJ5bq+VPT86u&1wIX3IS%jESCNf2ghY%!nk{mir5h6e>91b6xr0D}ar3wW{g-V5L zNPFT=0a6nv8Hx&HMowgis1F`xts`DJU#rK<_3g8HvKyjDx0b;$YR>D_4O}G_7@9$N r%Gi5ZQX`zjOPEzlEs5xj0Y?y@;n3 Date: Wed, 8 Jan 2025 14:05:51 +0000 Subject: [PATCH 14/24] First draft completed - infant-mortality First draft completed - infant-mortality, styled and rendered. Converted HB to LA. --- R/data.R | 17 ++ data-raw/healthy-lives/infant-mortality.R | 219 ++++------------------ data/lives_infant_mortality.rda | Bin 0 -> 303 bytes man/lives_infant_mortality.Rd | 28 +++ metadata.md | 2 +- 5 files changed, 78 insertions(+), 188 deletions(-) create mode 100644 data/lives_infant_mortality.rda create mode 100644 man/lives_infant_mortality.Rd diff --git a/R/data.R b/R/data.R index 327711a..eae761c 100644 --- a/R/data.R +++ b/R/data.R @@ -69,6 +69,23 @@ #' "lives_childhood_overweight_obesity" +#' Rate of infant mortality (2018-2022) +#' +#' A dataset containing statistics on the rate of infant mortality in each +#' Norther Irish Council, 2018-2022. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{infant_mortality_per_1k}{Rate of infants per 1,000 that have died +#' under the age of 1} +#' \item{year}{Time period - five year aggregate} +#' +#' ... +#' } +#' @source \url{https://data.nisra.gov.uk/} +"lives_infant_mortality" + #' Percentage of Pupil Absences (2021/22) #' #' A dataset containing statistics on the percentage of unauthorised school diff --git a/data-raw/healthy-lives/infant-mortality.R b/data-raw/healthy-lives/infant-mortality.R index ea93afa..e2bb670 100644 --- a/data-raw/healthy-lives/infant-mortality.R +++ b/data-raw/healthy-lives/infant-mortality.R @@ -1,209 +1,54 @@ -# ---- Load ---- +# ---- Load packages ---- library(tidyverse) -library(httr) -library(readxl) library(geographr) -library(sf) -source("R/utils.R") +# ---- Get and clean data ---- +# Geographical Code Data: Health Board and Local Authority -ni_lookup <- - boundaries_lad |> - st_drop_geometry() |> - filter_codes(lad_code, "^N") |> - select(lad_name, lad_code) +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) -# ---- Load Latest 3 year birth & death rates ---- -GET( - "https://www.nisra.gov.uk/sites/nisra.gov.uk/files/publications/RG_2017.zip", - write_disk(tf <- tempfile(fileext = ".zip")) -) +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() -unzip(tf, exdir = tempdir()) -raw_infant_deaths_2017 <- - read_excel( - list.files( - tempdir(), - pattern = "Stillbirths_InfantDeaths_2017.xls", - full.names = TRUE - ), - sheet = "Table 4.4b", - range = "A4:C53" - ) +# Infant Mortality Data +# Source: https://data.nisra.gov.uk/ -infant_deaths_2017 <- - raw_infant_deaths_2017 |> - slice(-c(1:6)) |> - drop_na() |> - select( - lad_name = `...1`, - infant_mortality_count = `All infant` - ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, infant_mortality_count) |> - mutate(year = "2017") +infant_mortality_raw <- read_csv("https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/INFANTMRHSCT/CSV/1.0/") -raw_live_births_2017 <- - read_excel( - list.files( - tempdir(), - pattern = "Births_2017.xls", - full.names = TRUE - ), - sheet = "Table 3.7b", - range = "A4:C52" - ) - -live_births_2017 <- - raw_live_births_2017 |> - slice(-c(1:5)) |> - drop_na() |> - select( - lad_name = Area, - live_birth_count = `All births` +infant_mortality_hb <- infant_mortality_raw |> + filter( + `Grouped Year` == "2018-22", + `Health and Social Care Trust` != "NI" ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, live_birth_count) |> - mutate(year = "2017") - -GET( - "https://www.nisra.gov.uk/sites/nisra.gov.uk/files/publications/RG_2018.zip", - write_disk(tf <- tempfile(fileext = ".zip")) -) - -unzip(tf, exdir = tempdir()) - -raw_infant_deaths_2018 <- - read_excel( - list.files( - tempdir(), - pattern = "Stillbirths_Infant_Deaths_Tables_2018.xlsx", - full.names = TRUE - ), - sheet = "Table 4.4b", - range = "A4:C53" - ) - -infant_deaths_2018 <- - raw_infant_deaths_2018 |> - slice(-c(1:6)) |> - drop_na() |> select( - lad_name = `...1`, - infant_mortality_count = `All infant` - ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, infant_mortality_count) |> - mutate(year = "2018") - -raw_live_births_2018 <- - read_excel( - list.files( - tempdir(), - pattern = "Births_Tables_2018.xlsx", - full.names = TRUE - ), - sheet = "Table 3.7b", - range = "A3:C51" + trust18_name = `Health and Social Care Trust`, + infant_mortality_per_1k = `VALUE` ) -live_births_2018 <- - raw_live_births_2018 |> - slice(-c(1:5)) |> - drop_na() |> - select( - lad_name = Area, - live_birth_count = `All births` - ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, live_birth_count) |> - mutate(year = "2018") -GET( - "https://www.nisra.gov.uk/sites/nisra.gov.uk/files/publications/Stillbirths_InfantDeaths_Tables_2019.xls", - write_disk(tf <- tempfile(fileext = ".xls")) -) +# Join datasets +# Infant mortality data + Trust name and code -raw_infant_deaths_2019 <- - read_excel( - tf, - sheet = "Table 4.4b", - range = "A4:C53" - ) +infant_mortality_hb <- infant_mortality_hb |> + left_join(hb_lookup) |> + select(-trust18_name) |> + relocate(trust18_code) -infant_deaths_2019 <- - raw_infant_deaths_2019 |> - slice(-c(1:6)) |> - drop_na() |> - select( - lad_name = `2019`, - infant_mortality_count = `All infant` - ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, infant_mortality_count) |> - mutate(year = "2019") -GET( - "https://www.nisra.gov.uk/sites/nisra.gov.uk/files/publications/Births_Tables_2019.xlsx", - write_disk(tf <- tempfile(fileext = ".xlsx")) -) +# Infant mortality data + LA code -raw_live_births_2019 <- - read_excel( - tf, - sheet = "Table 3.7b", - range = "A3:C51" - ) - -live_births_2019 <- - raw_live_births_2019 |> - slice(-c(1:5)) |> - drop_na() |> +lives_infant_mortality <- infant_mortality_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2018-22") |> select( - lad_name = Area, - live_birth_count = `All births` + ltla24_code = ltla21_code, + infant_mortality_per_1k, + year ) |> - mutate(lad_name = str_replace_all(lad_name, "&", "and")) |> - left_join(ni_lookup) |> - select(lad_code, live_birth_count) |> - mutate(year = "2019") + arrange(ltla24_code) -# ---- Join and calculate mean rate ---- -all_births <- - bind_rows( - live_births_2017, - live_births_2018, - live_births_2019 - ) - -all_deaths <- - bind_rows( - infant_deaths_2017, - infant_deaths_2018, - infant_deaths_2019 - ) |> - mutate(infant_mortality_count = as.double(infant_mortality_count)) - -joined <- - all_births |> - left_join( - all_deaths, - by = c("lad_code", "year") - ) - -infant_mortality <- - joined |> - mutate( - infant_mortality_per_1000 = (infant_mortality_count / live_birth_count) * 1000 - ) |> - group_by(lad_code) |> - summarise(infant_mortality_per_1000 = mean(infant_mortality_per_1000)) -# Save -write_rds(infant_mortality, "data/vulnerability/health-inequalities/northern-ireland/healthy-lives/infant-mortality.rds") \ No newline at end of file +# ---- Save output to data/ folder ---- +usethis::use_data(lives_infant_mortality, overwrite = TRUE) diff --git a/data/lives_infant_mortality.rda b/data/lives_infant_mortality.rda new file mode 100644 index 0000000000000000000000000000000000000000..cc55a73b4cc92e8021923d26792eb06f1bf3637a GIT binary patch literal 303 zcmV+~0nq+JT4*^jL0KkKS*RofH~;}8|K$I_O@IIcf8ay`5J0~#-Jn1K05AXs0s*iA z7)UgUp*==JK+qnbGBf~aH1MG2011Eqm;e9(03=dqrqp_68a)s+4GfJmZ8ZU>rlJ8o z6;x4yf>0`jxfyiPG~c$AO2ccvtL{J&vf9iO2jgQp;?UptjkVMymkrZIUrKNU>OcFOxN{&et z?>HbsAeIzMZ>J$AGbQ96169@1r{g`dSPJ0I8w3~L_d)(n5*?ntK!5)}l1X8_4H BdH( Date: Wed, 8 Jan 2025 15:02:20 +0000 Subject: [PATCH 15/24] First draft completed - child-vaccine-coverage First draft completed - child-vaccine-coverage, styled and rendered. Converted from HB to LA. --- R/data.R | 19 ++++++ data-raw/healthy-lives/vaccination-coverage.R | 55 ++++++++++++++++++ data/lives_child_vaccine_coverage.rda | Bin 0 -> 353 bytes man/lives_child_vaccine_coverage.Rd | 29 +++++++++ metadata.md | 2 +- 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 data-raw/healthy-lives/vaccination-coverage.R create mode 100644 data/lives_child_vaccine_coverage.rda create mode 100644 man/lives_child_vaccine_coverage.Rd diff --git a/R/data.R b/R/data.R index 327711a..dfff721 100644 --- a/R/data.R +++ b/R/data.R @@ -104,6 +104,25 @@ #' "lives_teenage_pregnancy" +#' Percentage of Childhood Vaccine Coverage (2022-2023) +#' +#' A dataset containing statistics on childhood vaccine coverage (aged 6 and +#' under) in each Northern Irish Council, 2022/23. +#' +#' @format A data frame with 11 rows and 3 variables: +#' \describe{ +#' \item{ltla24_code}{Local Authority Code} +#' \item{child_vaccine_coverage_percentage}{Percentage of vaccine coverage. Includes +#' childhood immunisation statistics (DtaP/IPV/Hib(HepB), MenB, Rotavirus, PCV, +#' Hib/MenC, MMR1 (by age 2), MMR1 (by age 5), MMR2 (by age 5). Pre-School Booster)} +#' \item{year}{School Year} +#' +#' ... +#' } +#' @source \url{https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022} +#' +"lives_child_vaccine_coverage" + #' Percentage of Young People in Education, Employment, and Training (2022/23) #' #' A dataset containing statistics on the percentage of young people (aged 16-18) diff --git a/data-raw/healthy-lives/vaccination-coverage.R b/data-raw/healthy-lives/vaccination-coverage.R new file mode 100644 index 0000000..48f56d0 --- /dev/null +++ b/data-raw/healthy-lives/vaccination-coverage.R @@ -0,0 +1,55 @@ +# ---- Load packages ---- +library(tidyverse) +library(httr) +library(readxl) +library(geographr) + +# ---- Get and clean data ---- +# Geographical Code Data: Health Board and Local Authority + +hb_ltla_lookup <- lookup_ltla21_hsct18 |> + distinct(ltla21_code, trust18_code) + +hb_lookup <- boundaries_trusts_ni18 |> + sf::st_drop_geometry() + +# Child vaccination coverage data +# Source: https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022 + +GET( + "https://www.publichealth.hscni.net/sites/default/files/2024-04/Core%20Tables%202022%20-%20Excel%20tables_1.xlsx", + write_disk(tf <- tempfile(fileext = ".xlsx")) +) + +vaccine_raw <- read_excel(tf, sheet = 31, skip = 4) + +vaccine_coverage_hb <- vaccine_raw |> + slice(1:9) |> + mutate(Belfast = as.numeric(Belfast)) |> + pivot_longer(cols = `Belfast`:`Northern Ireland`, names_to = "trust18_name", values_to = "vaccine_coverage_percentage") |> + group_by(trust18_name) |> + summarise(av_vaccine_coverage_percentage = mean(vaccine_coverage_percentage, na.rm = TRUE)) |> + filter(trust18_name != "Northern Ireland") + +# Join datasets +# Child vaccine coverage data + Trust name and code + +vaccine_coverage_hb <- vaccine_coverage_hb |> + left_join(hb_lookup) |> + select(-trust18_name) |> + relocate(trust18_code) + +# Child vaccine data + LA code + +lives_child_vaccine_coverage <- vaccine_coverage_hb |> + left_join(hb_ltla_lookup) |> + mutate(year = "2022-23") |> + select( + ltla24_code = ltla21_code, + child_vaccine_coverage_percentage = av_vaccine_coverage_percentage, + year + ) |> + arrange(ltla24_code) + +# ---- Save output to data/ folder ---- +usethis::use_data(lives_child_vaccine_coverage, overwrite = TRUE) diff --git a/data/lives_child_vaccine_coverage.rda b/data/lives_child_vaccine_coverage.rda new file mode 100644 index 0000000000000000000000000000000000000000..fc8eecd38262f5181f4f58251714892ed4d2465a GIT binary patch literal 353 zcmV-n0iOOsT4*^jL0KkKS#Q+rqyPaX|L_01NCYqg|KODcSWy4x-KanTKmY)M09ZgM z5-tJ(umKoa!&6kmWEu?yfHVex13=S2Xc{!o2B|itY5>q^27nBj8UO}{hK&zIXbB>M zYBnkA13<{oXaHyfL(~8RPbhH2vpnRoFeK#fg3}%m!e6h(bVR`mS8|vDOP(x}#9}jV zX}uR>)YaD4y)Fr!dIH-dt^f>yP;R!jTuVs}&Llg<0^TLU>H7-6{M(Od#Q1MMZ&pm6XY{Fpua48~k0#6yZWazf-c1Z#|3_ literal 0 HcmV?d00001 diff --git a/man/lives_child_vaccine_coverage.Rd b/man/lives_child_vaccine_coverage.Rd new file mode 100644 index 0000000..62ea5c6 --- /dev/null +++ b/man/lives_child_vaccine_coverage.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{lives_child_vaccine_coverage} +\alias{lives_child_vaccine_coverage} +\title{Percentage of Childhood Vaccine Coverage (2022-2023)} +\format{ +A data frame with 11 rows and 3 variables: +\describe{ +\item{ltla24_code}{Local Authority Code} +\item{child_vaccine_coverage_percentage}{Percentage of vaccine coverage. Includes +childhood immunisation statistics (DtaP/IPV/Hib(HepB), MenB, Rotavirus, PCV, +Hib/MenC, MMR1 (by age 2), MMR1 (by age 5), MMR2 (by age 5). Pre-School Booster)} +\item{year}{School Year} + +... +} +} +\source{ +\url{https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022} +} +\usage{ +lives_child_vaccine_coverage +} +\description{ +A dataset containing statistics on childhood vaccine coverage (aged 6 and +under) in each Northern Irish Council, 2022/23. +} +\keyword{datasets} diff --git a/metadata.md b/metadata.md index 63f9025..fbb4b27 100644 --- a/metadata.md +++ b/metadata.md @@ -18,7 +18,7 @@ | Healthy Lives | Overweight and Obesity in Adults | :x: | :x: | :x: | :x: - Data unavailable. | :x: | | Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x:| ❗: - The data (breast, bowel, and cervical cancers) is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Sexual Health | :x: | :x: | :x: | :x: - Data unavailable. | :x: | -| Healthy Lives | Vaccination Coverage | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x: | ❗: - The data is at the Health and Social Care Trusts level | :x: | +| Healthy Lives | Vaccination Coverage | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of vaccine coverage in children 6 and under | :heavy_check_mark: | | Healthy Lives | Children in State Care | :x: | :x: | :x: | ❗: - Indicator not overtly present in England's HI. To review at the end (and likely remove) | :x: | | Healthy Lives | Infant Mortality | 2018-2022 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only present at HSC level| :x: | | Healthy Lives | Low Birth Weight | 2022-23 | [Public Health Agency](https://www.publichealth.hscni.net/publications/statistical-profile-childrens-health-northern-ireland-202223) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of infants born with low birth weight (<2,500g) | :heavy_check_mark: | From fa5a4e4e42dd9b34e519e08f9cdd2230e6fccc22 Mon Sep 17 00:00:00 2001 From: CatReid Date: Wed, 8 Jan 2025 16:40:37 +0000 Subject: [PATCH 16/24] Updated metadata - drug-misuse Updated metadata - drug-misuse, data unavailable --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 63f9025..2390678 100644 --- a/metadata.md +++ b/metadata.md @@ -3,7 +3,7 @@ | Domain | Indicator | Year | Source | License | Indicator Code Added to `R/` | Data Added to `data/` | | --- | --- | --- | --- | --- | --- | --- | | Healthy Lives | Alcohol Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | -| Healthy Lives | Drug Misuse | 2019 | [Census of drug and alcohol treatment services in Northern Ireland](https://www.health-ni.gov.uk/publications/census-drug-and-alcohol-treatment-services-northern-ireland-30th-april-2019) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level and is an absolute number. Will need to calculate compared to whoe population for a per 100k number. | :x: | +| Healthy Lives | Drug Misuse | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Lives | Healthy Eating | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Physical Activity | :x: | :x: | :x:| :x: Data not collected. | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | From dc2883ecfc760fa0fc6d82487c35816ddaef8388 Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 9 Jan 2025 15:25:05 +0000 Subject: [PATCH 17/24] Updated metadata - noise-complaints Updated metadata - noise-complaints. Now contacted email address. --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 2390678..775d684 100644 --- a/metadata.md +++ b/metadata.md @@ -65,7 +65,7 @@ | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | | Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | -| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). Need to contact aeqteam@daera-ni.gov.uk and ask for raw data in Figure 1 of report | :heavy_exclamation_mark: | +| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). UPDATE: Now contacted aeqteam@daera-ni.gov.uk and asked for raw data in Figure 1 of report | :heavy_exclamation_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | From d23d2aa1c3c6d8ceb44fb9de7361a49d1884813b Mon Sep 17 00:00:00 2001 From: CatReid Date: Thu, 9 Jan 2025 16:22:20 +0000 Subject: [PATCH 18/24] Updated metadata - early-years-development Updated metadata - early-years-development. Contacted for data access. --- metadata.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.md b/metadata.md index 775d684..84280ae 100644 --- a/metadata.md +++ b/metadata.md @@ -8,7 +8,7 @@ | Healthy Lives | Physical Activity | :x: | :x: | :x:| :x: Data not collected. | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | | Healthy Lives | Smoking | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Early Years Development | NA | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data unavailable - contact statistics@education-ni.gov.uk | :x: | +| Healthy Lives | Early Years Development | NA | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data unavailable - UPDATED contacted statistics@education-ni.gov.uk (9.1.25) | :x: | | Healthy Lives | Pupil Absence | 2021/22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of unauthorised school absences| :heavy_check_mark: | | Healthy Lives | GCSE Achievement | 2022-23 | [NISRA](https://data.nisra.gov.uk/) | [NISRA](https://data.nisra.gov.uk/) | :heavy_check_mark: Indicator: Percentage of GSCE attainment, including Maths and English (Grades A-C) | :heavy_check_mark: | | Healthy Lives | Young People's Education, Employment and Training | 2018 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | @@ -65,7 +65,7 @@ | Healthy Places | Personal Crime | 2017 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Personal crime per 1,000 people. | :heavy_check_mark: | | Healthy Places | Low-Level Crime | :x: | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Places | Air Pollution | 2019 | [DEFRA](https://uk-air.defra.gov.uk/data/pcm-data) | [OGL3](https://www.gov.scot/crown-copyright/) | :heavy_check_mark: | :heavy_check_mark: | -| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). UPDATE: Now contacted aeqteam@daera-ni.gov.uk and asked for raw data in Figure 1 of report | :heavy_exclamation_mark: | +| Healthy Places | Noise Complaints | 2024 | [DAERA](https://www.daera-ni.gov.uk/sites/default/files/publications/daera/Noise%20Complaint%20Statistics%20for%20NI%202023-24.PDF) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Raw data currently unavailable (only in a report). UPDATE: Now contacted aeqteam@daera-ni.gov.uk and asked for raw data in Figure 1 of report (9.1.25) | :heavy_exclamation_mark: | | Healthy Places | Road Safety | :x: | :x: | :x: | :x: - data unavailable | :x: | | Healthy Places | Road Traffic Volume | :x: | :x: | :x: | :x: Indicator not overtly present in England's Health Index. To review at the end. | :x: | | Healthy Places | Internet access | :x: | :x: | :x: | :x: TO DO | :x: | From 6c7e65f9fac718eaa2570165c2fd3c083d36e36c Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 08:36:36 +0000 Subject: [PATCH 19/24] Updated metadata - early-years-development Updated metadata - early-years-development. No data available - received response 10.1.25. --- metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.md b/metadata.md index 84280ae..8ff147d 100644 --- a/metadata.md +++ b/metadata.md @@ -8,7 +8,7 @@ | Healthy Lives | Physical Activity | :x: | :x: | :x:| :x: Data not collected. | :x: | | Healthy Lives | Sedentary Behaviour | :x: | :x: | :x:| :x: - Data unavailable | :x: | | Healthy Lives | Smoking | 2022-23 | [Health Survey Northern Ireland](https://www.health-ni.gov.uk/publications/health-survey-northern-ireland-first-results-202223) | :x: | :heavy_exclamation_mark: - The data is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Early Years Development | NA | [NISRA](https://datavis.nisra.gov.uk/dissemination/NINIS-redirect.html) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data unavailable - UPDATED contacted statistics@education-ni.gov.uk (9.1.25) | :x: | +| Healthy Lives | Early Years Development | :x: | :x: | :x: Data unavailable. | :x: | | Healthy Lives | Pupil Absence | 2021/22 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: Indicator: Percentage of unauthorised school absences| :heavy_check_mark: | | Healthy Lives | GCSE Achievement | 2022-23 | [NISRA](https://data.nisra.gov.uk/) | [NISRA](https://data.nisra.gov.uk/) | :heavy_check_mark: Indicator: Percentage of GSCE attainment, including Maths and English (Grades A-C) | :heavy_check_mark: | | Healthy Lives | Young People's Education, Employment and Training | 2018 | [NISRA](https://www.ninis2.nisra.gov.uk) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_check_mark: | :heavy_check_mark: | From d62e0002a733183b42eb805cd5ceec1a79ba66ee Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 12:37:23 +0000 Subject: [PATCH 20/24] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7cc8b6a..5d090d6 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ po/*~ # RStudio Connect folder rsconnect/ .Rproj.user +*.xlsx From 4109cdeddbab32e0b475debd8be0bc2f45ea7dba Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 13 Jan 2025 12:46:22 +0000 Subject: [PATCH 21/24] Created noise-complaints data and uploaded raw file Created noise-complaints data and uploaded raw file --- data-raw/healthy-people/noise-complaints.R | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 data-raw/healthy-people/noise-complaints.R diff --git a/data-raw/healthy-people/noise-complaints.R b/data-raw/healthy-people/noise-complaints.R new file mode 100644 index 0000000..a683706 --- /dev/null +++ b/data-raw/healthy-people/noise-complaints.R @@ -0,0 +1,3 @@ +# Raw data files were not available to download from online. +# Noise-complaints data was available from a published reported (sourced below). +# From ef1102d49f80f40e4228536caf38b72cca1d97c6 Mon Sep 17 00:00:00 2001 From: CatReid Date: Mon, 20 Jan 2025 16:03:33 +0000 Subject: [PATCH 22/24] First draft redone - cancer First draft redone - cancer, styled and rendered. data.R and metadata updated. --- data-raw/healthy-people/cancer.R | 27 +++++++++++++++++++++++++++ metadata.md | 3 +-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/data-raw/healthy-people/cancer.R b/data-raw/healthy-people/cancer.R index e69de29..fcdbd91 100644 --- a/data-raw/healthy-people/cancer.R +++ b/data-raw/healthy-people/cancer.R @@ -0,0 +1,27 @@ +# ---- Load packages ---- +library(tidyverse) + +# ---- Get and clean data ---- +# Cancer Data +# Source: https://data.nisra.gov.uk/ + +url <- "https://ws-data.nisra.gov.uk/public/api.restful/PxStat.Data.Cube_API.ReadDataset/DISPREVLGD/CSV/1.0/" +cancer_raw <- read_csv(url) + +people_cancer <- cancer_raw |> + filter( + `Statistic Label` == "Raw disease prevalence per 1,000 patients", + `Disease` == "Cancer", + `Financial Year` == "2023/24", + `LGD2014` != "N92000002" + ) |> + rowwise() |> + mutate(cancer_percentage = VALUE / 10) |> + select( + ltla24_code = LGD2014, + cancer_percentage, + year = `Financial Year` + ) + +# ---- Save output to data/ folder ---- +usethis::use_data(people_cancer, overwrite = TRUE) diff --git a/metadata.md b/metadata.md index d168570..bb1a737 100644 --- a/metadata.md +++ b/metadata.md @@ -16,8 +16,7 @@ | Healthy Lives |Cardiovascular Conditions | 2023/24 | [NISRA](https://data.nisra.gov.uk/k) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available as separate conditions (CHD, COPD, Heart Failure 1 & 3, Stroke and TIA) as a rate per 1,000. To be comparable to England's Index must be shown as a %. To review at the end. | :x: | | Healthy Lives | High Blood Pressure | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.ninis2.nisra.gov.uk/public/terms.aspx) | :heavy_exclamation_mark: Data only available for raw prevalence rate. Percentage required to best match England's Health Index. | :x: | | Healthy Lives | Overweight and Obesity in Adults | :x: | :x: | :x: | :x: - Data unavailable. | :x: | -| Healthy Lives | Cancer Screening | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x:| ❗: - The data (breast, bowel, and cervical cancers) is at the Health and Social Care Trusts level | :x: | -| Healthy Lives | Sexual Health | :x: | :x: | :x: | :x: - Data unavailable. | :x: | +| Healthy Lives | Cancer Screening | 2023-24 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_check_mark: Indicator: Percentage of people with cancer| :heavy_check_mark: | | Healthy Lives | Vaccination Coverage | 2022/23 | [Public Health](https://www.publichealth.hscni.net/publications/director-public-health-core-tables-2022) | :x: | ❗: - The data is at the Health and Social Care Trusts level | :x: | | Healthy Lives | Children in State Care | :x: | :x: | :x: | ❗: - Indicator not overtly present in England's HI. To review at the end (and likely remove) | :x: | | Healthy Lives | Infant Mortality | 2018-2022 | [NISRA](https://data.nisra.gov.uk/) | [OGL3](https://www.nisra.gov.uk/crown-copyright) | :heavy_exclamation_mark: Data only present at HSC level| :x: | From 09843d9efd48eb33494d5c4885ffdcef7717e258 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:06:11 +0100 Subject: [PATCH 23/24] Convert chr to dbl --- data-raw/healthy-lives/healthy-eating.R | 3 ++- data/lives_healthy_eating.rda | Bin 347 -> 348 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data-raw/healthy-lives/healthy-eating.R b/data-raw/healthy-lives/healthy-eating.R index 6fbb69d..519fe46 100644 --- a/data-raw/healthy-lives/healthy-eating.R +++ b/data-raw/healthy-lives/healthy-eating.R @@ -54,7 +54,8 @@ lives_healthy_eating <- healthy_eating_hb |> healthy_eating_percentage, year ) |> - arrange(ltla24_code) + arrange(ltla24_code) |> + mutate(healthy_eating_percentage = as.numeric(healthy_eating_percentage)) # ---- Save output to data/ folder ---- usethis::use_data(lives_healthy_eating, overwrite = TRUE) diff --git a/data/lives_healthy_eating.rda b/data/lives_healthy_eating.rda index 1116dc73996933bb4b3e8796d73d861ccc899e1c..6556ae6fa162e8c006b8e457c79678f77073bd56 100644 GIT binary patch literal 348 zcmV-i0i*sxT4*^jL0KkKS%5jlbpQb-fA9ahY#_)9|KWrYF+soQ-Jrlg078HOpn(Dg zG5|smumKo0!&N;@jDP^qrhotg5ri5515G^;8mRRir>JPrpfnl)01Sg50BNJq00|_7 znLL_m4GjPWn2iQa4H*HT29G9@!AcsDkx^ht#BRZ=$E63$v*L{sFm*Of-v@w7{VJqX z1Xi`a?EVNV@Yu6zEEL@wfwajgpaURM43i*mIXuX701Kj{lEyH7SB2vt>PmkG7o`YN zD@cGfk{(FDkp7HAXF!o{B8o-ih@VKHGa>YeNqXAPZui@W8@uo=q+dBEFL%yy*rr{% zjrQU$91-h81qIT|Es?Y!93oJ63_Ka6g?IfD0y}_^nJ}pB)ETY>4ni^8;8r3e28m1d umJI}p>?Bl!O@XGGI literal 347 zcmV-h0i^yyT4*^jL0KkKS&Vje`v3u`f588`OdtRO|KJ1x5J11@-Jn1K0s*iAT7d?M zPbuh`q+}X2+Kn;*88poxzyLG=22B6}27pNvz)`7*gaByB)6@Vm94m_Z%yeK$(|j#Z z(*!RL8}CGzFm4t5xgZZm)lpC2nHA{Ulo1fmioIk__mA#qX3)|3=jsT5-~1&IXdASMtdSg`_iqcp<93=$z2 zxl$zw7ZnSM)gokINT^}0BVODo*TCDed>dJ_@OXT=5=m#>Tr t?g)j;78zvGfR%EwcB!W^goy0IK#*|lm|OSvz+nH2xgwk>NJcw5eSiTAi~Ilp From 4749e00657dd86b658b4b1be7b2d087aae699ac7 Mon Sep 17 00:00:00 2001 From: MikeJohnPage <38110953+MikeJohnPage@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:35:14 +0100 Subject: [PATCH 24/24] Convert chr to dbl --- data-raw/healthy-lives/smoking.R | 3 ++- data/lives_smoking.rda | Bin 345 -> 343 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data-raw/healthy-lives/smoking.R b/data-raw/healthy-lives/smoking.R index 0ba0ce5..240eb75 100644 --- a/data-raw/healthy-lives/smoking.R +++ b/data-raw/healthy-lives/smoking.R @@ -48,7 +48,8 @@ lives_smoking <- smoking_hb |> smoking_percentage, year ) |> - arrange(ltla24_code) + arrange(ltla24_code) |> + mutate(smoking_percentage = as.numeric(smoking_percentage)) # ---- Save output to data/ folder ---- usethis::use_data(lives_smoking, overwrite = TRUE) diff --git a/data/lives_smoking.rda b/data/lives_smoking.rda index 7204e69be8051a4e8cffb2dbace28f28f44ac909..12a3d0ba11ca6345f0e3c84123f966da71826a85 100644 GIT binary patch literal 343 zcmV-d0jT~$T4*^jL0KkKSsndlbpQb@|NsBLSp+~4|KOY<5J11L{h&e!00{sD5F{}H z1V8{F0s*iA7$h}KL(*v4L7|8M05kvq8fajTP&mnxMj@t#0%&4r(s!{9W3eS@UV#(Ff|*QAOS2j zZ4putEZfg!=S z_uiWSL$Jx6Fw92E3%#Q`3Bx4+r-~mhnL^9rT7lrHo34@z4~CrpVlttH&J$`aLMT9s p$c4B%yp{TO`WXP@D1ZNDlt8x`14vk5>Qy literal 345 zcmV-f0jB;!T4*^jL0KkKSy@Br8UO*Pf588`SO5S4|KJ1x5J11L-Jn1K0s*iAT7d?U zN2KzbO-zg+^oD={W~TK)jSUR|84Umc000t50+>mo)CP?jY3ga}28|gG3fXdI*ZLAch1Q z21$@O9G=c$2`#a56|9jYjJQQ32qbDqVIstgIl@U85FBzmCFqe=h2CRV129S;FwQI| zVWJ5bq+VPT86u&1wIX3IS%jESCNf2ghY%!nk{mir5h6e>91b6xr0D}ar3wW{g-V5L zNPFT=0a6nv8Hx&HMowgis1F`xts`DJU#rK<_3g8HvKyjDx0b;$YR>D_4O}G_7@9$N r%Gi5ZQX`zjOPEzlEs5xj0Y?y@;n3