campaign
You use this simple campaign builder by importing it, adding valid events via "add", and writing it out with "save".
add(event, name=None, first=False)
Add a complete campaign event to the campaign builder. The new event is assumed to be a Python dict, and a valid event. The new event is not validated here. Set the first flag to True if this is the first event in a campaign because it functions as an accumulator and in some situations like sweeps it might have been used recently.
Source code in emod_api/campaign.py
get_event(event, old=False)
Basic placeholder functionality for now. This will map new ad-hoc events to GP_EVENTs and manage that 'cache' If event in built-ins, return event, else if in adhoc map, return mapped event, else add to adhoc_map and return mapped event.
Source code in emod_api/campaign.py
get_recv_trigger(trigger, old=use_old_adhoc_handling)
Get the correct representation of a trigger (also called signal or even event) that is being listened to.
Source code in emod_api/campaign.py
get_send_trigger(trigger, old=use_old_adhoc_handling)
Get the correct representation of a trigger (also called signal or even event) that is being broadcast.
save(filename='campaign.json')
Save 'campaign_dict' as file named 'filename'.
Source code in emod_api/campaign.py
set_schema(schema_path_in)
Set the (path to) the schema file. And reset all campaign variables. This is essentially a "start_building_campaign" function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema_path_in
|
str
|
The path to a schema.json file |
required |
Returns: