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

Notebook report #81

Closed
wants to merge 274 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
274 commits
Select commit Hold shift + click to select a range
7e9d62b
add notebook examples
andrewscolm Mar 31, 2022
53e2d60
add notebook examples
andrewscolm Mar 31, 2022
c9f29de
amend notebook!
andrewscolm Apr 2, 2022
2de9c68
amend notebook!
andrewscolm Apr 2, 2022
2065ffb
add second alluvial plot
andrewscolm Apr 4, 2022
7e47a4d
add second alluvial plot
andrewscolm Apr 4, 2022
f3cd387
first pass at Jupyter
andrewscolm Apr 13, 2022
7db6817
first pass at Jupyter
andrewscolm Apr 13, 2022
29dd45d
Add updated notebook
robinyjpark Apr 13, 2022
27981e3
Merge branch 'notebook' of https://github.com/opensafely/ethnicity-sh…
andrewscolm Apr 13, 2022
c9a7b63
Update report_ethnicity.ipynb
andrewscolm Apr 13, 2022
e50ef6c
Add patient counts where all phenotypes filled or missing
robinyjpark Apr 13, 2022
682fe98
Add functions to summarise counts by coded value, compare latest vs. …
robinyjpark Apr 14, 2022
bd7c89f
Apply redaction to new tables and update counts by category to exclud…
robinyjpark Apr 14, 2022
09b1d90
Create percentages based off the number of records rather than popula…
robinyjpark Apr 14, 2022
3b75b39
Decode ethnicity values and update state change function
robinyjpark Apr 14, 2022
f8c7367
add ethnicity dates
andrewscolm Apr 14, 2022
97db343
Merge branch 'notebook' of https://github.com/opensafely/ethnicity-sh…
andrewscolm Apr 14, 2022
9cc5f77
Revert "Merge branch 'notebook' of https://github.com/opensafely/ethn…
robinyjpark Apr 14, 2022
03904dc
Add third ethnicity phenotype variable
robinyjpark Apr 14, 2022
2891213
remove Rmd from yaml
andrewscolm Apr 14, 2022
e4ac2ff
Drop null dates and make dictionary of dictionaries to make decoding …
robinyjpark Apr 19, 2022
4b46e33
Update function arguments
robinyjpark Apr 26, 2022
c2e369e
Delete intermediate dataframes to save memory and suppress outliers i…
robinyjpark Apr 26, 2022
a6e9dbd
split ethnicity list
andrewscolm Apr 27, 2022
bbd4901
split ethnicity list
andrewscolm Apr 27, 2022
4763812
Remove outdated templates
robinyjpark Apr 27, 2022
5637b6b
Move analysis functions to separate script and update percentage deno…
robinyjpark Apr 27, 2022
24c4cbc
Add action to run validation checks in a separate .py script
robinyjpark Apr 27, 2022
d4dce5c
Generate notebook with outputs created from .py script
robinyjpark Apr 27, 2022
13d9654
Update needs key and run notebook with python-docker
robinyjpark Apr 27, 2022
29c3a21
Separate out validation functions from configurable script
robinyjpark Apr 27, 2022
68a0d8d
add upset plot
andrewscolm Apr 27, 2022
8cf6813
add upset plot
andrewscolm Apr 27, 2022
9daeb83
Merge branch 'notebook' of https://github.com/opensafely/ethnicity-sh…
andrewscolm Apr 27, 2022
651b3b8
Remove outdated file
robinyjpark Apr 27, 2022
bcdab51
Add nested output folder
robinyjpark Apr 27, 2022
0257850
Update filepaths
robinyjpark Apr 27, 2022
b634c92
Merge branch 'notebook' of https://github.com/opensafely/ethnicity-sh…
andrewscolm May 10, 2022
3318a66
add iteratation over ethnicities
andrewscolm May 12, 2022
863c448
update codelists
andrewscolm May 12, 2022
c568f80
remove unused codelists
andrewscolm May 12, 2022
3acbee2
create codelist for ctv3 and snomed
andrewscolm May 12, 2022
6c554dd
add 16 category ethnicity
andrewscolm May 13, 2022
3fadb17
update codelist
andrewscolm May 13, 2022
c18f8fb
update codelist
andrewscolm May 13, 2022
8127f98
fix bug
andrewscolm May 13, 2022
9318932
Delete test.ipynb
andrewscolm May 13, 2022
6ed3de9
remove notebook
andrewscolm May 13, 2022
02fcf7a
Merge branch 'add_16' into notebook
andrewscolm May 13, 2022
52cdf5d
add cohort report
andrewscolm May 16, 2022
937644e
remove test notebook
andrewscolm May 16, 2022
f288d7a
fix ethnicity_primis_5
andrewscolm May 16, 2022
6df1246
fix ethnicity_primis_5
andrewscolm May 16, 2022
d5248c1
update codelist
andrewscolm May 16, 2022
b188f86
fix generate_dataset_report
andrewscolm May 16, 2022
6f33a83
fix generate_dataset_report
andrewscolm May 16, 2022
50e48bb
fix generate_dataset_report
andrewscolm May 16, 2022
d4425b2
Merge pull request #22 from opensafely/notebook_report
andrewscolm May 16, 2022
f0b4e4e
fix imd definition
andrewscolm May 16, 2022
3e59e20
update codelist
andrewscolm May 16, 2022
dc1b03b
Merge pull request #23 from opensafely/notebook_report
andrewscolm May 16, 2022
600d708
reorder category table
andrewscolm May 16, 2022
81bdb59
Merge pull request #24 from opensafely/notebook_report
andrewscolm May 17, 2022
553c201
change codelist system
andrewscolm May 17, 2022
4042573
Merge pull request #25 from opensafely/notebook_report
andrewscolm May 17, 2022
302c74d
remove null out diagonal in state_change
andrewscolm May 17, 2022
e5c530b
add debug notebook
andrewscolm May 17, 2022
f54fdd4
sort state_change columns alphabetically
andrewscolm May 17, 2022
aa4177a
sort latest_common_comparison alphabetically
andrewscolm May 17, 2022
868c674
remove 0s from maximum in latest_common
andrewscolm May 17, 2022
69ac04b
begin handling ties
andrewscolm May 17, 2022
32b0133
Merge pull request #26 from opensafely/notebook_report
andrewscolm May 17, 2022
b8d7960
fix codelist_split
andrewscolm May 18, 2022
04b0eb4
fix codelist_split
andrewscolm May 18, 2022
b034bf5
Merge pull request #27 from opensafely/notebook_report
andrewscolm May 18, 2022
4153dc4
un-restrict codelist dates
andrewscolm May 18, 2022
1762a8f
Merge pull request #28 from opensafely/notebook_report
andrewscolm May 18, 2022
f2aa0db
sort state_change columns and rows
andrewscolm May 18, 2022
a86a2e4
sort rows and columns
andrewscolm May 19, 2022
1868a66
remove column restriction
andrewscolm May 19, 2022
c849359
Merge branch 'notebook' of https://github.com/opensafely/ethnicity-sh…
andrewscolm May 19, 2022
4a7dade
sort columns in patients_codes
andrewscolm May 19, 2022
7d1fd26
simplify columns / row sorting
andrewscolm May 24, 2022
7936e0d
restrict to registered at index date
andrewscolm May 25, 2022
0450b4b
resolve conflicts
andrewscolm May 25, 2022
30549ae
Merge pull request #29 from opensafely/notebook_report
andrewscolm May 25, 2022
f61a5db
add simplified outputs
andrewscolm May 26, 2022
82a4ad4
Merge pull request #31 from opensafely/notebook_simplify
andrewscolm May 26, 2022
88164e3
run local notebook
andrewscolm May 30, 2022
c47f4e6
run local notebook
andrewscolm May 30, 2022
b229f44
add upset plot
andrewscolm Jun 13, 2022
ecc629d
remove unused yaml actions
andrewscolm Jun 13, 2022
ea37ca4
add output checking table for upset plots
andrewscolm Jun 13, 2022
1bbd60e
update codelists
andrewscolm Jun 13, 2022
c33a0bd
fix imd definition
andrewscolm Jun 13, 2022
9c922dc
fix imd definition
andrewscolm Jun 13, 2022
66ef0bb
Merge pull request #32 from opensafely/notebook_simplify
andrewscolm Jun 13, 2022
287b95d
add fullset/registered outputs
andrewscolm Jul 26, 2022
2e2ee1a
update codelists
andrewscolm Jul 26, 2022
3abd688
Merge pull request #33 from opensafely/notebook_simplify
andrewscolm Jul 26, 2022
ed775eb
amend simplified 16 group
andrewscolm Jul 27, 2022
d7fefb5
Merge pull request #34 from opensafely/notebook_simplify
andrewscolm Jul 27, 2022
8c887c8
add ONS comparison
andrewscolm Jul 28, 2022
98267d1
Merge pull request #35 from opensafely/notebook_simplify
andrewscolm Jul 28, 2022
f157a4f
fix yaml output
andrewscolm Aug 3, 2022
39d65dc
Merge pull request #36 from opensafely/notebook_simplify
andrewscolm Aug 3, 2022
e7ec5d9
add registered ONS comparison
andrewscolm Aug 17, 2022
35b3347
remove duplicate codelist
andrewscolm Aug 17, 2022
735eb8b
add registered ONS comparison
andrewscolm Aug 17, 2022
6bd0019
Merge pull request #37 from opensafely/notebook_simplify
andrewscolm Aug 17, 2022
b9e9cb3
"add any state change"
andrewscolm Sep 8, 2022
30c833f
remove CTV3 from ONS plots
andrewscolm Sep 8, 2022
7c3a86c
add check for impossible ethnicity
andrewscolm Sep 8, 2022
f9b6dc4
Merge pull request #38 from opensafely/notebook_simplify
andrewscolm Sep 8, 2022
48a3a51
Add ONS analysis
andrewscolm Sep 20, 2022
694cc47
fix local notebook
andrewscolm Sep 20, 2022
4d47c06
add records over time
andrewscolm Sep 20, 2022
a67aeee
Merge pull request #39 from opensafely/notebook_simplify
andrewscolm Sep 20, 2022
875c6a5
update redaction
andrewscolm Sep 21, 2022
5fd257a
add records_over_time suffix
andrewscolm Sep 21, 2022
546273b
Merge pull request #40 from opensafely/notebook_simplify
andrewscolm Sep 21, 2022
7d41a12
add range of recorded ethnicities
andrewscolm Sep 22, 2022
4f948e9
add range of recorded ethnicities
andrewscolm Sep 22, 2022
ea2f998
Merge pull request #41 from opensafely/notebook_simplify
andrewscolm Sep 22, 2022
61cbb11
fix range
andrewscolm Sep 22, 2022
f03489d
Merge pull request #42 from opensafely/notebook_simplify
andrewscolm Sep 22, 2022
cebe4c9
add density plot
andrewscolm Sep 23, 2022
b9a0b9c
fix process_treated
andrewscolm Sep 23, 2022
4769624
Merge pull request #43 from opensafely/notebook_simplify
andrewscolm Sep 23, 2022
93e763b
update local report
andrewscolm Oct 17, 2022
d85e5f7
update git ignore
andrewscolm Oct 17, 2022
f4bcf0f
add dates
andrewscolm Oct 17, 2022
4e8dc53
update validation scripts
andrewscolm Oct 17, 2022
eebf064
Merge pull request #44 from opensafely/notebook_simplify
andrewscolm Oct 17, 2022
39d3a22
edits local report to run on server
andrewscolm Oct 19, 2022
29b0957
Merge pull request #45 from opensafely/notebook_simplify
andrewscolm Oct 19, 2022
7afd5d0
fix local_report
andrewscolm Oct 19, 2022
50b7dbc
registered analysis
andrewscolm Oct 19, 2022
85f6a7f
fix filepaths
andrewscolm Oct 19, 2022
7fa8a57
one last file path
andrewscolm Oct 19, 2022
03e6584
Merge pull request #46 from opensafely/notebook_simplify
andrewscolm Oct 19, 2022
9321eaa
fix registered selection
andrewscolm Oct 24, 2022
2897740
fix dates
andrewscolm Oct 24, 2022
d692aa7
Merge pull request #47 from opensafely/notebook_simplify
andrewscolm Oct 24, 2022
64f6a28
update local report
andrewscolm Oct 26, 2022
9c8831b
Merge pull request #48 from opensafely/notebook_simplify
andrewscolm Oct 26, 2022
56d4cdb
amend local report
andrewscolm Oct 26, 2022
a551aff
Amend local report
andrewscolm Oct 26, 2022
3b7b4bc
Merge pull request #49 from opensafely/notebook_simplify
andrewscolm Oct 26, 2022
a1da886
update local report
andrewscolm Oct 26, 2022
37c4f5a
Merge pull request #50 from opensafely/notebook_simplify
andrewscolm Oct 26, 2022
e1c4c02
update local report
andrewscolm Oct 28, 2022
e2e3cea
amend local report
andrewscolm Oct 28, 2022
dbd9fc5
Merge pull request #51 from opensafely/notebook_simplify
andrewscolm Oct 28, 2022
f74592f
Update local report
andrewscolm Oct 31, 2022
f96fb4a
Merge pull request #52 from opensafely/notebook_simplify
andrewscolm Oct 31, 2022
591b0c0
Update censoring
andrewscolm Oct 31, 2022
ee4f9f0
Merge pull request #53 from opensafely/notebook_simplify
andrewscolm Oct 31, 2022
ae9d082
update local notebook
andrewscolm Nov 3, 2022
6bd3053
Merge pull request #54 from opensafely/notebook_simplify
andrewscolm Nov 3, 2022
344c3a3
amend date plots
andrewscolm Nov 4, 2022
e6aeb7b
Merge pull request #55 from opensafely/notebook_simplify
andrewscolm Nov 4, 2022
011c2a9
fix ethnicity by group percentages
andrewscolm Nov 7, 2022
b75284a
Merge pull request #56 from opensafely/notebook_simplify
andrewscolm Nov 7, 2022
540965e
update draft report
andrewscolm Nov 7, 2022
41b0564
Merge pull request #57 from opensafely/notebook_simplify
andrewscolm Nov 7, 2022
73e7614
refactor ONS analysis
andrewscolm Nov 8, 2022
d31dbe9
update codelist
andrewscolm Nov 8, 2022
87c3559
update draft report
andrewscolm Nov 8, 2022
49f7938
Merge pull request #58 from opensafely/notebook_simplify
andrewscolm Nov 8, 2022
24d46e7
update project.yaml
andrewscolm Nov 9, 2022
2c9e444
Merge pull request #59 from opensafely/notebook_simplify
andrewscolm Nov 9, 2022
a8565a1
update data check
andrewscolm Nov 9, 2022
bb59c49
Merge pull request #60 from opensafely/notebook_simplify
andrewscolm Nov 9, 2022
5767165
add local plots
andrewscolm Nov 15, 2022
d58ca2c
Add SUS analysis
andrewscolm Nov 17, 2022
aa5396f
Merge pull request #61 from opensafely/sus
andrewscolm Nov 17, 2022
092166a
remove dummy outputs
andrewscolm Nov 17, 2022
7f2a1b1
add sus comparison
andrewscolm Nov 17, 2022
6453e4b
Merge pull request #62 from opensafely/notebook_sus
andrewscolm Nov 17, 2022
90e24ed
add time analysis
andrewscolm Nov 21, 2022
cbb734f
update project.yaml for time
andrewscolm Nov 21, 2022
7273be0
amend sus analysis
andrewscolm Nov 21, 2022
f94bbd4
Merge pull request #63 from opensafely/time
andrewscolm Nov 21, 2022
35612fb
add needs
andrewscolm Nov 21, 2022
70fcffb
Merge pull request #64 from opensafely/time
andrewscolm Nov 21, 2022
5107c33
local changes
andrewscolm Nov 22, 2022
6dc655d
update time analysis
andrewscolm Nov 22, 2022
4e335eb
Merge pull request #65 from opensafely/time
andrewscolm Nov 22, 2022
36520f1
add 2021 census
andrewscolm Dec 8, 2022
5806710
combine study defs
andrewscolm Dec 8, 2022
749fa29
remove un-unsed yaml
andrewscolm Dec 8, 2022
fc51411
Merge pull request #66 from opensafely/time
andrewscolm Dec 8, 2022
8c8844a
separate create_variables
andrewscolm Dec 10, 2022
4f8a39d
separate study defs
andrewscolm Dec 11, 2022
6392b26
update codelists
andrewscolm Dec 11, 2022
71cb64a
update filepath
andrewscolm Dec 11, 2022
adb77af
Merge pull request #67 from opensafely/time
andrewscolm Dec 11, 2022
d0b569d
amend ethnicity over time
andrewscolm Dec 14, 2022
b9bbf36
Merge pull request #68 from opensafely/time
andrewscolm Dec 14, 2022
8a2ed3e
add rounding
andrewscolm Dec 14, 2022
bcb7d51
Merge pull request #69 from opensafely/time
andrewscolm Dec 14, 2022
7a8a439
un-comment SUS analysis
andrewscolm Dec 20, 2022
56ec6a2
Merge pull request #70 from opensafely/time
andrewscolm Dec 20, 2022
0731270
fix ONS tables
andrewscolm Dec 20, 2022
29b9397
Merge pull request #71 from opensafely/time
andrewscolm Dec 20, 2022
f0b51ee
censor time analysis
andrewscolm Dec 21, 2022
cc97994
Merge pull request #72 from opensafely/time
andrewscolm Dec 21, 2022
684bc3e
fix time analysis
andrewscolm Dec 21, 2022
7edd193
Merge pull request #73 from opensafely/time
andrewscolm Dec 21, 2022
d24f1c6
add times check
andrewscolm Feb 14, 2023
a4522c2
add date check
andrewscolm Feb 14, 2023
045b5ca
more data checks
andrewscolm Feb 14, 2023
a8e6dca
tidy old notebooks
andrewscolm Feb 15, 2023
ea3c8cc
add local run workflow
andrewscolm Feb 15, 2023
5c55bc7
fix report population
andrewscolm Feb 16, 2023
55fd44e
format draft report
andrewscolm Feb 16, 2023
7cd0450
update snomed codelist
andrewscolm Apr 12, 2023
8f70165
remove unused scripts
andrewscolm Apr 14, 2023
13b3cb6
update ONS processing
andrewscolm Apr 14, 2023
81ebc7f
Add supplemented ethnicity
andrewscolm Apr 14, 2023
e461766
modify local scripts for supplemented data
andrewscolm Apr 19, 2023
0618497
update manuscript plots and tables
andrewscolm May 5, 2023
db1e240
handle ties in most frequent ethnicity
andrewscolm May 24, 2023
1c8cdcc
fix execute_simple_validation_analyses
andrewscolm May 24, 2023
5dd368d
Update README.md
andrewscolm May 26, 2023
73bb438
Add time plots
andrewscolm Jul 27, 2023
5106f0f
local plotting changes
andrewscolm Jul 27, 2023
900cd10
Merge branch 'notebook' of https://github.com/opensafely/ethnicity-sh…
andrewscolm Jul 27, 2023
b937d9a
amend measure numerator
andrewscolm Jul 27, 2023
0694a38
local plotting changes
andrewscolm Aug 18, 2023
4bbae74
add measures censoring
andrewscolm Aug 18, 2023
e70efd8
add nulldate checks
andrewscolm Aug 21, 2023
59c7f13
Fix registered def for yearly measures
andrewscolm Aug 22, 2023
5c38412
fix registered date in create_variables.py
andrewscolm Aug 22, 2023
9a37866
update local plots
andrewscolm Sep 28, 2023
ebb8a44
add ctv3 sus analysis
andrewscolm Dec 6, 2023
1bbb62a
Add ctv3 sus analysis
andrewscolm Dec 6, 2023
02a1df5
Update codelists
andrewscolm Feb 23, 2024
f7d53c3
formatting changes
andrewscolm Feb 23, 2024
d22a82c
add local alluvial plots
andrewscolm Feb 23, 2024
e24bba2
update validation scripts to support report.rmd
andrewscolm Feb 23, 2024
6148ff3
recreate local scripts to support report.rmd
andrewscolm Feb 23, 2024
de29650
remove unused script
andrewscolm Feb 23, 2024
69ecd05
add report.rmd
andrewscolm Feb 23, 2024
92b6fc7
Clarify the source of saved files
andrewscolm Feb 23, 2024
f1b58ae
remove execute_simple_validation_analyses_ctv3_sus
andrewscolm Feb 26, 2024
d4d15f5
Formatting changes
andrewscolm Feb 27, 2024
119e2e4
Fix codelist order
andrewscolm Feb 27, 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
3 changes: 3 additions & 0 deletions .Rproj.user/23EE8BC9/pcs/source-pane.pper
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"activeTab": 3
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ __pycache__
output/*
metadata/*
venv/
.Rproj.user
*/Rhistory
.Rhistory
*/test.ipynb
notebooks_jupyter/local_report_ethnicity.ipynb
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# ethnicity-short-data-report

