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

Merge exp-consistent-lifespans and exp-consistent summary #25

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
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
41 changes: 41 additions & 0 deletions crcsim/experiment/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,40 @@ def add_derived_variables(df: pd.DataFrame) -> pd.DataFrame:
+ df["discounted_cost_treatment"]
)

df["cost_treatment_per_1k_40yo"] = (
df["cost_treatment_initial_per_1k_40yo"]
+ df["cost_treatment_ongoing_per_1k_40yo"]
+ df["cost_treatment_terminal_per_1k_40yo"]
)

df["discounted_cost_treatment_per_1k_40yo"] = (
df["discounted_cost_treatment_initial_per_1k_40yo"]
+ df["discounted_cost_treatment_ongoing_per_1k_40yo"]
+ df["discounted_cost_treatment_terminal_per_1k_40yo"]
)

df["cost_total_per_1k_40yo"] = (
df["cost_routine_per_1k_40yo"]
+ df["cost_diagnostic_per_1k_40yo"]
+ df["cost_surveillance_per_1k_40yo"]
+ df["cost_treatment_per_1k_40yo"]
)

df["discounted_cost_total_per_1k_40yo"] = (
df["discounted_cost_routine_per_1k_40yo"]
+ df["discounted_cost_diagnostic_per_1k_40yo"]
+ df["discounted_cost_surveillance_per_1k_40yo"]
+ df["discounted_cost_treatment_per_1k_40yo"]
)

df["total_colonoscopy"] = (
df["Colonoscopy_performed_diagnostic_per_1k_40yo_mean"] + df["Colonoscopy_performed_surveillance_per_1k_40yo_mean"]
)

return df



def summarize_results(df: pd.DataFrame) -> pd.DataFrame:
""" Compute the mean and standard deviation of every analysis variable, by scenario. """
groups = df.groupby("scenario")
Expand All @@ -131,6 +162,7 @@ def summarize_results(df: pd.DataFrame) -> pd.DataFrame:
select_columns = ["scenario",
"Colonoscopy_performed_diagnostic_per_1k_40yo_mean",
"Colonoscopy_performed_surveillance_per_1k_40yo_mean",
"total_colonoscopy",
"FIT_performed_routine_per_1k_40yo_mean",
"clin_crc_per_1k_40yo_mean",
"deadcrc_per_1k_40yo_mean",
Expand All @@ -141,25 +173,34 @@ def summarize_results(df: pd.DataFrame) -> pd.DataFrame:
"discounted_cost_treatment_initial_mean",
"discounted_cost_treatment_ongoing_mean",
"discounted_cost_treatment_terminal_mean",
"discounted_cost_treatment",
"discounted_cost_total",
"cost_routine_mean",
"cost_diagnostic_mean",
"cost_surveillance_mean",
"cost_treatment_initial_mean",
"cost_treatment_ongoing_mean",
"cost_treatment_terminal_mean",
"cost_treatment",
"cost_total",
"discounted_cost_routine_per_1k_40yo_mean",
"discounted_cost_diagnostic_per_1k_40yo_mean",
"discounted_cost_surveillance_per_1k_40yo_mean",
"discounted_cost_treatment_initial_per_1k_40yo_mean",
"discounted_cost_treatment_ongoing_per_1k_40yo_mean",
"discounted_cost_treatment_terminal_per_1k_40yo_mean",
"discounted_cost_treatment_per_1k_40yo_mean",
"discounted_cost_total_per_1k_40yo",
"cost_routine_per_1k_40yo_mean",
"cost_diagnostic_per_1k_40yo_mean",
"cost_surveillance_per_1k_40yo_mean",
"cost_treatment_initial_per_1k_40yo_mean",
"cost_treatment_ongoing_per_1k_40yo_mean",
"cost_treatment_terminal_per_1k_40yo_mean",
"cost_treatment_per_1k_40yo_mean",
"cost_total_per_1k_40yo",
"discounted_lifeobs_if_unscreened_undiagnosed_at_40_mean"]

summary_subset = summary[select_columns]

return summary, summary_subset
Expand Down
Loading