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

Exp consistent lifespans #20

Draft
wants to merge 6 commits into
base: exp-crccp-replication
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions crcsim/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,11 +970,11 @@ def compute_pop_rates(self, status_arrays: list):
"""
# Sum all of the person status arrays to get an array of counts of the number of
# people in each status for each year.
statuses: np.ndarray = sum(status_arrays)
status_array: np.ndarray = sum(status_arrays)

# Convert to DataFrame so we can index by column name
statuses = pd.DataFrame(
statuses,
status_array,
columns=[
"alive",
"crc_death",
Expand Down
19 changes: 5 additions & 14 deletions crcsim/experiment/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
# Replication of the CRCCP intervention scenarios
# Testing changes to expected lifespan calculation

This experiment is a replication of the CRCCP compliance intervention experiment, which was conducted prior to open-sourcing the model and making some changes to the AWS infrastructure. We are replicating this experiment to ensure continuity after those changes.
This experiment tests new `crcsim` functionality to make expected lifespans consistent when the model is run with a given random seed.

The CRCCP compliance intervention experiment examines the cost-effectiveness of interventions designed to improve compliance with routine screening.

The experiment is designed around 8 health centers (labeled FHQC1-FHQC8), each having its own baseline compliance rate, intervention cost, and post-intervention compliance rate.

We don't model the intervention explicitly. In other words, we didn't add any code to the model to implement the intervention. Instead, we model the intervention by assuming it leads to a change in the compliance rate, and so we run a pair of simulations: one using the baseline compliance rate and another using the post-intervention compliance rate. Any differences in outcomes can therefore be attributed to the intervention.
## Scenarios

Includes 2 scenarios per health center: one baseline scenario and one intervention scenario. The baseline scenarios are based on real data and the intervention scenarios include a hypothetical increase in screening compliance rates.

The scenarios are created by `prepare.py`. This script reads a set of base parameters defined in `crcsim/experiment/parameters.json`, modifies them to create the scenarios, and saves them in a directory structure that will eventually be copied to AWS.
See https://github.com/RTIInternational/crcsim/pull/18 for rationale.

## Defining new experiments

Expand Down Expand Up @@ -53,7 +44,7 @@ The subdirectories and files in `scenarios/` must be uploaded to AWS S3 for the

To upload the files to S3, run
```
aws s3 cp ./scenarios s3://crcsim-exp-crccp-replication/scenarios --recursive
aws s3 cp ./scenarios s3://crcsim-exp-consistent-lifespans/scenarios --recursive
```
*(Another note: this manual step is necessary because `boto3` does not include functionality to upload a directory to S3 recursively. Future experiments could improve this workflow by writing a function to upload the directory recursively in `prepare.py`. Or submit a patch to resolve https://github.com/boto/boto3/issues/358)*

Expand Down Expand Up @@ -98,7 +89,7 @@ Most of the AWS architecture was built via the AWS Console. As such, there is no

### S3

We used the S3 console to create the `crcsim-exp-template` bucket to store output files generated by simulation jobs.
We used the S3 console to create the `crcsim-exp-consistent-lifespans` bucket to store output files generated by simulation jobs.

### IAM

Expand Down
14 changes: 7 additions & 7 deletions crcsim/experiment/parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"proportion_survive_clin3": 0,
"proportion_survive_clin4": 0,

"cost_polypectomy": 170,
"cost_polypectomy": 650,
"cost_polyp_pathology": 65,

"cost_treatment_stage1_initial": 34258,
Expand Down Expand Up @@ -71,31 +71,31 @@
"tests": {
"FIT": {
"proportion": 1.0,
"routine_start": 50,
"routine_start": 45,
"routine_end": 75,
"routine_freq": 1,
"specificity": 0.97,
"sensitivity_polyp1": 0.07,
"sensitivity_polyp2": 0.07,
"sensitivity_polyp3": 0.22,
"sensitivity_cancer": 0.74,
"cost": 22,
"cost": 27,
"proportion_perforation": 0,
"cost_perforation": 0,
"compliance_rate_given_prev_compliant": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ],
"compliance_rate_given_not_prev_compliant": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]
},
"Colonoscopy": {
"proportion": 0.0,
"routine_start": 50,
"routine_start": 45,
"routine_end": 75,
"routine_freq": 10,
"specificity": 0.86,
"sensitivity_polyp1": 0.75,
"sensitivity_polyp2": 0.85,
"sensitivity_polyp3": 0.95,
"sensitivity_cancer": 0.95,
"cost": 700,
"cost": 1608,
"proportion_perforation": 0.001,
"cost_perforation": 6487,
"compliance_rate_given_prev_compliant": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ],
Expand All @@ -107,9 +107,9 @@
"surveillance_test": "Colonoscopy",
"polypectomy_proportion_lethal": 0.00002,

"cost_discount_age": 50,
"cost_discount_age": 45,
"cost_discount_rate": 0.03,
"lifespan_discount_age": 50,
"lifespan_discount_age": 45,
"lifespan_discount_rate": 0.03,

"death_rate_black_female_ages": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ],
Expand Down
2 changes: 1 addition & 1 deletion crcsim/experiment/requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Clone the specific commit of the model that you want to use for the experiment
git+https://github.com/RTIInternational/crcsim.git@55312a08eb176556555ce5ecb99ba9628d0afc3e
git+https://github.com/RTIInternational/crcsim.git@6c264ca5e35c1b9ae20a6e4b95818f6e00970d71

fire
pandas==2.1.1
Expand Down
2 changes: 1 addition & 1 deletion crcsim/experiment/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ colorama==0.4.4
# via awscli
contourpy==1.1.1
# via matplotlib
crcsim @ git+https://github.com/RTIInternational/crcsim.git@55312a08eb176556555ce5ecb99ba9628d0afc3e
crcsim @ git+https://github.com/RTIInternational/crcsim.git@6c264ca5e35c1b9ae20a6e4b95818f6e00970d71
# via -r requirements.in
cycler==0.12.0
# via matplotlib
Expand Down
6 changes: 3 additions & 3 deletions crcsim/experiment/run_iteration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ ! -d "$output_dir" ]; then
mkdir $output_dir
fi

aws s3 cp "s3://crcsim-exp-crccp-replication/scenarios/$scenario/params.json" "./params.json"
aws s3 cp "s3://crcsim-exp-consistent-lifespans/scenarios/$scenario/params.json" "./params.json"

crc-simulate \
--npeople=$npeople \
Expand All @@ -23,5 +23,5 @@ crc-simulate \
crc-analyze \
--params-file=./params.json &&

aws s3 cp ./results.csv "s3://crcsim-exp-crccp-replication/scenarios/$scenario/results_$iteration.csv"
aws s3 cp ./output.csv "s3://crcsim-exp-crccp-replication/scenarios/$scenario/output_$iteration.csv"
aws s3 cp ./results.csv "s3://crcsim-exp-consistent-lifespans/scenarios/$scenario/results_$iteration.csv"
aws s3 cp ./output.csv "s3://crcsim-exp-consistent-lifespans/scenarios/$scenario/output_$iteration.csv"
Loading
Loading