distributor
add_broadcast_coordinator_event(campaign, broadcast_event, start_day, coordinator_name='BroadcastCoordinatorEvent', cost_to_consumer=0, event_name=None, node_ids=None)
Add a coordinator-level event broadcast to the campaign. This creates a BroadcastCoordinatorEvent coordinator that broadcasts a single coordinator event when the campaign event fires. It does not distribute interventions.
This is useful for triggering coordinator-level event chains. For example, it can broadcast the start trigger for a SurveillanceEventCoordinator or a VectorSurveillanceEventCoordinator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
(campaign, required)
|
|
required |
broadcast_event
|
(str, required)
|
|
required |
start_day
|
(float, required)
|
|
required |
coordinator_name
|
str
|
|
'BroadcastCoordinatorEvent'
|
cost_to_consumer
|
float
|
|
0
|
event_name
|
str
|
|
None
|
node_ids
|
Optional[List[int]]
|
|
None
|
Returns:
| Type | Description |
|---|---|
None
|
None, adds the configuration to the campaign. |
Example
from emodpy_malaria.campaign.distributor import add_broadcast_coordinator_event from emod_api import campaign as api_campaign my_campaign = api_campaign my_campaign.set_schema('path_to_schema.json') add_broadcast_coordinator_event( ... campaign=my_campaign, ... broadcast_event="StartSurveillance", ... start_day=1, ... coordinator_name="TriggerSurveillance" ... )
Source code in emodpy_malaria/campaign/distributor.py
add_vector_surveillance(campaign, counter, start_trigger_condition_list, start_day, survey_completed_event=None, duration=None, stop_trigger_condition_list=None, coordinator_name=None, event_name=None, node_ids=None)
Add a vector surveillance event to the campaign. The coordinator periodically samples vectors and computes statistics (allele frequencies or genome fractions). It does not distribute interventions. Instead, response logic is delegated to an embedded Python script, dtk_vector_surveillance.py, which must be placed in the simulation working directory.
Sampling is controlled by coordinator-level trigger events: the coordinator begins
periodic sampling when an event from start_trigger_condition_list is received,
and stops when an event from stop_trigger_condition_list is received or
duration expires.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
(campaign, required)
|
|
required |
counter
|
(VectorCounter, required)
|
|
required |
start_trigger_condition_list
|
(list[str], required)
|
|
required |
start_day
|
(float, required)
|
|
required |
survey_completed_event
|
str
|
|
None
|
duration
|
float
|
|
None
|
stop_trigger_condition_list
|
list[str]
|
|
None
|
coordinator_name
|
str
|
|
None
|
event_name
|
str
|
|
None
|
node_ids
|
Optional[List[int]]
|
|
None
|
Returns:
| Type | Description |
|---|---|
None
|
None, adds the configuration to the campaign. |
.. important::
The ``respond()`` function in **dtk_vector_surveillance.py** can return
coordinator-level event names at runtime. These events are determined
dynamically and **cannot** be auto-detected from the script. You must
manually register any event names that ``respond()`` might return in
**Custom_Coordinator_Events** in the simulation configuration. Failing
to register them will cause the simulation to fail at runtime.
Example
from emodpy_malaria.campaign.distributor import add_vector_surveillance from emodpy_malaria.campaign.event_coordinator import VectorCounter from emodpy_malaria.utils.distributions import ConstantDistribution from emod_api import campaign as api_campaign my_campaign = api_campaign my_campaign.set_schema('path_to_schema.json') counter = VectorCounter(species="gambiae", ... sample_size_distribution=ConstantDistribution(100)) add_vector_surveillance( ... campaign=my_campaign, ... counter=counter, ... start_trigger_condition_list=["StartSurveillance"], ... start_day=1, ... survey_completed_event="SurveyComplete", ... duration=365, ... coordinator_name="MySurveillance" ... )
Source code in emodpy_malaria/campaign/distributor.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |