Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First draft completed - respiratory-conditions #25

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,24 @@
#' @source \url{https://data.nisra.gov.uk/}
"places_household_overcrowding"

#' 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
Expand Down
37 changes: 37 additions & 0 deletions data-raw/healthy-people/respiratory-conditions.R
Original file line number Diff line number Diff line change
@@ -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)
Binary file added data/people_respiratory_conditions.rda
Binary file not shown.
28 changes: 28 additions & 0 deletions man/people_respiratory_conditions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_check_mark: Indicator: Percentage of households experiencing overcrowding| :heavy_check_mark: |
Expand Down