Skip to content

Commit

Permalink
Clarify the source of saved files
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewscolm committed Feb 23, 2024
1 parent 69ecd05 commit 92b6fc7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
56 changes: 28 additions & 28 deletions analysis/report_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np


def local_patient_counts(
def report_patient_counts(
definitions,
group,
defin,
Expand Down Expand Up @@ -140,21 +140,21 @@ def local_patient_counts(

if categories:
df_patient_counts.to_csv(
f"output/{output_path}/local_patient_counts_categories_{group}_{defin}_registered.csv"
f"output/{output_path}/report_patient_counts_categories_{group}_{defin}_registered.csv"
)
print(
f"saved: output/{output_path}/local_patient_counts_categories_{group}_{defin}_registered.csv"
f"saved: output/{output_path}/report_patient_counts_categories_{group}_{defin}_registered.csv"
)
else:
df_patient_counts.to_csv(
f"output/{output_path}/local_patient_counts_{group}_{defin}_registered.csv"
f"output/{output_path}/report_patient_counts_{group}_{defin}_registered.csv"
)
print(
f"saved: output/{output_path}/local_patient_counts_{group}_{defin}_registered.csv"
f"saved: output/{output_path}/report_patient_counts_{group}_{defin}_registered.csv"
)


def local_latest_common(
def report_latest_common(
definitions,
input_path,
output_path,
Expand Down Expand Up @@ -222,7 +222,7 @@ def local_latest_common(
df_out = df_out.set_index(f"Latest Ethnicity-\n{definition_dict[definition]}")
df_out = df_out.replace(np.nan, "-")
df_out.to_csv(
f"output/{output_path}/local_latest_common_{definition}_registered.csv"
f"output/{output_path}/report_latest_common_{definition}_registered.csv"
)

if code_dict != "":
Expand Down Expand Up @@ -255,11 +255,11 @@ def local_latest_common(
)
df_sum = df_sum.set_index(f"Latest Ethnicity-\n{definition_dict[definition]}")
df_sum.to_csv(
f"output/{output_path}/local_latest_common_{defin}_{group}_expanded_registered.csv"
f"output/{output_path}/report_latest_common_{defin}_{group}_expanded_registered.csv"
)


def local_state_change(
def report_state_change(
definitions,
input_path,
output_path,
Expand Down Expand Up @@ -313,7 +313,7 @@ def local_state_change(
f"Latest Ethnicity-\n{definition_dict[definition]}"
)
df_state_change.to_csv(
f"output/{output_path}/local_state_change_{defin}_{group}_registered.csv"
f"output/{output_path}/report_state_change_{defin}_{group}_registered.csv"
)


Expand Down Expand Up @@ -502,7 +502,7 @@ def local_state_change(


def main():
local_patient_counts(
report_patient_counts(
definitions_sus_5,
group_5,
"new_sus",
Expand All @@ -513,7 +513,7 @@ def main():
categories=False,
missing=False,
)
local_patient_counts(
report_patient_counts(
definitions_sus_5,
group_5,
"new_sus",
Expand All @@ -524,7 +524,7 @@ def main():
categories=True,
missing=False,
)
local_patient_counts(
report_patient_counts(
definitions_sus_5_ctv3,
group_5,
"ctv3_sus",
Expand All @@ -535,7 +535,7 @@ def main():
categories=False,
missing=False,
)
local_patient_counts(
report_patient_counts(
definitions_5,
group_5,
"new_ctv3",
Expand All @@ -546,7 +546,7 @@ def main():
categories=False,
missing=False,
)
local_patient_counts(
report_patient_counts(
definitions_supplemented_ctv3_5,
group_5,
"ctv3_sus",
Expand All @@ -559,7 +559,7 @@ def main():
)

#### 16 group
local_patient_counts(
report_patient_counts(
definitions_sus_16,
group_16,
"new_sus",
Expand All @@ -570,7 +570,7 @@ def main():
categories=False,
missing=False,
)
local_patient_counts(
report_patient_counts(
definitions_sus_16_ctv3,
group_16,
"ctv3_sus",
Expand All @@ -581,7 +581,7 @@ def main():
categories=False,
missing=False,
)
local_patient_counts(
report_patient_counts(
definitions_16,
group_16,
"new_ctv3",
Expand All @@ -592,7 +592,7 @@ def main():
categories=False,
missing=False,
)
local_patient_counts(
report_patient_counts(
definitions_supplemented_ctv3_16,
group_16,
"ctv3_sus",
Expand All @@ -604,7 +604,7 @@ def main():
missing=False,
)

local_patient_counts(
report_patient_counts(
definitions_supplemented_16,
group_16,
"new_sus",
Expand All @@ -616,7 +616,7 @@ def main():
missing=False,
)
# Most recent vs most common
local_latest_common(
report_latest_common(
["ethnicity_new_5"],
input_path_new,
output_path,
Expand All @@ -626,7 +626,7 @@ def main():
definition_dict_new,
suffix,
)
local_latest_common(
report_latest_common(
["ethnicity_new_16"],
input_path_new,
output_path,
Expand All @@ -636,7 +636,7 @@ def main():
definition_dict_new,
suffix,
)
local_latest_common(
report_latest_common(
["ethnicity_5"],
input_path_new,
output_path,
Expand All @@ -646,7 +646,7 @@ def main():
definition_dict_ctv3,
suffix,
)
local_latest_common(
report_latest_common(
["ethnicity_16"],
input_path_new,
output_path,
Expand All @@ -657,7 +657,7 @@ def main():
suffix,
)
# Most recent vs any
local_state_change(
report_state_change(
["ethnicity_new_5"],
input_path_new,
output_path,
Expand All @@ -666,7 +666,7 @@ def main():
code_dict_5,
definition_dict_new,
)
local_state_change(
report_state_change(
["ethnicity_new_16"],
input_path_new,
output_path,
Expand All @@ -675,7 +675,7 @@ def main():
code_dict_16,
definition_dict_new,
)
local_state_change(
report_state_change(
["ethnicity_5"],
input_path_new,
output_path,
Expand All @@ -684,7 +684,7 @@ def main():
code_dict_5,
definition_dict_new,
)
local_state_change(
report_state_change(
["ethnicity_16"],
input_path_new,
output_path,
Expand Down
Loading

0 comments on commit 92b6fc7

Please sign in to comment.