Skip to content

Commit

Permalink
Merge pull request #63 from opensafely/Add_long_covid
Browse files Browse the repository at this point in the history
Add long covid
  • Loading branch information
rose-higgins authored Apr 2, 2024
2 parents d7dd8f1 + 0c126ab commit 6f851c2
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ venv/
.DS_Store
.Rproj.user
.Rhistory
reports/variation/*
reports/coverage/table_prop_eligible_clinc_demo.csv
reports/coverage/mabs_and_antivirals_coverage_report.html
reports/coverage/figures/*
reports/coverage/tables/*
released_outputs/reports_wip/coverage/*
reports/coverage_wip/*
25 changes: 25 additions & 0 deletions analysis/codelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,28 @@
first_dose_declined, second_dose_declined
)

## Long COVID (used from openprompt vaccine work https://github.com/opensafely/openprompt-vaccine-long-covid/blob/main/analysis/codelists.py)
long_covid_nice_dx = codelist_from_csv(
"codelists/opensafely-nice-managing-the-long-term-effects-of-covid-19.csv",
system = "snomed",
column="code",
)
long_covid_referral_codes = codelist_from_csv(
"codelists/opensafely-referral-and-signposting-for-long-covid.csv",
system = "snomed",
column="code",
)
long_covid_assessment_codes = codelist_from_csv(
"codelists/opensafely-assessment-instruments-and-outcome-measures-for-long-covid.csv",
system = "snomed",
column="code",
)
long_covid_combine = combine_codelists(
long_covid_nice_dx, long_covid_referral_codes, long_covid_assessment_codes
)

long_covid_hosp = codelist_from_csv(
"codelists/user-hendersonad-hes-long-covid.csv",
system = "icd10",
column="code"
)
2 changes: 1 addition & 1 deletion analysis/descriptive/coverage_report_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ write_csv(table_elig_treat_redacted2, fs::path(output_dir, "table_elig_treat_red
## Clinical and demographics table
variables <- c("ageband", "sex", "ethnicity", "imd", "rural_urban", "region_nhs", "autism_nhsd", "care_home_primis",
"dementia_nhsd", "learning_disability_primis", "serious_mental_illness_nhsd",
"housebound_opensafely", "shielded_primis", "sickle_cell_disease_nhsd", "vaccination_status")
"housebound_opensafely", "shielded_primis", "sickle_cell_disease_nhsd", "long_covid", "vaccination_status")

table_demo_clinc_breakdown_base <- data_processed_clean %>%
select(all_of(variables)) %>%
Expand Down
8 changes: 6 additions & 2 deletions analysis/process/process_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ data_extract0 <- read_csv(
serious_mental_illness_nhsd = col_logical(),
sickle_cell_disease_nhsd = col_date(format = "%Y-%m-%d"),
vaccination_status = col_character(),

first_lc_code_date = col_date(format = "%Y-%m-%d"),

# COVID VARIENT
sgtf = col_character(),
sgtf_first = col_character(),
Expand Down Expand Up @@ -209,6 +210,9 @@ data_processed <- data_extract %>%

## Convert sickle cell disease from date
sickle_cell_disease_nhsd = ifelse(!is.na(sickle_cell_disease_nhsd), 1, 0),

## Long COVID
long_covid = ifelse(!is.na(first_lc_code_date), 1, 0),

# Combine subgoups of rare neurological conditions cohort
rare_neurological_conditions_nhsd = pmin(multiple_sclerosis_nhsd, motor_neurone_disease_nhsd, myasthenia_gravis_nhsd,
Expand Down Expand Up @@ -568,7 +572,7 @@ data_processed_clean <- data_processed_combined %>%

# Clinical groups
autism_nhsd, care_home_primis, dementia_nhsd, housebound_opensafely, learning_disability_primis, shielded_primis,
serious_mental_illness_nhsd, sickle_cell_disease_nhsd, vaccination_status,
serious_mental_illness_nhsd, sickle_cell_disease_nhsd, long_covid, vaccination_status,

# COVID variant
sgtf, sgtf_first, variant,
Expand Down
28 changes: 28 additions & 0 deletions analysis/study_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,34 @@
),



# # Long COVID

first_lc_dx_flag = patients.with_these_clinical_events(
long_covid_nice_dx,
on_or_before = "date_treated",
returning = "code",
include_date_of_match = True,
return_first_date_in_period = True,
date_format = "YYYY-MM-DD",
return_expectations = {"incidence": 0.1},
),

first_lc_dxrx_flag = patients.with_these_clinical_events(
long_covid_combine,
on_or_before = "date_treated",
returning = "binary _flag",
include_date_of_match = True,
return_first_date_in_period = True,
date_format = "YYYY-MM-DD",
return_expectations = {"incidence": 0.1},
),

first_lc_code_date = patients.minimum_of(
"first_lc_dx_flag_date","first_lc_dxrx_flag_date"
),



# CLINICAL CO-MORBIDITIES TBC ----

Expand Down
30 changes: 27 additions & 3 deletions codelists/codelists.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"nhsd-immunosuppresant-drugs-pra-dmd.csv": {
"id": "nhsd/immunosuppresant-drugs-pra-dmd/526d9f5f",
"url": "https://www.opencodelists.org/codelist/nhsd/immunosuppresant-drugs-pra-dmd/526d9f5f/",
"downloaded_at": "2024-02-14 13:10:23.166362Z",
"downloaded_at": "2024-03-05 16:43:26.365935Z",
"sha": "b86c1ff06c9208851b40b668fc846e25ccabcbb1"
},
"nhsd-immunosuppresant-drugs-pra-snomed.csv": {
Expand All @@ -141,7 +141,7 @@
"nhsd-oral-steroid-drugs-pra-dmd.csv": {
"id": "nhsd/oral-steroid-drugs-pra-dmd/44292c02",
"url": "https://www.opencodelists.org/codelist/nhsd/oral-steroid-drugs-pra-dmd/44292c02/",
"downloaded_at": "2024-02-14 13:10:23.423657Z",
"downloaded_at": "2024-03-05 16:43:26.614328Z",
"sha": "c0008e3734ad82744e3643d4a0f692d76a70085f"
},
"nhsd-oral-steroid-drugs-snomed.csv": {
Expand Down Expand Up @@ -285,7 +285,7 @@
"primis-covid19-vacc-uptake-eth2001.csv": {
"id": "primis-covid19-vacc-uptake/eth2001/v1",
"url": "https://www.opencodelists.org/codelist/primis-covid19-vacc-uptake/eth2001/v1/",
"downloaded_at": "2024-02-14 13:10:26.407595Z",
"downloaded_at": "2024-03-05 16:43:29.656369Z",
"sha": "2ff9aea91a05f41fe911a885eee50d2494247d58"
},
"nhsd-primary-care-domain-refsets-autism_cod.csv": {
Expand Down Expand Up @@ -353,6 +353,30 @@
"url": "https://www.opencodelists.org/codelist/opensafely/covid-19-vaccination-second-dose-declined/27d8bb36/",
"downloaded_at": "2022-02-16 16:33:44.441520Z",
"sha": "5f79648b7682f0fc85eb0c47c1da6dc180c5a89d"
},
"opensafely-nice-managing-the-long-term-effects-of-covid-19.csv": {
"id": "opensafely/nice-managing-the-long-term-effects-of-covid-19/64f1ae69",
"url": "https://www.opencodelists.org/codelist/opensafely/nice-managing-the-long-term-effects-of-covid-19/64f1ae69/",
"downloaded_at": "2024-03-05 16:43:31.119028Z",
"sha": "8ba3006b5e3d054bbc6ed1861d08fdc682a52a31"
},
"opensafely-referral-and-signposting-for-long-covid.csv": {
"id": "opensafely/referral-and-signposting-for-long-covid/12d06dc0",
"url": "https://www.opencodelists.org/codelist/opensafely/referral-and-signposting-for-long-covid/12d06dc0/",
"downloaded_at": "2024-03-05 16:43:31.254016Z",
"sha": "4574b35cc14eee04bd149d0226f1dae0dfadcb3e"
},
"opensafely-assessment-instruments-and-outcome-measures-for-long-covid.csv": {
"id": "opensafely/assessment-instruments-and-outcome-measures-for-long-covid/79c0fa8a",
"url": "https://www.opencodelists.org/codelist/opensafely/assessment-instruments-and-outcome-measures-for-long-covid/79c0fa8a/",
"downloaded_at": "2024-03-05 16:43:31.367401Z",
"sha": "f09228d28e9a43ea823b4570e7d82ff3714a0010"
},
"user-hendersonad-hes-long-covid.csv": {
"id": "user/hendersonad/hes-long-covid/7565af4d",
"url": "https://www.opencodelists.org/codelist/user/hendersonad/hes-long-covid/7565af4d/",
"downloaded_at": "2024-03-05 16:43:31.490204Z",
"sha": "49812e5b946cd87c1a84a293e11a2f01a4d7a233"
}
}
}
4 changes: 4 additions & 0 deletions codelists/codelists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ primis-covid19-vacc-uptake/nonshield/v1
nhsd-primary-care-domain-refsets/mh_cod/20210127
opensafely/covid-19-vaccination-first-dose-declined/0c16880b
opensafely/covid-19-vaccination-second-dose-declined/27d8bb36
opensafely/nice-managing-the-long-term-effects-of-covid-19/64f1ae69
opensafely/referral-and-signposting-for-long-covid/12d06dc0
opensafely/assessment-instruments-and-outcome-measures-for-long-covid/79c0fa8a
user/hendersonad/hes-long-covid/7565af4d

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
code,term
1325051000000101,Newcastle post-COVID syndrome Follow-up Screening Questionnaire
1325061000000103,Assessment using Newcastle post-COVID syndrome Follow-up Screening Questionnaire
1325071000000105,COVID-19 Yorkshire Rehabilitation Screening tool
1325081000000107,Assessment using COVID-19 Yorkshire Rehabilitation Screening tool
1325091000000109,Post-COVID-19 Functional Status Scale patient self-report
1325101000000101,Assessment using Post-COVID-19 Functional Status Scale patient self-report
1325121000000105,Post-COVID-19 Functional Status Scale patient self-report final scale grade
1325131000000107,Post-COVID-19 Functional Status Scale structured interview final scale grade
1325141000000103,Assessment using Post-COVID-19 Functional Status Scale structured interview
1325151000000100,Post-COVID-19 Functional Status Scale structured interview
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
code,term
1325161000000102,Post-COVID-19 syndrome
1325181000000106,Ongoing symptomatic disease caused by severe acute respiratory syndrome coronavirus 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
code,term
1325021000000106,Signposting to Your COVID Recovery
1325031000000108,Referral to post-COVID assessment clinic
1325041000000104,Referral to Your COVID Recovery rehabilitation platform
4 changes: 4 additions & 0 deletions codelists/user-hendersonad-hes-long-covid.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
code,term
B948,Sequelae of other specified infectious and parasitic diseases
U09,Post COVID-19 condition
U099,"Post COVID-19 condition, unspecified"
10 changes: 6 additions & 4 deletions reports/coverage/mabs_and_antivirals_coverage_report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ library(magick)
source(here("analysis", "lib", "custom_functions.R"))
# Input directory ----
input_dir_os <- here("released_outputs", "reports", "coverage")
#input_dir_os <- here("output", "coverage")
# Output directory ----
output_dir_rmd <- here("reports", "coverage")
fs::dir_create(output_dir_rmd)
# Import data ----
report_stats <- read_csv(fs::path(input_dir_os, "table_report_stats_redacted.csv"))
flowchart_non_elig <- read_csv(fs::path(input_dir_os, "table_non_elig_flowchart_redacted.csv"))
Expand Down Expand Up @@ -524,9 +526,9 @@ table_demo_clinc_breakdown_redacted <-
mutate(Group = factor(Group,
levels = c("All", "ageband", "sex", "ethnicity", "imd", "rural_urban", "region_nhs", "autism_nhsd", "care_home_primis",
"dementia_nhsd", "learning_disability_primis", "serious_mental_illness_nhsd",
"housebound_opensafely", "shielded_primis", "sickle_cell_disease_nhsd", "vaccination_status"),
"housebound_opensafely", "shielded_primis", "sickle_cell_disease_nhsd", "long_covid", "vaccination_status"),
labels = c("All", "Age band", "Sex", "Ethnicity", "IMD", "Rurality", "Region", "Autism", "Care home", "Dementia",
"Learning disability ", "Serious mental illness", "Housebound", "CEV", "Sickle cell disease",
"Learning disability ", "Serious mental illness", "Housebound", "CEV", "Sickle cell disease", "Long COVID",
"Vaccination status")),
Variable = factor(Variable,
levels = c("-", "12-29", "30-39", "40-49", "50-59", "60-69", "70-79", "80+",
Expand All @@ -539,7 +541,7 @@ table_demo_clinc_breakdown_redacted <-
"South West", "West Midlands", "Yorkshire and the Humber",
"autism_nhsd", "care_home_primis",
"dementia_nhsd", "learning_disability_primis", "serious_mental_illness_nhsd",
"housebound_opensafely", "shielded_primis", "sickle_cell_disease_nhsd",
"housebound_opensafely", "shielded_primis", "sickle_cell_disease_nhsd", "long_covid",
"Un-vaccinated (declined)", "Un-vaccinated" , "One vaccination", "Two vaccinations",
"Three or more vaccinations", "Unknown"),
labels = c("-", "12-29", "30-39", "40-49", "50-59", "60-69", "70-79", "80+",
Expand All @@ -551,7 +553,7 @@ table_demo_clinc_breakdown_redacted <-
"East Midlands", "East of England", "London", "North East", "North West", "South East",
"South West", "West Midlands", "Yorkshire and the Humber",
"Autism", "Care home", "Dementia", "Learning disability ", "Serious mental illness",
"Housebound", "CEV", "Sickle cell disease",
"Housebound", "CEV", "Sickle cell disease", "Long COVID",
"Un-vaccinated (declined)", "Un-vaccinated" , "One vaccination", "Two vaccinations",
"Three or more vaccinations", "Unknown"))) %>%
arrange(Group, Variable) %>%
Expand Down

0 comments on commit 6f851c2

Please sign in to comment.