From 82d7906c758cc03edd3f1940617600bb4916e85a Mon Sep 17 00:00:00 2001 From: CatReid Date: Tue, 7 Jan 2025 16:04:27 +0000 Subject: [PATCH] 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: |