Skip to content

Commit

Permalink
Fix codelist order
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewscolm committed Feb 27, 2024
1 parent d4d15f5 commit 119e2e4
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 64 deletions.
43 changes: 26 additions & 17 deletions analysis/codelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@

other_vars = ["white", "mixed", "asian", "black", "other"]
other_vars_16 = [
"Pakistani",
"Bangladeshi",
"Other_Asian",
"Caribbean",
"African",
"Other_Black",
"White_and_Black_Caribbean",
"White_and_Black_African",
"White_and_Asian",
"Other_Mixed",
"White_British",
"White_Irish",
"Other_White",
"Chinese",
"Any_other_ethnic_group",
"Indian",
"Pakistani",
"Bangladeshi",
"Other_Asian",
"Caribbean",
"African",
"Other_Black",
"White_and_Black_Caribbean",
"White_and_Black_African",
"White_and_Asian",
"Other_Mixed",
"White_British",
"White_Irish",
"Other_White",
"Chinese",
"Any_other_ethnic_group",
]

ethnicity_combinations_ctv3 = [
Expand Down Expand Up @@ -55,13 +56,21 @@
)

codelists_ctv3 = {
name: codelist_from_csv(f"codelists/{name}.csv", system="ctv3", column="Code",)
name: codelist_from_csv(
f"codelists/{name}.csv",
system="ctv3",
column="Code",
)
for name in ethnicity_combinations_ctv3
}
locals().update(codelists_ctv3)

codelists_snomed = {
name: codelist_from_csv(f"codelists/{name}.csv", system="snomed", column="Code",)
name: codelist_from_csv(
f"codelists/{name}.csv",
system="snomed",
column="Code",
)
for name in ethnicity_combinations_snomed
}
locals().update(codelists_snomed)
Expand Down
2 changes: 1 addition & 1 deletion analysis/simple_validation_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
4: "4",
5: "5 Least deprived",
},
"ethnicity_5": {1: "Asian", 2: "Black", 3: "Mixed", 4: "White", 5: "Other"},
"ethnicity_5": {1: "White", 2: "Mixed", 3: "Asian", 4: "Black", 5: "Other"},
"ethnicity_new_5": {1: "White", 2: "Mixed", 3: "Asian", 4: "Black", 5: "Other"},
"ethnicity_primis_5": {1: "White", 2: "Mixed", 3: "Asian", 4: "Black", 5: "Other"},
"ethnicity_sus_5": {1: "White", 2: "Mixed", 3: "Asian", 4: "Black", 5: "Other"},
Expand Down
84 changes: 42 additions & 42 deletions analysis/simple_validation_script_16.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,56 +19,56 @@
5: "5 Least deprived",
},
"ethnicity_16": {
1: "Indian",
2: "Pakistani",
3: "Bangladeshi",
4: "Other_Asian",
5: "Caribbean",
6: "African",
7: "Other_Black",
8: "White_and_Black_Caribbean",
9: "White_and_Black_African",
10: "White_and_Asian",
11: "Other_Mixed",
12: "White_British",
13: "White_Irish",
14: "Other_White",
1: "White_British",
2: "White_Irish",
3: "Other_White",
4: "White_and_Black_Caribbean",
5: "White_and_Black_African",
6: "White_and_Asian",
7: "Other_Mixed",
8: "Indian",
9: "Pakistani",
10: "Bangladeshi",
11: "Other_Asian",
12: "Caribbean",
13: "African",
14: "Other_Black",
15: "Chinese",
16: "Any_other_ethnic_group",
},
"ethnicity_new_16": {
1: "Indian",
2: "Pakistani",
3: "Bangladeshi",
4: "Other_Asian",
5: "Caribbean",
6: "African",
7: "Other_Black",
8: "White_and_Black_Caribbean",
9: "White_and_Black_African",
10: "White_and_Asian",
11: "Other_Mixed",
12: "White_British",
13: "White_Irish",
14: "Other_White",
1: "White_British",
2: "White_Irish",
3: "Other_White",
4: "White_and_Black_Caribbean",
5: "White_and_Black_African",
6: "White_and_Asian",
7: "Other_Mixed",
8: "Indian",
9: "Pakistani",
10: "Bangladeshi",
11: "Other_Asian",
12: "Caribbean",
13: "African",
14: "Other_Black",
15: "Chinese",
16: "Any_other_ethnic_group",
},
"ethnicity_primis_16": {
1: "Indian",
2: "Pakistani",
3: "Bangladeshi",
4: "Other_Asian",
5: "Caribbean",
6: "African",
7: "Other_Black",
8: "White_and_Black_Caribbean",
9: "White_and_Black_African",
10: "White_and_Asian",
11: "Other_Mixed",
12: "White_British",
13: "White_Irish",
14: "Other_White",
1: "White_British",
2: "White_Irish",
3: "Other_White",
4: "White_and_Black_Caribbean",
5: "White_and_Black_African",
6: "White_and_Asian",
7: "Other_Mixed",
8: "Indian",
9: "Pakistani",
10: "Bangladeshi",
11: "Other_Asian",
12: "Caribbean",
13: "African",
14: "Other_Black",
15: "Chinese",
16: "Any_other_ethnic_group",
},
Expand Down
8 changes: 6 additions & 2 deletions analysis/study_definition_16.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
codelist_from_csv,
combine_codelists,
) # NOQA
from create_variables import demographic_variables, clinical_variables, ethnicity_16_variables
from create_variables import (
demographic_variables,
clinical_variables,
ethnicity_16_variables,
)
from codelists import *
from config import *

Expand Down Expand Up @@ -47,7 +51,7 @@
f"{definition}_{other_var}"
for definition, other_var in product(definitions_16, other_vars_16)
]
ethnicity_combinations = ethnicity_combinations_5 + ethnicity_combinations_16
ethnicity_combinations = ethnicity_combinations_16

codelists = {
name: patients.with_these_clinical_events(
Expand Down
8 changes: 6 additions & 2 deletions analysis/study_definition_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
codelist_from_csv,
combine_codelists,
) # NOQA
from create_variables import demographic_variables, clinical_variables, ethnicity_5_variables
from create_variables import (
demographic_variables,
clinical_variables,
ethnicity_5_variables,
)
from codelists import *
from config import *

Expand Down Expand Up @@ -47,7 +51,7 @@
f"{definition}_{other_var}"
for definition, other_var in product(definitions_16, other_vars_16)
]
ethnicity_combinations = ethnicity_combinations_5 + ethnicity_combinations_16
ethnicity_combinations = ethnicity_combinations_5

codelists = {
name: patients.with_these_clinical_events(
Expand Down

0 comments on commit 119e2e4

Please sign in to comment.