This is the code and configuration for ethnicity-short-data-report.

You can run this project via [Gitpod](https://gitpod.io) in a web browser by clicking on this badge: [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/opensafely/ethnicity-short-data-report)

* The paper is [here]()
* Raw model outputs, including charts, crosstabs, etc, are in `released_outputs/`
* If you are interested in how we defined our variables, take a look at the [study definition](analysis/study_definition.py); this is written in `python`, but non-programmers should be able to understand what is going on there
* If you are interested in how we defined our code lists, look in the [codelists folder](./codelists/).
* Developers and epidemiologists interested in the framework should review [the OpenSAFELY documentation](https://docs.opensafely.org)
[View on OpenSAFELY](https://jobs.opensafely.org/datalab/ethnicity-short-data-report/)

Details of the purpose and any published outputs from this project can be found at the link above.

# About the OpenSAFELY framework
The contents of this repository MUST NOT be considered an accurate or valid representation of the study or its purpose. This repository may reflect an incomplete or incorrect analysis with no further ongoing work. The content has ONLY been made public to support the OpenSAFELY [open science and transparency principles](https://www.opensafely.org/about/#contributing-to-best-practice-around-open-science) and to support the sharing of re-usable code for other subsequent users. No clinical, policy or safety conclusions must be drawn from the contents of this repository.

The OpenSAFELY framework is a Trusted Research Environment (TRE) for electronic
health records research in the NHS, with a focus on public accountability and
research quality.
About the OpenSAFELY framework
The OpenSAFELY framework is a Trusted Research Environment (TRE) for electronic health records research in the NHS, with a focus on public accountability and research quality.

Read more at [OpenSAFELY.org](https://opensafely.org).
Read more at [OpenSAFELY.org](https://opensafely.org/).

# Licences
As standard, research projects have a MIT license.
Licences
As standard, research projects have a MIT license.
Binary file removed analysis/.DS_Store
Binary file not shown.
39 changes: 0 additions & 39 deletions analysis/00_trim_snomed_codelist.do

This file was deleted.

67 changes: 67 additions & 0 deletions analysis/00_trim_snomed_codelist.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## splits the PRIMIS, CTV3 and SNOMED ethnicity codelists into 5 and 16 group categories

library('tidyverse')
library('sf')

# # import data
df_input <- read_csv(here::here("codelists","opensafely-ethnicity.csv"))
group_split<-df_input %>%
group_split(Grouping_6)

ethnicities<-c('white','mixed','asian','black','other')

for (i in 1:5){
list<-group_split[i][[1]] %>% select(Code,Description)
write_csv(list,here::here("codelists",paste0("ethnicity_5_",ethnicities[i],".csv")))
}

df_input <- read_csv(here::here("codelists","opensafely-ethnicity-snomed-0removed.csv")) %>%
filter(Grouping_6!=0)
group_split<-df_input %>%
group_split(Grouping_6)

for (i in 1:5){
list<-group_split[i][[1]] %>% select(snomedcode,Ethnicity) %>% rename(Code = snomedcode)
write_csv(list,here::here("codelists",paste0("ethnicity_new_5_",ethnicities[i],".csv")))
}

df_input <- read_csv(here::here("codelists","primis-covid19-vacc-uptake-eth2001.csv"))
group_split<-df_input %>%
group_split(grouping_6_id)

for (i in 1:5){
list<-group_split[i][[1]] %>% select(code,term) %>% rename(Code=code)
write_csv(list,here::here("codelists",paste0("ethnicity_primis_5_",ethnicities[i],".csv")))
}

### group 16
df_input <- read_csv(here::here("codelists","opensafely-ethnicity.csv"))
group_split<-df_input %>%
group_split(Grouping_16)

ethnicities_16<-c('White_British','White_Irish','Other_White','White_and_Black_Caribbean','White_and_Black_African','White_and_Asian','Other_Mixed','Indian','Pakistani','Bangladeshi','Other_Asian','Caribbean','African','Other_Black','Chinese','Any_other_ethnic_group')

for (i in 1:16){
list<-group_split[i][[1]] %>% select(Code,Description)
write_csv(list,here::here("codelists",paste0("ethnicity_16_",ethnicities_16[i],".csv")))
}

df_input <- read_csv(here::here("codelists","opensafely-ethnicity-snomed-0removed.csv")) %>%
filter(Grouping_16!=0)

group_split<-df_input %>%
group_split(Grouping_16)

for (i in 1:16){
list<-group_split[i][[1]] %>% select(snomedcode,Ethnicity) %>% rename(Code = snomedcode)
write_csv(list,here::here("codelists",paste0("ethnicity_new_16_",ethnicities_16[i],".csv")))
}

df_input <- read_csv(here::here("codelists","primis-covid19-vacc-uptake-eth2001.csv"))
group_split<-df_input %>%
group_split(grouping_16_id)

for (i in 1:16){
list<-group_split[i][[1]] %>% select(code,term) %>% rename(Code=code)
write_csv(list,here::here("codelists",paste0("ethnicity_primis_16_",ethnicities_16[i],".csv")))
}
78 changes: 0 additions & 78 deletions analysis/01_describe_snomed_ethnicity.do

This file was deleted.

Loading
Loading