Skip to content

Commit

Permalink
Merge pull request #48 from Public-Health-Scotland/dec24-mi-release
Browse files Browse the repository at this point in the history
Dec24 mi release
  • Loading branch information
Jennit07 authored Dec 10, 2024
2 parents 8fe43a9 + 0afb32d commit 098db4a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
9 changes: 5 additions & 4 deletions code/00_setup-environment.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
test_output <- TRUE

# UPDATE - Last day in reporting period (ddmmyyyy)
end_date <- lubridate::dmy(30062024)
previous_end_date <- lubridate::dmy(31032024)
end_date <- lubridate::dmy(30092024)
previous_end_date <- lubridate::dmy(30062024)

# UPDATE - Most recent Date of publication (ddmmyyyy)
# Need this for set up of some folder structure
Expand Down Expand Up @@ -79,8 +79,7 @@ cl_out <- case_when(
### 3 - SIMD Lookup ----

simd <- function(){
read_rds(glue("{cl_out}/lookups/Unicode/",
"Deprivation/postcode_2024_1_simd2020v2.rds")) %>%
simd <- read_rds(get_simd_path()) %>%
clean_names() %>%
select(pc7, simd = simd2020v2_sc_quintile) %>%
mutate(
Expand All @@ -90,6 +89,8 @@ simd <- function(){
TRUE ~ as.character(simd)
)
)

return(simd)
}


Expand Down
6 changes: 3 additions & 3 deletions code/01_data-preparation.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pds <-
)


### 4 - Save out error summary
### 4 - Save out error summary ----

err <- pds %>%
mutate(health_board = if_else(is.na(health_board),
Expand Down Expand Up @@ -182,7 +182,7 @@ dupes <-
write_file(path = get_mi_data_path("dupe_data", ext = "csv", test_output = test_output))
0 # this zero stops script from running IF write_file is overwriting an existing file, re-run the section without this line and enter 1 in the console, when prompted, to overwrite file.

### 7 - Remove duplicate records ---
### 7 - Remove duplicate records ----
pds %<>%

filter(dupe_keep == 1) %>%
Expand All @@ -195,7 +195,7 @@ pds %<>%
select(-contains("dupe"))


### 8 - Save data ---
### 8 - Save data ----

pds %>%
write_file(path = get_mi_data_path("clean_data", ext = "rds", test_output = test_output))
Expand Down
3 changes: 2 additions & 1 deletion code/04_ldp_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ source(here::here("functions", "produce_tests.R"))
# Read latest data---
latest_data <- read_rds(get_mi_data_path(type = "final_data",
"rds",
test_output = FALSE)) %>%
test_output = test_output)) %>%
# Remove codes from board and IJB
clean_geog_codes()

# read previous years data---
previous_data <- read_rds(get_mi_data_path(type = "final_data",
"rds",
test_output = FALSE,
previous_data = TRUE)) %>%
# Remove codes from board and IJB
clean_geog_codes()
Expand Down
4 changes: 2 additions & 2 deletions management-report/markdown/management-report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ This report has been produced by Public Health Scotland (PHS) and contains analy

<span style="color:red"> **The information contained in this report is for management information only and should not be distributed widely.** </span>

**Please note that both the Dementia Post Diagnostic Support service provision and data submission to PHS have been affected by the COVID-19 pandemic.**

These reports reflect the [Dementia PDS dataset](https://publichealthscotland.scot/media/20921/2023-12-14-dementia-pds-definitions-and-recording-guidance-v14.pdf) effective 01 April 2019 and contain data for individuals diagnosed with dementia between **`r format(dmy(01042016), "%d %B %Y")`** and **`r format(end_date, "%d %B %Y")`** who were referred for post diagnostic support.

Data are submitted to PHS by health boards on a quarterly basis. Each health board provides updated information for all individuals referred for post diagnostic support with a diagnosis date from `r format(start_date, "%d %B %Y")` onwards. Therefore, data for diagnoses from this date onwards are refreshed in each management report and are based on the most recently submitted data.
Expand Down Expand Up @@ -103,6 +101,8 @@ Row

*Please note the following:*

**Please note that both the Dementia Post Diagnostic Support service provision and data submission to PHS were affected by the COVID-19 pandemic.**

**NHS Orkney** – NHS Orkney had no referrals in *2022/23* (*Q3* and *Q4*) and *2023/24* (*Q1* and *Q2*) as they were unable to access a consultant psychiatrist.

**NHS Shetland** - NHS Shetland did not have a PDS worker in post from *2022/23 Q1* through *2023/24 Q3*. As a result not all people referred to PDS could be allocated or contacted by a PDS worker within 12 months of diagnosis, hence they have been recorded as not having met the standard. A PDS worker was assigned in *2023/24 Q4* and the PDS service in Shetland has resumed.
Expand Down
9 changes: 8 additions & 1 deletion management-report/markdown/subpage-hb.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ qt_text <-
}
}
# text to state impact of Covid 19
covid_text <-
case_when(
str_sub(sel_fy, 1, 4) == "2020" ~
"**Please note that both the Dementia Post Diagnostic Support service provision and data submission to PHS have been affected by the COVID-19 pandemic.**",
TRUE ~ ""
)
# Text to explain incomplete years / referrals still ongoing
latest_final_year <- dmy(paste0("0104",substr(finalised_years[length(finalised_years)],1,4)))
Expand Down Expand Up @@ -209,7 +216,7 @@ Row

### **Note**

**Please note that both the Dementia Post Diagnostic Support service provision and data submission to PHS have been affected by the COVID-19 pandemic.**
`r covid_text`

`r completeness_text`

Expand Down
10 changes: 9 additions & 1 deletion management-report/markdown/subpage-scotland.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ qt_text <-
}
}
# text to state impact of Covid 19
covid_text <-
case_when(
str_sub(sel_fy, 1, 4) == "2020" ~
"**Please note that both the Dementia Post Diagnostic Support service provision and data submission to PHS have been affected by the COVID-19 pandemic.**",
TRUE ~ ""
)
# Text to explain incomplete years / referrals still ongoing
latest_final_year <- dmy(paste0("0104",substr(finalised_years[length(finalised_years)],1,4)))
Expand Down Expand Up @@ -205,7 +213,7 @@ Row

### **Note**

**Please note that both the Dementia Post Diagnostic Support service provision and data submission to PHS have been affected by the COVID-19 pandemic.**
`r covid_text`

`r completeness_text`

Expand Down

0 comments on commit 098db4a

Please sign in to comment.