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

Merge Dec-update-23 branch into master #890

Merged
merged 212 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 208 commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
d9ac7ca
Bump `{slfhelper}` version
Moohan Jul 26, 2023
d731bf7
Remove unnecessary code from `get_anon_chi` (#759)
SwiftySalmon Jul 28, 2023
1269b3b
Set the default reporter for `tar_outdated()` and friends
Moohan Jul 31, 2023
1ea0a1a
Comment out dataset writing targets
Moohan Jul 31, 2023
965f05c
Make sure `year` is added as the first variable
Moohan Jul 31, 2023
d75922a
Correct some documentation (#769)
Moohan Aug 1, 2023
5fd538f
Make some changes suggested by lintr
Moohan Aug 1, 2023
4c9c175
Document
Moohan Aug 1, 2023
6e55e84
Merge branch 'master' into development
Moohan Aug 1, 2023
9644e0e
Fix documentation typo
Moohan Aug 1, 2023
42e461f
Investigate missing datazone from episode file (#773)
Jennit07 Aug 2, 2023
720b20d
Remove some obsolete code (#770)
Moohan Aug 2, 2023
4a03434
Simplify `create_hscp_test_flags` (#772)
Jennit07 Aug 2, 2023
f6be11c
Rewrite case when statements (#780)
SwiftySalmon Aug 3, 2023
bb3dbd5
Update R-CMD-check.yaml (#781)
Moohan Aug 4, 2023
04399a4
added solve for hscp names (#789)
SwiftySalmon Aug 9, 2023
3820c19
Fix locality (#802)
Moohan Aug 14, 2023
f15039c
Merge branch 'development' into sept-update-23
Jennit07 Aug 14, 2023
8ea15c0
Add simple scripts for running targets as a workbench job (#767)
Moohan Aug 14, 2023
80799a2
Fix CHI duplicates of chi in individual file (#791)
lizihao-anu Aug 14, 2023
19779e3
Update NSU code for new 22/23 cohort (#784)
Jennit07 Aug 14, 2023
7e3215d
Amend `get_boxi_extract_path` function for archiving DN and CMH data …
Jennit07 Aug 14, 2023
612e069
Fix increase in total preventable beddays (#779)
lizihao-anu Aug 14, 2023
51a0b05
fix warning on `:=` (#797)
lizihao-anu Aug 15, 2023
0f25195
Add 2324 targets/workbench job file
Moohan Aug 14, 2023
c4a54f8
Use `get_source_extract_path` in homelessness (#796)
Moohan Aug 14, 2023
e36c97c
Correct tests for NSU
Moohan Aug 14, 2023
62a4174
Update script for extracting NSU from SMRA space
Jennit07 Aug 15, 2023
d310dfd
Update year in 99_NSU extract script
Jennit07 Aug 15, 2023
51c4a63
Update news for September 23 update (#811)
Jennit07 Aug 15, 2023
ee3943f
Apply styling
Jennit07 Aug 16, 2023
61283cc
Fix issue with `case_match` types (#810)
Moohan Aug 16, 2023
c88562c
Bug - Outpatients tests failing due to missing HSCP (#816)
Jennit07 Aug 16, 2023
1e06921
fix read_sc_all_alarms_telecare with incorrect format in period (#814)
lizihao-anu Aug 16, 2023
2c6853c
Fix `convert_sending_location_to_lca` example
Moohan Aug 16, 2023
ff4d35f
Use `col_select` instead of `columns` in tests
Jennit07 Sep 1, 2023
53ede24
Add tests for `compute_mid_year_age` (#809)
Moohan Sep 25, 2023
04c2685
Add a new function to set up keyring (#800)
Moohan Sep 25, 2023
9652c69
Add additional tests for `get_file_path` (#808)
Moohan Sep 25, 2023
bc2e4b3
Rename `run_episode_file()` -> `create_episode_file()` (#803)
Moohan Sep 25, 2023
854868e
Remove incorrect references to rds (#798)
Moohan Sep 25, 2023
ad98c3c
Make targets and tarchetypes required packages (#799)
Moohan Sep 25, 2023
a5bc79e
Update episode file functions to pass data through (#754)
Moohan Sep 26, 2023
b7ce1b1
Tests/it extract path (#807)
Moohan Sep 26, 2023
2f6f25c
Update workflow to run against the development branch (#795)
Moohan Sep 26, 2023
50f4ef9
Remove package wide imports of `readr` (#792)
Jennit07 Sep 26, 2023
e76176e
Handle OpenData extracts better (#794)
Moohan Sep 26, 2023
81c2191
Fix the pkgdown site/job (#804)
Moohan Sep 26, 2023
85f9702
Add new 'final' file path functions (#787)
Jennit07 Sep 26, 2023
b1a7e56
Check scripts are in snake case (#793)
Jennit07 Sep 26, 2023
15a7856
transform the python script for sorting BI extracts to R (#833)
lizihao-anu Sep 27, 2023
3208dc3
Merge branch 'master' into development
Jennit07 Sep 28, 2023
dde0708
Use `get_slf_episode_path` in right place
Jennit07 Sep 28, 2023
9d826cd
fix pipe
Jennit07 Sep 28, 2023
36826c5
Fix typo in string
Jennit07 Sep 28, 2023
a55d69a
Update documentation
Jennit07 Sep 28, 2023
2e1cc9c
Remove outdated comment (#841)
Jennit07 Oct 2, 2023
e5335c4
Use `create_sending_location_test_flags` in demographic tests (#843)
Jennit07 Oct 2, 2023
d586df3
00 sort bi extracts (#837)
lizihao-anu Oct 11, 2023
8c5cd27
remove rename of hscp - keeps breaking tests
Jennit07 Oct 18, 2023
82b0c34
Add parameter to `write_tests_xlsx` for sorting
Jennit07 Oct 18, 2023
f007c56
add parameter for sorting tests into workbooks
Jennit07 Oct 18, 2023
d1a9651
Style code
Jennit07 Oct 18, 2023
9311cd9
Fix bug in `get_source_extract_path
Jennit07 Oct 27, 2023
710338e
Update indiv tests to use `anon_chi`
Jennit07 Oct 27, 2023
335d939
Update workbook name for extracts
Jennit07 Oct 27, 2023
bd35829
Fix typo
Jennit07 Oct 27, 2023
5ea80ae
Fix bug in test where hscp named differently
Jennit07 Oct 27, 2023
756768b
Style code
Jennit07 Oct 27, 2023
1759754
Merge branch 'improve_tests' into sc_at_tests
Jennit07 Oct 30, 2023
ca6b35e
simplify selection of test variables
Jennit07 Oct 30, 2023
45ae78b
rename test flag function
Jennit07 Oct 30, 2023
a5f4803
split out and use `produce_sc_all_episodes_tests`
Jennit07 Oct 30, 2023
d755afd
New function for sc all alarms telecare tests
Jennit07 Oct 30, 2023
3146828
Style code
Jennit07 Oct 30, 2023
8912ebb
- Added a new function to `fix_sc_dates` to set any missing end dates…
Oct 31, 2023
214066c
Update documentation
SwiftySalmon Oct 31, 2023
84a1e9c
Merge branch 'dec-update-23' into fix-missing-end-dates-for-social-ca…
SwiftySalmon Oct 31, 2023
a60f54e
Style code
SwiftySalmon Oct 31, 2023
8ebaba0
Update R/fix_sc_dates.R
SwiftySalmon Oct 31, 2023
6986f47
Update R/process_sc_all_alarms_telecare.R
SwiftySalmon Oct 31, 2023
d5fa466
Style code
SwiftySalmon Oct 31, 2023
126ed90
fix year missing causing corruption of case_when
lizihao-anu Nov 1, 2023
23279ed
Style code
lizihao-anu Nov 1, 2023
d68ede8
rename function to include `all`
Jennit07 Nov 6, 2023
bd89359
Update documentation
Jennit07 Nov 6, 2023
7ec87ce
Tests for all HC eps
Jennit07 Nov 6, 2023
1be9cbd
Tests for all SDS eps
Jennit07 Nov 6, 2023
935bddf
Update documentation
Jennit07 Nov 6, 2023
e6b35fc
- added in period start and end date to `read_sc_all_home_care` and …
Nov 6, 2023
1bc5466
home care
Nov 6, 2023
69c8b75
`process_sc_all_sds`
Nov 6, 2023
5153d6a
Merge branch 'fix-missing-end-dates-for-social-care-data' of github.c…
Nov 6, 2023
dca7a52
Style code
SwiftySalmon Nov 6, 2023
401cfd2
Add filter for CHI
Jennit07 Nov 7, 2023
f7f2c38
Use `replace_sc_id_with_latest` in SDS processing
Jennit07 Nov 7, 2023
b75259f
Use `replace_sc_id_with_latest()` earlier script
Jennit07 Nov 7, 2023
804ff4c
Bug- deal with NA and missing `group_by()`
Jennit07 Nov 7, 2023
b933e29
Do not pull this one. Just need to commit before switching branches
Nov 9, 2023
ece6211
Add `ungroup()` which was missing from code
Jennit07 Nov 13, 2023
2474085
Tidy up of code for AT, SDS, HC
Nov 16, 2023
b91c8bf
Style code
SwiftySalmon Nov 16, 2023
94ea9d9
Bug - Deal with NA in `ch_provider` and missing `group_by()` (#858)
SwiftySalmon Nov 20, 2023
c5db96e
added in replace social care id function to AT
Nov 20, 2023
91f230d
Style code
SwiftySalmon Nov 20, 2023
41bb13a
Bug - `replace_sc_with_latest` not being used in social care (#857)
SwiftySalmon Nov 20, 2023
7316695
Merge branch 'dec-update-23' into improve_tests
SwiftySalmon Nov 20, 2023
2516492
Put `rename_hscp` into a function
Jennit07 Nov 20, 2023
6bd69de
Style code
Jennit07 Nov 20, 2023
24939d6
Use `rename_hscp` function
Jennit07 Nov 20, 2023
7d57a02
Merge branch 'improve_tests' into sc_at_tests
Jennit07 Nov 20, 2023
88535db
Update targets script with social care tests
Jennit07 Nov 21, 2023
78b8175
Merge branch 'dec-update-23' into fix-missing-end-dates-for-social-ca…
Jennit07 Nov 21, 2023
a2892eb
Make improvements to test workbooks (#849)
SwiftySalmon Nov 21, 2023
a79b686
Remove sc_client from individual file and add to ep file (#853)
lizihao-anu Nov 21, 2023
a95d8b1
Merge branch 'dec-update-23' into fix-missing-end-dates-for-social-ca…
Jennit07 Nov 21, 2023
2020cde
Merge branch 'dec-update-23' into sc_at_tests
Jennit07 Nov 21, 2023
1059538
Keep population (#847)
lizihao-anu Nov 21, 2023
fc5652f
Create tests for `all` social care extracts (#854)
SwiftySalmon Nov 21, 2023
02259d4
Merge branch 'dec-update-23' into fix-missing-end-dates-for-social-ca…
Jennit07 Nov 22, 2023
b897f94
Style code
Jennit07 Nov 22, 2023
dd01f1f
use data parameter
Jennit07 Nov 22, 2023
b269364
Update references
Jennit07 Nov 22, 2023
e5d9f5e
Update DD file to use parquet
Jennit07 Nov 22, 2023
d870b16
BUG - remove duplicate function
Jennit07 Nov 22, 2023
2d9c8d8
BUG - update `check_year_valid`
Jennit07 Nov 22, 2023
427cca1
Bug - specify `readr::cols`
Jennit07 Nov 22, 2023
03d1cb5
Bug - missing `dplyr::ungroup()`
Jennit07 Nov 22, 2023
2e4bfc9
Bug - wrong function name
Jennit07 Nov 22, 2023
861c38d
Bug - fix missing pipe
Jennit07 Nov 23, 2023
da8a3a1
Remove .data$
Jennit07 Nov 23, 2023
5d6b488
couple of typos switched to lower case
Nov 27, 2023
e78d6e2
Update test flag function to look for sc_send_lca
Jennit07 Nov 27, 2023
5cc5c27
Style code
Jennit07 Nov 27, 2023
abc91c8
Change `Check_year_valid` to lowercase
Jennit07 Nov 27, 2023
ee4967f
Update documentation
Jennit07 Nov 27, 2023
bb20848
Merge branch 'fix_sc_test_flags' into bug-check-year-valid
Jennit07 Nov 27, 2023
d9e3bf7
Fix issue with `write_tests_xlsx` function
Jennit07 Nov 27, 2023
ac95662
Fix issue with `write_tests_xlsx` function
Jennit07 Nov 27, 2023
42e345f
Remove future code
Jennit07 Nov 28, 2023
e7f6f52
update documentation
Jennit07 Nov 28, 2023
16065f6
Style code
Jennit07 Nov 28, 2023
a728cf1
Merge branch 'bug-check-year-valid' into bug-future-pkg
Jennit07 Nov 28, 2023
bcd5851
Merge branch 'bug-future-pkg' of github.com:Public-Health-Scotland/so…
Jennit07 Nov 28, 2023
d47e645
Update sparra year to pick up new 2324 file
Jennit07 Nov 30, 2023
085a2be
Update documentation
Jennit07 Nov 30, 2023
dc6b1cd
Style code
Jennit07 Nov 30, 2023
55ee53e
Bug - `future::` when dealing with demographic cohorts (#871)
SwiftySalmon Nov 30, 2023
a848c03
Merge branch 'dec-update-23' into fix_sc_test_flags
SwiftySalmon Nov 30, 2023
268efad
Removed "" string around age
rchlv Dec 4, 2023
e8d71db
Merge branch 'dec-update-23' into fix_sc_test_flags
rchlv Dec 4, 2023
d3bfafd
Bug - fix sc client tests (#869)
rchlv Dec 4, 2023
17c10c1
Use select when dealing with client file
Jennit07 Dec 4, 2023
34e3fd0
Merge branch 'dec-update-23' into include_new_sparra
Jennit07 Dec 4, 2023
364ccef
Update sparra/hhg year available
Jennit07 Dec 4, 2023
7df4721
Style code
Jennit07 Dec 4, 2023
e377f93
Merge branch 'dec-update-23' into fix-missing-end-dates-for-social-ca…
Jennit07 Dec 4, 2023
93cd920
Style code
Jennit07 Dec 4, 2023
4d68a5d
Add comments
Jennit07 Dec 4, 2023
82f31b5
Clean up code/reorder some commands
Jennit07 Dec 4, 2023
8a1a2b5
Style code
Jennit07 Dec 4, 2023
4049d53
Move `replace_sc_id` after demog lookup
Jennit07 Dec 4, 2023
c6105ff
Update cmh and dn year
rchlv Dec 4, 2023
a67d880
Update SPARRA year to pick up new 2324 file (#872)
rchlv Dec 4, 2023
229751f
Merge branch 'dec-update-23' into fix-missing-end-dates-for-social-ca…
rchlv Dec 4, 2023
74ffff9
[check-spelling] Update metadata
rchlv Dec 4, 2023
93fa211
AT, SDS, HomeCare - fix missing end dates (#852)
rchlv Dec 4, 2023
cc89ef3
fixed a few things in the keep population flag.
Dec 4, 2023
e2ebe09
change back to chi instead of anon_chi
Dec 4, 2023
b478b0a
fix typo
Jennit07 Dec 5, 2023
f1d410c
Fix missing pipe `%>%`
Jennit07 Dec 5, 2023
f67a7b2
Filter start date > period end date
Jennit07 Dec 5, 2023
7f6b4ff
Style code
Jennit07 Dec 5, 2023
390c1ba
Merge branch 'dec-update-23' into bug_keep_population_flag
Jennit07 Dec 5, 2023
2815f0e
Style code
Jennit07 Dec 5, 2023
e576e9c
Bug - filter records with start date > period end date (#876)
SwiftySalmon Dec 5, 2023
521bbaf
Merge branch 'dec-update-23' into bug_keep_population_flag
SwiftySalmon Dec 5, 2023
bde322c
Add new script for running process manually
Jennit07 Dec 5, 2023
7d2c51c
Merge branch 'dec-update-23' into bug_keep_population_flag
Jennit07 Dec 5, 2023
9b7a20a
Style code
Jennit07 Dec 5, 2023
854eb70
removed `select` from join_sc_client in episode file script
Dec 7, 2023
5c48418
removed select from join_client in episode file
Dec 7, 2023
b9a6cd9
Style code
SwiftySalmon Dec 7, 2023
01f0d1b
Minor changes to create_indiv_file (#877)
SwiftySalmon Dec 7, 2023
bbf6447
fixed bugs in the keep population flag. (#874)
SwiftySalmon Dec 7, 2023
1dcfbac
Update filter for midpoint year deaths
Jennit07 Dec 7, 2023
94346f7
update rbinom function with `nsu_population` as n
Jennit07 Dec 7, 2023
9134185
Style code
Jennit07 Dec 7, 2023
901034f
Remove sc filter start date>period end date
Jennit07 Dec 8, 2023
76285f8
Merge branch 'dec-update-23' into Bug-keep_pop_nsu
Jennit07 Dec 8, 2023
9b50273
Revert "Remove sc filter start date>period end date"
Jennit07 Dec 11, 2023
34d75ee
Merge branch 'dec-update-23' into Bug-keep_pop_nsu
Jennit07 Dec 11, 2023
46d46f3
Discard any empty tibbles in the list
Jennit07 Dec 11, 2023
ce427c2
Bug - keep population filter and nsu pop not working (#878)
rchlv Dec 11, 2023
f5c7bcb
Bug - `vctrs` error when passing `processed_data_list` (#880)
rchlv Dec 11, 2023
06b21b1
Merge branch 'master' into dec-update-23
Jennit07 Dec 11, 2023
f5bace3
Add comments
Jennit07 Dec 13, 2023
4c285f7
Fix duplicate episode sc send lca (#881)
lizihao-anu Dec 13, 2023
3ec14c5
Add episode file path again
Jennit07 Dec 15, 2023
e15a8a3
Sort targets scripts into a folder
Jennit07 Dec 15, 2023
631631d
remove `run_slf_process_manually.R`
Jennit07 Dec 15, 2023
7eae022
New folder for running SLFs manually
Jennit07 Dec 15, 2023
c982612
Revert CH back to September (#885)
SwiftySalmon Dec 19, 2023
42f762c
update manual running scripts
Jennit07 Dec 19, 2023
28ffa0c
revert to september
Dec 19, 2023
5c916b8
temporary solution to the quarter format issue. Needs urgently solved…
Dec 19, 2023
30ea250
exclude function `check_quarter_format`
Jennit07 Dec 20, 2023
a945ee0
Update year for copy to hscdiip
Jennit07 Dec 20, 2023
5c7eecf
Update documentation
Jennit07 Jan 9, 2024
6aacf5b
Update tests
Jennit07 Jan 9, 2024
1587d62
update DD snapshot tests
Jennit07 Jan 9, 2024
feb274c
exclude some tests for now
Jennit07 Jan 9, 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
7 changes: 5 additions & 2 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
attendcat
aut
bedday
beddays

Check failure on line 12 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`beddays` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 12 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`beddays` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 12 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`beddays` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
birthtime
bodyloc
boxi
Expand All @@ -29,8 +29,8 @@
cls
cmh
CNWs
Comhairle
codecov
Comhairle
commhosp
congen
costincdnas
Expand Down Expand Up @@ -61,13 +61,13 @@
disdest
dminutes
dna
dnas

Check failure on line 64 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`dnas` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 64 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`dnas` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 64 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`dnas` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
dontrun
downup
dplyr
dsn
dtplyr
DVPROD

Check failure on line 70 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`DVPROD` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 70 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`DVPROD` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 70 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`DVPROD` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
dvprod
envir
feb
Expand All @@ -79,7 +79,8 @@
fyyear
geogs
ggplot
github
GLS

Check failure on line 83 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`GLS` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 83 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`GLS` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 83 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`GLS` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
gls
gms
GPOo
Expand All @@ -92,7 +93,7 @@
hbtreatname
hci
HCP
HHG

Check failure on line 96 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`HHG` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 96 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`HHG` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 96 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`HHG` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
hhg
hjust
hms
Expand Down Expand Up @@ -122,11 +123,11 @@
lintr
los
ltc
ltcs

Check failure on line 126 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`ltcs` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 126 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`ltcs` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 126 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`ltcs` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
lubridate
magrittr
Matern
markdownguide
Matern
Mcbride
mcmahon
MMMYY
Expand All @@ -139,7 +140,7 @@
newcons
nhs
nhshosp
NRS

Check failure on line 143 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`NRS` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 143 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`NRS` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 143 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`NRS` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
nrs
nsu
odbc
Expand All @@ -162,7 +163,7 @@
PMS
postcodes
PPAs
Prac

Check failure on line 166 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`Prac` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 166 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`Prac` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 166 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`Prac` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
prac
praccode
ptypes
Expand All @@ -189,7 +190,7 @@
Rprofile
Rscript
rspm
RStudio

Check failure on line 193 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`RStudio` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 193 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`RStudio` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 193 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`RStudio` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
rstudio
rstudioapi
Rtype
Expand All @@ -202,7 +203,7 @@
Siar
sigfac
simd
SLF

Check failure on line 206 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`SLF` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 206 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`SLF` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)

Check failure on line 206 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

`SLF` is ignored by check spelling because another more general variant is also in expect. (ignored-expect-variant)
slf
slfhelper
smr
Expand All @@ -214,6 +215,7 @@
SPSS
spss
stadm
starwars
stefanzweifel
stringdist
stringr
Expand All @@ -239,6 +241,7 @@
xintercept
xlsx
yearstay
yml
YYYYQX
zihao
zsav
Expand Down
2 changes: 1 addition & 1 deletion 00_Sort_BI_Extracts.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ for (csv_file in csv_files) {

# move file
new_file_path <- file.path(financial_year_dir, basename(csv_file))
file.copy(csv_file, new_file_path)
fs::file_copy(csv_file, new_file_path, overwrite = TRUE)
file.remove(csv_file)
cat("Moved:", csv_file, "to", new_file_path, "\n")
}
Expand Down
6 changes: 5 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ export(process_tests_mental_health)
export(process_tests_nrs_deaths)
export(process_tests_outpatients)
export(process_tests_prescribing)
export(process_tests_sc_ch_episodes)
export(process_tests_sc_all_at_episodes)
export(process_tests_sc_all_ch_episodes)
export(process_tests_sc_all_hc_episodes)
export(process_tests_sc_all_sds_episodes)
export(process_tests_sc_client_lookup)
export(process_tests_sc_demographics)
export(process_tests_sds)
Expand Down Expand Up @@ -166,6 +169,7 @@ export(read_sc_all_alarms_telecare)
export(read_sc_all_care_home)
export(read_sc_all_home_care)
export(read_sc_all_sds)
export(rename_hscp)
export(setup_keyring)
export(start_fy)
export(start_fy_quarter)
Expand Down
6 changes: 3 additions & 3 deletions R/00-update_refs.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#'
#' @family initialisation
latest_update <- function() {
"Sep_2023"
"Dec_2023"
}

#' Previous update
Expand All @@ -34,11 +34,11 @@

latest_update_date <- lubridate::my(latest_update())

previous_update_year <- lubridate::year(

Check warning on line 37 in R/00-update_refs.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/00-update_refs.R,line=37,col=3,[object_usage_linter] local variable 'previous_update_year' assigned but may not be used
latest_update_date - lubridate::period(months_ago, "months")
)

previous_update_month <- lubridate::month(

Check warning on line 41 in R/00-update_refs.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/00-update_refs.R,line=41,col=3,[object_usage_linter] local variable 'previous_update_month' assigned but may not be used
latest_update_date - lubridate::period(months_ago, "months"),
label = TRUE,
abbr = TRUE
Expand All @@ -61,7 +61,7 @@
#'
#' @family initialisation
get_dd_period <- function() {
"Jul16_Jun23"
"Jul16_Sep23"
}

#' The latest financial year for Cost uplift setting
Expand All @@ -74,5 +74,5 @@
#'
#' @family initialisation
latest_cost_year <- function() {
"2324"
"2223"
}
163 changes: 163 additions & 0 deletions R/add_keep_population_flag.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#' Add keep_popluation flag
#'
#' @description Add keep_population flag to individual files
#' @param individual_file individual files under processing
#' @param year the year of individual files under processing
#'
#' @return A data frame with keep_population flags
#' @family individual_file
add_keep_population_flag <- function(individual_file, year) {
calendar_year <- paste0("20", substr(year, 1, 2)) %>% as.integer()

if (!check_year_valid(year, "nsu")) {
individual_file <- individual_file %>%
dplyr::mutate(keep_population = 1L)
} else {
## Obtain the population estimates for Locality AgeGroup and Gender.
pop_estimates <-
readr::read_rds(get_datazone_pop_path("DataZone2011_pop_est_2011_2021.rds")) %>%

Check warning on line 18 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/add_keep_population_flag.R,line=18,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 86 characters.
dplyr::select(year, datazone2011, sex, age0:age90plus)

Check warning on line 19 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/add_keep_population_flag.R,line=19,col=27,[object_usage_linter] no visible binding for global variable 'datazone2011'

Check warning on line 19 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/add_keep_population_flag.R,line=19,col=41,[object_usage_linter] no visible binding for global variable 'sex'

Check warning on line 19 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/add_keep_population_flag.R,line=19,col=46,[object_usage_linter] no visible binding for global variable 'age0'

Check warning on line 19 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/add_keep_population_flag.R,line=19,col=51,[object_usage_linter] no visible binding for global variable 'age90plus'

# Step 1: Obtain the population estimates for Locality, AgeGroup, and Gender
# Select out the estimates for the year of interest.
# if we don't have estimates for this year (and so have to use previous year).

Check warning on line 23 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/add_keep_population_flag.R,line=23,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 82 characters.
year_available <- pop_estimates %>%
dplyr::pull(year) %>%
unique()

if (calendar_year %in% year_available) {
pop_estimates <- pop_estimates %>%
dplyr::filter(year == calendar_year)
} else {
previous_year <- sort(year_available, decreasing = TRUE)[1]
pop_estimates <- pop_estimates %>%
dplyr::filter(year == previous_year)
}

pop_estimates <- pop_estimates %>%
# Recode gender to make it match source.
dplyr::mutate(sex = dplyr::if_else(sex == "M", 1, 2)) %>%

Check warning on line 39 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/add_keep_population_flag.R,line=39,col=42,[object_usage_linter] no visible binding for global variable 'sex'
dplyr::rename(
"age90" = "age90plus",
"gender" = "sex"
) %>%
tidyr::pivot_longer(
names_to = "age",
names_prefix = "age",
values_to = "population_estimate",
cols = "age0":"age90"
) %>%
dplyr::mutate(age = as.integer(age)) %>%

Check warning on line 50 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/add_keep_population_flag.R,line=50,col=38,[object_usage_linter] no visible binding for global variable 'age'
add_age_group(age) %>%
dplyr::left_join(
readr::read_rds(get_locality_path()) %>%
dplyr::select("locality" = "hscp_locality", datazone2011),
by = "datazone2011"
) %>%
dplyr::group_by(locality, age_group, gender) %>%
dplyr::summarize(population_estimate = sum(population_estimate)) %>%
dplyr::ungroup()

# Step 2: Work out the current population sizes in the SLF for Locality, AgeGroup, and Gender
# Work out the current population sizes in the SLF for Locality AgeGroup and Gender.
individual_file <- individual_file %>%
dplyr::mutate(age = as.integer(age)) %>%
add_age_group(age)


set.seed(100)
mid_year <- lubridate::dmy(stringr::str_glue("30-06-{calendar_year}"))
## issues with age being negative
# If they don't have a locality, they're no good as we won't have an estimate to match them against.
# Same for age and gender.
nsu_keep_lookup <- individual_file %>%
dplyr::filter(gender == 1 | gender == 2) %>%
dplyr::filter(!is.na(locality), !is.na(age)) %>%
dplyr::mutate(
# Flag service users who were dead at the mid year date.
flag_to_remove = dplyr::if_else(death_date <= mid_year & nsu == 0, 1, 0),
# If the death date is missing, keep those people.
flag_to_remove = dplyr::if_else(is.na(death_date), 0, flag_to_remove),
# If they are a non-service-user we want to keep them
flag_to_remove = dplyr::if_else(nsu == 1, 0, flag_to_remove)
) %>%
# Remove anyone who was flagged as 1 from above.
dplyr::filter(flag_to_remove == 0) %>%
# Calculate the populations of the whole SLF and of the NSU.
dplyr::group_by(locality, age_group, gender) %>%
dplyr::mutate(
nsu_population = sum(nsu),
total_source_population = dplyr::n()
) %>%
dplyr::filter(nsu == 1) %>%
dplyr::left_join(pop_estimates,
by = c("locality", "age_group", "gender")
) %>%
dplyr::mutate(
difference = total_source_population - population_estimate,
new_nsu_figure = nsu_population - difference,
scaling_factor = new_nsu_figure / nsu_population,
scaling_factor = dplyr::case_when(scaling_factor < 0 ~ 0,
scaling_factor > 1 ~ 1,
.default = scaling_factor
),
keep_nsu = rbinom(nsu_population, 1, scaling_factor)
) %>%
dplyr::filter(keep_nsu == 1L) %>%
dplyr::ungroup() %>%
dplyr::select(-flag_to_remove)

Check notice on line 108 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / Check Spelling

`Line` matches candidate pattern `(?:^|[\t ,"'`=(])-[DPWXYLlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})` (candidate-pattern)

Check notice on line 108 in R/add_keep_population_flag.R

View workflow job for this annotation

GitHub Actions / Check Spelling

`Line` matches candidate pattern `(?:^|[\t ,"'`=(])-[DPWXYLlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})` (candidate-pattern)

# step 3: match the flag back onto the slf
individual_file <- individual_file %>%
dplyr::left_join(nsu_keep_lookup,
by = "chi",
suffix = c("", ".y")
) %>%
dplyr::select(-contains(".y")) %>%
dplyr::rename("keep_population" = "keep_nsu") %>%
dplyr::mutate(
# Flag all non-NSUs as Keep.
keep_population = dplyr::if_else(nsu == 0, 1, keep_population),
# If the flag is missing they must be a non-keep NSU so set to 0.
keep_population = dplyr::if_else(is.na(keep_population), 0, keep_population),
) %>%
dplyr::select(
-c(
"age_group",
"nsu_population",
"total_source_population",
"population_estimate",
"difference",
"new_nsu_figure",
"scaling_factor"
)
)
}
}


#' add_age_group
#'
#' @description Add age group columns based on age
#' @param data the individual files under processing
#' @param age_var_name the column name of age variable, could be age
#'
#' @return A individual file with age groups added
add_age_group <- function(data, age_var_name) {
data <- data %>%
dplyr::mutate(
age_group = dplyr::case_when(
{{ age_var_name }} >= -1 & {{ age_var_name }} <= 4 ~ "0-4",
{{ age_var_name }} >= 5 & {{ age_var_name }} <= 14 ~ "5-14",
{{ age_var_name }} >= 15 & {{ age_var_name }} <= 24 ~ "15-24",
{{ age_var_name }} >= 25 & {{ age_var_name }} <= 34 ~ "25-34",
{{ age_var_name }} >= 35 & {{ age_var_name }} <= 44 ~ "35-44",
{{ age_var_name }} >= 45 & {{ age_var_name }} <= 54 ~ "45-54",
{{ age_var_name }} >= 55 & {{ age_var_name }} <= 64 ~ "55-64",
{{ age_var_name }} >= 65 & {{ age_var_name }} <= 74 ~ "65-74",
{{ age_var_name }} >= 75 & {{ age_var_name }} <= 84 ~ "75-84",
{{ age_var_name }} >= 85 ~ "85+"
)
)
return(data)
}
2 changes: 1 addition & 1 deletion R/add_nsu_cohort.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ add_nsu_cohort <- function(
nsu_cohort = read_file(get_nsu_path(year))) {
year_param <- year

if (!check_year_valid(year, "NSU")) {
if (!check_year_valid(year, "nsu")) {
return(data)
}

Expand Down
56 changes: 28 additions & 28 deletions R/check_year_valid.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,42 @@
check_year_valid <- function(
year,
type = c(
"Acute",
"AE",
"AT",
"CH",
"Client",
"CMH",
"DD",
"Deaths",
"DN",
"GPOoH",
"HC",
"Homelessness",
"HHG",
"Maternity",
"MH",
"NSU",
"Outpatients",
"PIS",
"SDS",
"SPARRA"
"acute",
"ae",
"at",
"ch",
"client",
"cmh",
"dd",
"deaths",
"dn",
"gpooh",
"hc",
"homelessness",
"hhg",
"maternity",
"mh",
"nsu",
"outpatients",
"pis",
"sds",
"sparra"
)) {
if (year <= "1415" && type %in% c("DN", "SPARRA")) {
if (year <= "1415" && type %in% c("dn", "sparra")) {
return(FALSE)
} else if (year <= "1516" && type %in% c("CMH", "Homelessness")) {
} else if (year <= "1516" && type %in% c("cmh", "homelessness")) {
return(FALSE)
} else if (year <= "1617" && type %in% c("CH", "HC", "SDS", "AT")) {
} else if (year <= "1617" && type %in% c("ch", "hc", "sds", "at")) {
return(FALSE)
} else if (year <= "1718" && type %in% "HHG") {
} else if (year <= "1718" && type %in% "hhg") {
return(FALSE)
} else if (year >= "2122" && type %in% c("CMH", "DN")) {
} else if (year >= "2122" && type %in% c("cmh", "dn")) {
return(FALSE)
} else if (year >= "2324" && type %in% "NSU") {
} else if (year >= "2324" && type %in% c("nsu", "hhg")) {
return(FALSE)
} else if (year >= "2324" && type %in% c("SPARRA", "HHG")) {
} else if (year >= "2425" && type %in% "sparra") {
return(FALSE)
} else if (year >= "2324" && type %in% c("CH", "HC", "SDS", "AT")) {
} else if (year >= "2324" && type %in% c("ch", "hc", "sds", "at")) {
return(FALSE)
}

Expand Down
Loading
Loading