Trigger

Contents:

Introduction

Synopsis

Trigger: a Boolean expression which causes interventions.

In EpiHiper trigger are a core building block of Interventions. They are used to determine the time point when an intervention is performed.

Definition

Synopsis

Definition: Syntax for the definition of trigger

:                trigger interventionIds [annotation]
trigger:         boolean
interventionIds: list(id)
Table 15 Trigger definition.
Name
Type
Description
trigger
object
interventionIds
list(id)
A list of ids referencing Interventions to be performed.
ann:*
Optional annotation of the trigger.

Boolean Expression

Synopsis

Boolean expression: specification.

EpiHiper allows for the definition of complex Boolean expressions utilizing the current state of the simulation.

:              (not)
             | (and | or)
             | (value)
             | (operator left right)
not:         Boolean Expression
and:         list(Boolean Expression)
or:          list(Boolean Expression)
value:       true | false
operator:      (== | != | <= | < | >= | >)
             | (in | not in)
left:        (value | variable | observable | node | edge | sizeof)
right:         (value | variable | observable | node | edge | sizeof)
             | valueList
value:       (boolean | number | id | healthState | trait feature enum)
variable:    idRef
node:        property
property:    id | susceptibilityFactor | infectivityFactor | healthState | nodeTrait feature
edge:        property
property:      targetId | sourceId | locationId | duration | weight | active
             | (targetActivity | sourceActivity | edgeTrait) feature
sizeof:      set content
valueList:   (boolean | number | id | healthState | trait feature enum)
Table 16 Trigger boolean definition.
Name
Type
Description
not
object
and | or
list
An operation (and|or) applied to a list of Boolean Expression.
value
boolean
A boolean value: true | false
operator
string
The operator used for comparing left and right:
== | != | <= | < | >= | > | in | not in
left
object
The left operant of the comparison
right
object
The right operant of the comparison. Depending on the operator
this must be either a value or a valueList.
value
object
valueList
object
node
object
edge
object
sizeof
object
Function to determine the size of the given set content.

The normative JSON schema can be found at: boolean

Examples

Schedule an antigen test on the first and third weekday starting at day 30 day of the simulation.

"triggers": [
  {
    "ann:id": "t_antigen_test",
    "trigger": {
      "and": [
        {
          "left": {
            "observable": "time"
          },
          "operator": ">=",
          "right": {
            "value": {
              "number": 30
            }
          }
        },
        {
          "left": {
            "variable": {
              "idRef": "week_day"
            }
          },
          "operator": ">=",
          "right": {
            "value": {
              "number": 1
            }
          }
        },
        {
          "left": {
            "variable": {
              "idRef": "week_day"
            }
          },
          "operator": "<=",
          "right": {
            "value": {
              "number": 3
            }
          }
        }
      ]
    },
    "interventionIds": [
      "antigen_test"
    ]
  }
]