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

Major update of Care Home script #945

Merged
merged 42 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6efb78b
# major changes to care home script
Apr 29, 2024
487fae7
minor note updates
Apr 29, 2024
2ece590
Style code
SwiftySalmon Apr 29, 2024
faaaa50
Merge branch 'June-24-update' into care_home_update
Jennit07 May 6, 2024
45eee7b
Merge branch 'June-24-update' into care_home_update
Jennit07 May 7, 2024
20ec898
Merge branch 'master' into care_home_update
SwiftySalmon Jun 19, 2024
35918e4
Update documentation
SwiftySalmon Jun 19, 2024
7c7f2d7
couple of note updates
Jun 20, 2024
e7a90f5
Update R/process_sc_all_care_home.R
SwiftySalmon Jun 20, 2024
db5b372
Update R/process_sc_all_care_home.R
SwiftySalmon Jun 20, 2024
be05f47
Style code
SwiftySalmon Jun 20, 2024
c993b5b
Update R/process_sc_all_care_home.R
SwiftySalmon Jun 20, 2024
06dbab6
change to ch name lookup
Jun 20, 2024
471e9f1
Merge branch 'care_home_update' of github.com:Public-Health-Scotland/…
Jun 20, 2024
504c1bd
Update documentation
SwiftySalmon Jun 20, 2024
7721dd9
remove fill ch provider fill line
Jun 20, 2024
70f6343
Merge branch 'care_home_update' of github.com:Public-Health-Scotland/…
Jun 20, 2024
8b3679b
update fill ch names so it works with new ch methodology
Jul 3, 2024
b78abfe
Style code
SwiftySalmon Jul 3, 2024
a5fbbb8
Merge branch 'september-2024' into care_home_update
Jennit07 Jul 5, 2024
49ebb85
Update documentation
Jennit07 Jul 5, 2024
e999820
Merge branch 'september-2024' into care_home_update
Jennit07 Jul 5, 2024
bdc4f86
Merge branch 'september-2024' into care_home_update
Jennit07 Jul 5, 2024
5d1e27c
Merge branch 'september-2024' into care_home_update
SwiftySalmon Jul 16, 2024
48b5b8b
Style code
SwiftySalmon Jul 16, 2024
ee5f663
Update documentation
SwiftySalmon Jul 16, 2024
02e0d66
Remove redundant variable `latest_sc_id`
Jennit07 Jul 16, 2024
1a6c230
use slfhelper::get_chi
Jennit07 Jul 17, 2024
58bc740
new section for sc_ch_id_markers
Jennit07 Jul 17, 2024
0845a7b
Style code
Jennit07 Jul 17, 2024
fc9b6a4
Update documentation
Jennit07 Jul 17, 2024
ba19735
Remove extra text and white space
Jennit07 Jul 17, 2024
3c2e288
Merge branch 'september-2024' into care_home_update
Jennit07 Jul 29, 2024
5312011
Merge branch 'september-2024' into care_home_update
Jennit07 Aug 7, 2024
fcb1eac
add rename to use death_date_chi
Jennit07 Aug 7, 2024
1c71d78
use `read_excel` function
Jennit07 Aug 7, 2024
71d7a6b
Update documentation
Jennit07 Aug 7, 2024
6ad114f
Return the paths only for SPD and ch name
Jennit07 Aug 7, 2024
7ac901f
Update documentation
Jennit07 Aug 7, 2024
a30600c
Remove rename - no longer needed
Jennit07 Aug 7, 2024
3dae4e1
fix typo
Jennit07 Aug 7, 2024
9709bcb
remove variables that dont exist
Jennit07 Aug 7, 2024
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
1 change: 1 addition & 0 deletions R/add_activity_after_death_flag.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
#'
#'
# Read data------------------------------------------------

process_combined_deaths_lookup <- function(update = latest_update(),
write_to_disk = TRUE, ...) {
dir_folder <- "/conf/hscdiip/SLF_Extracts/Deaths"
Expand All @@ -135,7 +136,7 @@

# read all year specific deaths lookups and bind them together
all_boxi_deaths <- lapply(file_names, arrow::read_parquet) %>%
data.table::rbindlist() %>%

Check failure on line 139 in R/add_activity_after_death_flag.R

View workflow job for this annotation

GitHub Actions / Check Spelling

`rbindlist` is not a recognized word. (unrecognized-spelling)
# convert to chi for processing
slfhelper::get_chi() %>%
# Remove rows with missing or blank CHI number - could also use na.omit?
Expand Down
10 changes: 1 addition & 9 deletions R/fill_ch_names.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fill_ch_names <- function(ch_data,
"match_mean2",
# "open_interval",
"ch_admission_date",
"qtr_start",
"period_start_date",
"ch_date_registered",
"latest_close_date",
"ch_active",
Expand Down Expand Up @@ -305,7 +305,6 @@ fill_ch_names <- function(ch_data,
"unique_identifier",
"matching_quality_indicator",
"sending_location",
"latest_sc_id",
"chi",
"ch_name",
"ch_postcode",
Expand All @@ -320,9 +319,6 @@ fill_ch_names <- function(ch_data,
"ch_admission_date",
"ch_discharge_date",
"age",
"record_date",
"qtr_start",
"latest_flag",
"gender",
"dob",
"postcode",
Expand Down Expand Up @@ -763,7 +759,6 @@ fill_ch_names <- function(ch_data,
## produce output ----
col_output <- c(
"sending_location",
"latest_sc_id",
"chi",
"ch_name",
"ch_postcode",
Expand All @@ -778,9 +773,6 @@ fill_ch_names <- function(ch_data,
"ch_admission_date",
"ch_discharge_date",
"age",
"record_date",
"qtr_start",
"latest_flag",
"gender",
"dob",
"postcode",
Expand Down
2 changes: 1 addition & 1 deletion R/process_extract_care_home.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ process_extract_care_home <- function(
is_date_in_fyyear(year, .data$record_keydate1, .data$record_keydate2)
) %>%
# remove any episodes where the latest submission was before the current year
# this is what stops cases being in future files
dplyr::filter(
substr(.data$sc_latest_submission, 1L, 4L) >= convert_fyyear_to_year(year)
)


# Data Cleaning ---------------------------------------
source_ch_clean <- ch_data %>%
# create variables
Expand Down
4 changes: 2 additions & 2 deletions R/process_lookup_sc_demographics.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ process_lookup_sc_demographics <- function(
dplyr::ungroup()

# check to make sure all cases of chi are still there
dplyr::n_distinct(sc_demog_lookup$chi) # 524810
dplyr::n_distinct(sc_demog_lookup$social_care_id) # 636404
dplyr::n_distinct(sc_demog_lookup$chi) # 525,834
dplyr::n_distinct(sc_demog_lookup$social_care_id) # 637,422

sc_demog_lookup <- sc_demog_lookup %>%
slfhelper::get_anon_chi()
Expand Down
Loading
Loading