event
BaseEvent
Base class for CampaignEvent and CampaignEventByYear. The "Events" array in the campaign.json file is a list of these objects. They define the "when" and "where" an intervention is to be distributed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinator
|
(BaseEventCoordinator, required)
|
|
required |
event_class_name
|
(str, required)
|
|
required |
event_name
|
str
|
|
required |
node_ids
|
Optional[List[int]]
|
|
None
|
Returns:
Source code in emodpy/campaign/event.py
__init__(coordinator, event_class_name, event_name, node_ids=None)
Initializes a base CampaignEvent object with the given parameters.
Source code in emodpy/campaign/event.py
to_schema_dict(campaign)
Return a CampaignEvent or CampaignEventByYear event with the specified parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
(campaign, required)
|
|
required |
Returns:
| Type | Description |
|---|---|
ReadOnlyDict
|
s2c.ReadOnlyDict: The CampaignEvent or CampaignEventByYear event. |
Source code in emodpy/campaign/event.py
CampaignEvent
Bases: BaseEvent
The CampaignEvent event class determines when to distribute the intervention based on the day of the simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinator
|
(BaseEventCoordinator, required)
|
|
required |
start_day
|
(float, required)
|
|
required |
event_name
|
str
|
|
None
|
node_ids
|
Optional[List[int]]
|
|
None
|
Source code in emodpy/campaign/event.py
__init__(coordinator, start_day, event_name=None, node_ids=None)
Initializes a CampaignEvent object with the given parameters.
Source code in emodpy/campaign/event.py
to_schema_dict(campaign)
Return a CampaignEvent event with the specified parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
(campaign, required)
|
|
required |
Returns:
| Type | Description |
|---|---|
ReadOnlyDict
|
s2c.ReadOnlyDict: The CampaignEvent or CampaignEventByYear event. |
Source code in emodpy/campaign/event.py
CampaignEventByYear
Bases: BaseEvent
The CampaignEventByYear event class determines when to distribute the intervention based on the calendar year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinator
|
(BaseEventCoordinator, required)
|
|
required |
start_year
|
(float, required)
|
|
required |
event_name
|
str
|
|
None
|
node_ids
|
Optional[List[int]]
|
|
None
|
Source code in emodpy/campaign/event.py
__init__(coordinator, start_year, event_name=None, node_ids=None)
Initializes a CampaignEventByYear object with the given parameters.
Source code in emodpy/campaign/event.py
is_year_supported(campaign)
Check if the year is supported by the campaign.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
(campaign, required)
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the year is supported, otherwise False. |
Source code in emodpy/campaign/event.py
to_schema_dict(campaign)
Return a CampaignEventByYear event with the specified parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
(campaign, required)
|
|
required |
Returns:
| Type | Description |
|---|---|
ReadOnlyDict
|
s2c.ReadOnlyDict: The CampaignEvent or CampaignEventByYear event. |
Source code in emodpy/campaign/event.py
create_campaign_event(campaign, coordinator, event_name=None, node_ids=None, start_day=None, start_year=None)
Create a CampaignEvent or CampaignEventByYear event with the specified parameters and return it.