-
Notifications
You must be signed in to change notification settings - Fork 3
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
Vax dedup #26
Merged
Merged
Vax dedup #26
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
744a7fe
Added support for intervention replacement. Requires new version of m…
5179cbf
Add sft tests and update unittests and integration tests (#23)
shchen-idmod b39fc3a
Point setup to 2018 req file.
099dcd1
Bump patch version 0.0.5 via Jenkins
bamboouser-IDM 37aed6e
Add more examples (#25)
shchen-idmod 5386836
Tweaked demo of vax de-duplication.
b0de69b
Merge remote-tracking branch 'origin/main' into vax_dedup
3be0cc3
Updated to new model in req's.
614f696
Fixes per cr from @shchen-idmod.org.
94b311b
Combine deduplication model should set _D_A_D to 0.
b83d085
Combine deduplication model should set _D_A_D to 0.
7fb123e
Fixes per cr from @shchen-idmod.org.
00ec0d5
deduplication policy will not have a default.
e7092ff
deduplication policy will not have a default.
452d7d9
Upgrade hard version dep of model to 0.0.5.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,14 +94,14 @@ def add_historical_vax( camp, ria_coverage=0.75, camp_coverage=0.75, efficacy=0. | |
ria = tv.new_routine_immunization(camp, | ||
efficacy=efficacy, | ||
constant_period=0, | ||
expected_expiration=expiration, | ||
#decay_constant=values['decay_constant'], | ||
#expected_expiration=expiration, | ||
decay_constant=expiration, | ||
start_day=year_to_days(CAMP_START_YEAR), | ||
coverage=ria_coverage) | ||
tv_iv = tv.new_vax(camp, | ||
efficacy=efficacy, | ||
expected_expiration=expiration, | ||
#decay_constant=values['decay_constant'], | ||
#expected_expiration=expiration, | ||
decay_constant=expiration, | ||
constant_period=0) | ||
|
||
notification_iv = comm.BroadcastEvent(camp, "VaccineDistributed") | ||
|
@@ -113,7 +113,7 @@ def add_historical_vax( camp, ria_coverage=0.75, camp_coverage=0.75, efficacy=0. | |
Demographic_Coverage=camp_coverage, | ||
Target_Age_Min=0.75, | ||
Target_Age_Max=15 | ||
) | ||
) | ||
camp.add(one_time_campaign) | ||
|
||
#add_historical_vax( camp ) | ||
|
@@ -150,7 +150,12 @@ def add_vax_intervention(campaign, values, min_age=0.75, max_age=15, binary_immu | |
import emodpy_typhoid.interventions.typhoid_vaccine as tv | ||
print(f"Telling emod-api to use {manifest.schema_file} as schema.") | ||
campaign.set_schema(manifest.schema_file) | ||
camp_coverage = values['coverage'] | ||
for key in values.keys(): | ||
if 'coverage' in key: | ||
camp_coverage = values[key] | ||
break | ||
else: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to else |
||
camp_coverage = values['coverage_camp'] | ||
|
||
if binary_immunity: | ||
tv_iv = tv.new_vax(campaign, | ||
|
@@ -164,6 +169,12 @@ def add_vax_intervention(campaign, values, min_age=0.75, max_age=15, binary_immu | |
constant_period=0) | ||
|
||
notification_iv = comm.BroadcastEvent(campaign, "VaccineDistributed") | ||
# NOTE: the order of interventions in Intervention_List matters. This is because multiple | ||
# interventions are delivered using a MultiInterventionDistributor intervention and de-duplication | ||
# operates on Intervention_Name, so that when we try to distribute this intervention 'package', | ||
# the model looks at the name of the existing intervention, which is the vax, and the name of the | ||
# 'package' here, which would be MultiInterventionDistributor. But there is code in emod_api which | ||
# sets the MID name to the name of the first intervention in the list, which here will be SimpleVaccine. | ||
one_time_campaign = comm.ScheduledCampaignEvent(campaign, | ||
Start_Day=year_to_days(FWD_CAMP_START_YEAR), | ||
Intervention_List=[tv_iv, notification_iv], | ||
|
@@ -286,15 +297,26 @@ def get_sweep_list_duration(): | |
sweep_list.append({'start_day_offset': c[0], 'efficacy': c[1], 'coverage': c[2], 'decay_constant': c[3]}) | ||
return sweep_list | ||
|
||
def get_sweep_list_just_one(): | ||
start_day_offset = [1] | ||
vax_effs = [1] | ||
decay = [3000] | ||
cov = [0.75] | ||
combinations = list(itertools.product(start_day_offset, vax_effs, cov, decay)) | ||
sweep_list = [] | ||
for c in combinations: | ||
sweep_list.append({'start_day_offset': c[0], 'efficacy': c[1], 'coverage_camp': c[2], 'decay_constant': c[3]}) | ||
return sweep_list | ||
|
||
def get_sweep_list_from_csv(): | ||
# This is wrong. Just load rows. Code is recreating. But have to stop work for now. | ||
import pandas as pd | ||
df = pd.load_csv( manifest.sweep_config ) | ||
raise NotImplemented( "get_sweep_list_from_csv" ) | ||
|
||
def get_config_sweep_list(): | ||
tac = [ 13435, 15320 ] | ||
tel = [ 5.0, 7.0 ] | ||
tac = [ 13435 ] | ||
tel = [ 7.0 ] | ||
combinations = list(itertools.product(tac, tel)) | ||
sweep_list = [] | ||
for c in combinations: | ||
|
@@ -307,7 +329,8 @@ def get_config_sweep_list(): | |
"Coverage": get_sweep_list_coverage, | ||
"Coverage_RIA": get_sweep_list_coverage_ria, | ||
"Coverage_Camp": get_sweep_list_coverage_camp, | ||
"Vax_Duration": get_sweep_list_duration | ||
"Vax_Duration": get_sweep_list_duration, | ||
"Just_One": get_sweep_list_just_one | ||
} | ||
|
||
if sweep_choice not in sweep_selections.keys(): | ||
|
@@ -319,10 +342,7 @@ def get_config_sweep_list(): | |
else: | ||
avi_age_coverage = partial( add_vax_intervention, min_age=0, max_age=125 ) | ||
|
||
if binary_immunity: | ||
avi_decay = partial( avi_age_coverage, binary_immunity=True ) | ||
else: | ||
avi_decay = partial( avi_age_coverage, binary_immunity=False ) | ||
avi_decay = partial( avi_age_coverage, binary_immunity=binary_immunity ) | ||
|
||
builders = get_sweep_builders(sweep_list, get_config_sweep_list(), add_vax_fn=avi_decay) | ||
|
||
|
@@ -344,4 +364,4 @@ def get_config_sweep_list(): | |
dtk.setup(manifest.model_dl_dir) | ||
|
||
import sys | ||
run( sys.argv[1] if len(sys.argv)>1 else "Efficacy" ) | ||
run( sys.argv[1] if len(sys.argv)>1 else "Just_One", binary_immunity=False ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to change the last word in this line