Source code for emodpy_typhoid.interventions.tcd

from emod_api import schema_to_class as s2c
from emod_api.interventions import utils
from emod_api.interventions import common
import json

[docs]def new_intervention( camp, sensitivity=1.0, specificity=1.0, days_to_diag = 1, pos_event="TestedPositive", tx_fraction=1.0 ): """ TyphoidCarrierDiagnostic intervention wrapper. Just the intervention. No configuration yet. """ intervention = s2c.get_class_with_defaults( "TyphoidCarrierDiagnostic", camp.schema_path ) intervention.Base_Sensitivity = sensitivity intervention.Base_Specificity = specificity intervention.Days_To_Diagnosis = days_to_diag intervention.Positive_Diagnosis_Event = pos_event intervention.Treatment_Fraction = tx_fraction return intervention
[docs]def new_triggered_intervention( camp, start_day=1, triggers=[ "Births" ], coverage=1.0, node_ids=None, property_restrictions_list=[], co_event=None # expansion slot ): """ Distribute TyphoidCarrierDiagnostic when something happens as determined by a signal published from the model or another campaign event. """ iv = new_intervention( camp ) #event = common.ScheduledCampaignEvent( camp, Start_Day=start_day, Demographic_Coverage=coverage, Intervention_List=[ act_intervention, bcast_intervention ], Node_Ids=nodeIDs, Property_Restrictions=property_restrictions_list ) event = common.TriggeredCampaignEvent( camp, Start_Day=start_day, Triggers=triggers, Demographic_Coverage=coverage, Intervention_List=[ iv ], Node_Ids=node_ids, Property_Restrictions=property_restrictions_list, Event_Name="Triggered Typhoid Vax" ) return event
[docs]def new_scheduled_intervention( camp, start_day=1, coverage=1.0, node_ids=None, property_restrictions_list=[], co_event=None # expansion slot ): """ Distribute TyphoidCarrierDiagnostic when something happens as determined by a signal published from the model or another campaign event. """ iv = new_intervention( camp ) #event = common.ScheduledCampaignEvent( camp, Start_Day=start_day, Demographic_Coverage=coverage, Intervention_List=[ act_intervention, bcast_intervention ], Node_Ids=nodeIDs, Property_Restrictions=property_restrictions_list ) event = common.ScheduledCampaignEvent( camp, Start_Day=start_day, Demographic_Coverage=coverage, Intervention_List=[ iv ], Node_Ids=node_ids, Property_Restrictions=property_restrictions_list ) return event
[docs]def new_intervention_as_file( camp, start_day, filename=None ): import emod_api.campaign as camp camp.add( new_triggered_intervention( camp, start_day ), first=True ) if filename is None: filename = "TyphoidCarrierDiagnostic.json" camp.save( filename ) return filename