[docs]defDistributeIVByRefTrack(camp,Start_Day,Intervention,TVMap,node_ids=None,Event_Name="Scheduled_Campaign_Event",Property_Restrictions=None,Target_Age_Min=0,Target_Age_Max=125*365,Target_Gender="All",Update_Period=None,IV_Tracking_Name=None,Target_Disease_State=None):""" Wrapper function to create and return a ScheduledCampaignEvent intervention. The alternative to a ScheduledCampaignEvent is a TriggeredCampaignEvent. Args: camp: emod_api.campaign object with schema_path set. Start_Day: When to start. Intervention: Valid intervention to be distributed together as necessary to track coverage targets. Can be single intervention or list (list is useful where you want a co-event). If list, actual intervention should be first. Event_Name: Name for overall campaign event, of not functional meaning. node_ids: Nodes to target with this intervention, return from utils.do_nodes(). Property_Restrictions: Individual Properties a person must have to receive the intervention(s). Number_Repetitions: N/A Timesteps_Between_Repetitions: N/A Target_Demographic: Everyone, ExplicitAgeRanges, etc. Target_Age_Min: Minimum age (in years). Target_Age_Max: Maximum age (in years). Target_Gender: All, Male, or Female. Update_Period: Number representing how frequently the distributions are done. IV_Tracking_Name: Optional string parameter to distinguish one intervention from another if you're doing multiple campaigns with the same underlying intervention. Target_Disease_State: Optional string parameter to specify the disease state to target with this intervention. Default to None which means Everyone. Possible values are: "Everyone", "HIV_Positive", "HIV_Negative", "Tested_Positive", "Tested_Negative", "Not_Tested_Or_Tested_Negative". Returns: ReadOnlyDict: Schema-based smart dictionary representing a new ScheduledCampaignEvent intervention ready to be added to a campaign. """globalschema_pathschema_path=(camp.schema_pathifcampisnotNoneelseschema_path)event=s2c.get_class_with_defaults("CampaignEvent",schema_path)coordinator=s2c.get_class_with_defaults("ReferenceTrackingEventCoordinatorHIV",schema_path)# Second, hook them upevent.Event_Coordinator_Config=coordinatorevent.Start_Day=float(Start_Day)# Intervention can be single or list. If list, we bundle into a M.I.D.ifIV_Tracking_NameisnotNone:iftype(Intervention)islist:Intervention[0]["Intervention_Name"]=IV_Tracking_Nameelse:Intervention["Intervention_Name"]=IV_Tracking_Nameiftype(Intervention)islist:mid=comm.MultiInterventionDistributor(camp,Intervention)Intervention=midcoordinator.Intervention_Config=Interventionprs=utils._convert_prs(Property_Restrictions)iflen(prs)>0andtype(prs[0])isdict:coordinator.Property_Restrictions_Within_Node=prscoordinator.pop("Property_Restrictions")else:coordinator.Property_Restrictions=prscoordinator.pop("Property_Restrictions_Within_Node")ifTarget_Age_Min>0orTarget_Age_Max<125*365:coordinator.Target_Age_Min=Target_Age_Mincoordinator.Target_Age_Max=Target_Age_MaxifTarget_Gender!="All":coordinator.Target_Gender=Target_Gendercoordinator.Target_Demographic="ExplicitAgeRangesAndGender"hiv_utils.set_tvmap_lists_from_map(TVMap,coordinator.Time_Value_Map)ifUpdate_PeriodisnotNone:coordinator.Update_Period=Update_PeriodifTarget_Disease_StateisnotNone:coordinator.Target_Disease_State=Target_Disease_Stateevent.Nodeset_Config=utils.do_nodes(camp.schema_path,node_ids)hiv_utils.declutter(event)returnevent