Skip to content

Commit

Permalink
Merge branch 'main' into reviewer-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
johntaz authored Apr 21, 2022
2 parents cb30efc + c68a972 commit 2736d08
Show file tree
Hide file tree
Showing 36 changed files with 44,804 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ analysis/.DS_Store
.DS_Store
!.gitkeep
untitled folder/local run.do

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) University of Oxford

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 3 additions & 3 deletions analysis/draw_rate_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

df = pd.DataFrame()
for f in groups:
df = df.append(pd.read_csv(f"released_output/rates_summary_{f}.csv"))
df = df.append(pd.read_csv(f"released_outputs/output/tabfig/rates_summary_{f}.csv"))
df = df.replace(to_replace=dict(zip(old_names, new_names)))
df = df.set_index(["group", "outcome", "time"])
df = df.loc[df["variable"] == "Overall"]
Expand All @@ -27,7 +27,7 @@ def plot_rates(outcome_group, rows):
for i, ax in enumerate(axes.flat):
df_to_plot = df.loc[df.index.isin(rows, level=1)]
df_to_plot = df_to_plot.loc[groups[i]]
df_to_plot = df_to_plot * 100
df_to_plot = df_to_plot * 120
df_to_plot = df_to_plot.unstack(level=-1)
errlo = df_to_plot["rate_ppm"] - df_to_plot["lc_ppm"]
errhi = df_to_plot["uc_ppm"] - df_to_plot["rate_ppm"]
Expand All @@ -40,7 +40,7 @@ def plot_rates(outcome_group, rows):
ax.set_title(titles[i], loc="left")
ax.legend(loc=2).set_title("Time since hospital discharge")
ax.set_xticklabels(labels)
ax.set_ylabel("Rate of each outcome (per 10,000 person months)")
ax.set_ylabel("Rate of each outcome (per 1,000 person years)")
ax.grid(b=True, axis="y", color="#666666", linestyle="-", alpha=0.1)
plt.tight_layout()
plt.savefig(f"output/rate_graphs{outcome_group}.svg")
Expand Down
2 changes: 2 additions & 0 deletions released_outputs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
metadata/*
output/measure*
36 changes: 36 additions & 0 deletions released_outputs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Table of contents

* [.gitignore](.gitignore)
* output
* [output/append_cohorts.txt](output/append_cohorts.txt)
* [output/competing_events.txt](output/competing_events.txt)
* [output/cox_models.txt](output/cox_models.txt)
* [output/matching_report_general_population.txt](output/matching_report_general_population.txt)
* output/tabfig
* [output/tabfig/an_descriptiveTable_covid.txt](output/tabfig/an_descriptiveTable_covid.txt)
* [output/tabfig/an_descriptiveTable_covid_community.txt](output/tabfig/an_descriptiveTable_covid_community.txt)
* [output/tabfig/an_descriptiveTable_gen_population.txt](output/tabfig/an_descriptiveTable_gen_population.txt)
* [output/tabfig/an_descriptiveTable_pneumonia.txt](output/tabfig/an_descriptiveTable_pneumonia.txt)
* [output/tabfig/an_descriptiveTable_pre_covid_discharged.txt](output/tabfig/an_descriptiveTable_pre_covid_discharged.txt)
* [output/tabfig/an_descriptiveTable_pre_pneum_discharged.txt](output/tabfig/an_descriptiveTable_pre_pneum_discharged.txt)
* [output/tabfig/cox_model_summary.csv](output/tabfig/cox_model_summary.csv)
* [output/tabfig/cox_model_summary_time_strat.csv](output/tabfig/cox_model_summary_time_strat.csv)
* [output/tabfig/cumInc_aki_cens_gp.svg](output/tabfig/cumInc_aki_cens_gp.svg)
* [output/tabfig/cumInc_dvt_cens_gp.svg](output/tabfig/cumInc_dvt_cens_gp.svg)
* [output/tabfig/cumInc_heart_failure_cens_gp.svg](output/tabfig/cumInc_heart_failure_cens_gp.svg)
* [output/tabfig/cumInc_mi_cens_gp.svg](output/tabfig/cumInc_mi_cens_gp.svg)
* [output/tabfig/cumInc_pe_cens_gp.svg](output/tabfig/cumInc_pe_cens_gp.svg)
* [output/tabfig/cumInc_stroke_cens_gp.svg](output/tabfig/cumInc_stroke_cens_gp.svg)
* [output/tabfig/fine_gray_summary.csv](output/tabfig/fine_gray_summary.csv)
* [output/tabfig/fine_gray_summary_time_strat.csv](output/tabfig/fine_gray_summary_time_strat.csv)
* [output/tabfig/fine_gray_summary_time_strat_age_sex.csv](output/tabfig/fine_gray_summary_time_strat_age_sex.csv)
* [output/tabfig/follow_up_summary.csv](output/tabfig/follow_up_summary.csv)
* [output/tabfig/outcomes_in_hosp_covid.csv](output/tabfig/outcomes_in_hosp_covid.csv)
* [output/tabfig/outcomes_in_hosp_pneumonia.csv](output/tabfig/outcomes_in_hosp_pneumonia.csv)
* [output/tabfig/rate_graphs_all.svg](output/tabfig/rate_graphs_all.svg)
* [output/tabfig/rate_graphs_cens_gp.svg](output/tabfig/rate_graphs_cens_gp.svg)
* [output/tabfig/rate_graphs_no_gp.svg](output/tabfig/rate_graphs_no_gp.svg)
* [output/tabfig/rates_summary_covid.csv](output/tabfig/rates_summary_covid.csv)
* [output/tabfig/rates_summary_covid_community.csv](output/tabfig/rates_summary_covid_community.csv)
* [output/tabfig/rates_summary_gen_population.csv](output/tabfig/rates_summary_gen_population.csv)
* [output/tabfig/rates_summary_pneumonia.csv](output/tabfig/rates_summary_pneumonia.csv)
109 changes: 109 additions & 0 deletions released_outputs/output/append_cohorts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
-------------------------------------------------------------------------------
name: <unnamed>
log: /workspace/output/append_cohorts.txt
log type: text
opened on: 13 Jun 2021, 10:04:50

.
. * Gen flag for covid patients (case = 1)
. use $outdir/cohort_rates_covid, replace

. gen case = 1

. append using $outdir/cohort_rates_pneumonia, force
(label diabcat already defined)
(label reduced_kidney_function_cat2lab already defined)
(label cancer already defined)
(label bpcat already defined)
(label asthmacat already defined)
(label obese4cat already defined)
(label bmicat already defined)
(label agegroup already defined)
(label region_7 already defined)
(label region_9 already defined)
(label ethnicity_lab already defined)
(label smoke already defined)
(label imd already defined)
(label sexLab already defined)

. replace case = 0 if case ==.
(127,715 real changes made)

.
. * count patients from pneumonia group who are among Covid group
. bysort patient_id: gen flag = _n

. safecount if flag == 2
3,535

.
. noi di "number of patients in both cohorts is `r(N)'"
number of patients in both cohorts is 3535

.
. drop flag

. save $outdir/combined_covid_pneumonia.dta, replace
(note: file /workspace/output/combined_covid_pneumonia.dta not found)
file /workspace/output/combined_covid_pneumonia.dta saved

.
.
.
. *****************************************************************************
> ***
. * Append covid/gen pop. cohorts
.
. * Gen flag for covid patients (case = 1)
. use $outdir/cohort_rates_covid, replace

. gen case = 1

. append using $outdir/cohort_rates_gen_population, force
(label diabcat already defined)
(label reduced_kidney_function_cat2lab already defined)
(label cancer already defined)
(label bpcat already defined)
(label asthmacat already defined)
(label obese4cat already defined)
(label bmicat already defined)
(label agegroup already defined)
(label region_7 already defined)
(label region_9 already defined)
(label ethnicity_lab already defined)
(label smoke already defined)
(label imd already defined)
(label sexLab already defined)

. replace case = 0 if case ==.
(0 real changes made)

.
.
. * count patients from pneumonia group who are among Covid group
. bysort patient_id: gen flag = _n

. safecount if flag == 2
1,404

.
. noi di "number of patients in both cohorts is `r(N)'"
number of patients in both cohorts is 1404

.
. drop flag

. save $outdir/combined_covid_gen_population.dta, replace
(note: file /workspace/output/combined_covid_gen_population.dta not found)
file /workspace/output/combined_covid_gen_population.dta saved

.
.
.
.
. log close
name: <unnamed>
log: /workspace/output/append_cohorts.txt
log type: text
closed on: 13 Jun 2021, 10:04:54
-------------------------------------------------------------------------------
Loading

0 comments on commit 2736d08

Please sign in to comment.