Source code for emodpy_generic.interventions.polio_vaccine
from emod_api import schema_to_class as s2c
import json
vaccine_type = "AcquisitionBlocking"
iv_name = "IPV"
schema_path = None
#dupe_policy = "Replace" # or "Add" or "Abort" -- from covid branch
# Note that duration (what we call waning profile) needs to be configurable, but in an intuitive way
def _SimpleIPV(camp, timestep=1, coverage=1.0, AgeAtVaccInDays=1, mv_name=iv_name ):
if camp is not None:
schema_path = camp.schema_path
# First, get the objects
event = s2c.get_class_with_defaults( "CampaignEvent", schema_path )
coordinator = s2c.get_class_with_defaults( "StandardEventCoordinator", schema_path )
if coordinator is None:
print( "s2c.get_class_with_defaults returned None. Maybe no schema.json was provided." )
return ""
intervention = s2c.get_class_with_defaults( "Vaccine", schema_path )
efficacy_profile = "WaningEffect"
waning = s2c.get_class_with_defaults( efficacy_profile, schema_path )
waning.Initial_Effect = 0.999
meta_meta_intervention = s2c.get_class_with_defaults( "DelayedIntervention", schema_path )
meta_meta_intervention.Actual_IndividualIntervention_Configs = [ intervention ]
meta_meta_intervention.Delay_Period_Distribution="CONSTANT_DISTRIBUTION"
meta_meta_intervention.Delay_Period_Constant=AgeAtVaccInDays
meta_intervention = s2c.get_class_with_defaults( "NodeLevelHealthTriggeredIV", schema_path )
meta_intervention.Demographic_Coverage=coverage
meta_intervention.Duration=-1
meta_intervention.Trigger_Condition_List=['Births']
meta_intervention.Actual_IndividualIntervention_Config = meta_meta_intervention
# Second, hook them up
event.Event_Coordinator_Config = coordinator
coordinator.Intervention_Config = meta_intervention
intervention.Acquire_Config = waning
event.Start_Day = float(timestep+1)
# Third, do the actual settings
intervention.Intervention_Name = mv_name
#intervention.Duplicate_Policy = dupe_policy
# Fourth/finally, purge the schema bits
event["Name"] = "IPV" # ???
return event
[docs]def SimpleIPV1(camp, timestep=1, coverage=1.0 ):
"""
IPV (round 1) Campaign Event
AgeAtVaccIInDays is hard-coded to 270.
:param coverage: WHO?
:param timestep: WHEN?
Returns:
Campaign event that can be added to campaign.
"""
return _SimpleIPV(camp, timestep, coverage=coverage, AgeAtVaccInDays=270, mv_name="IPV1" )
[docs]def SimpleIPV2(camp, timestep=1, coverage=1.0 ):
"""
IPV (round 1) Campaign Event
AgeAtVaccIInDays is hard-coded to 270.
:param coverage: WHO?
:param timestep: WHEN?
Returns:
Campaign event that can be added to campaign.
"""
return _SimpleIPV(camp, timestep, coverage=coverage, AgeAtVaccInDays=475, mv_name="IPV2" )
[docs]def new_intervention_as_file( timestep, filename=None ):
"""
This function mostly exists for testing so one can exercise the functionality in a single function call.
"""
camp.add( SimpleIPV1( timestep, vaccine_type, iv_name ) )
if filename is None:
filename = "polio_vaccine.json"
camp.save( filename )
return filename