Conditions
Conditions control when an AUTO transition fires. A condition evaluates against an emission event and returns true or false. Only transitions whose condition evaluates to true are executed.
Structure
A condition is a tree of ConditionGroups and ConditionExpressions:
- A Condition contains one or more root-level ConditionGroups.
- A ConditionGroup combines its children (expressions and nested groups) using
ANDorORlogic. Groups can also filter which data points are included in the evaluation. - A ConditionExpression is a leaf node that compares a specific field on the event's data point against a value.
Condition
└── ConditionGroup (AND)
├── ConditionExpression (concentration > 100)
└── ConditionGroup (OR)
├── ConditionExpression (site_type == "compressor_station")
└── ConditionExpression (site_type == "tank_battery")For the condition to pass, all root-level groups must evaluate to true.
ConditionGroups
Each group has the following configuration:
| Field | Description |
|---|---|
operator | AND — all children must be true; OR — at least one child must be true |
data_providers | Optional. Restrict this group's evaluation to data points from specific providers. If set, expressions in this group are only evaluated for matching data points |
geo_area | Optional. Restrict this group's evaluation to events whose detection falls within a specific geographic area |
parent | Optional. If set, this group is a child of another group rather than a root group |
position | Integer controlling the display order of groups at the same level |
Data Provider Filtering
When a group has one or more data providers configured, its expressions are only evaluated for emissions detected by those providers. This allows you to write conditions like:
"If the emission is from Bridger AND concentration > 500, or from GHGSat AND concentration > 200"
Geographic Filtering
When a group has a geo_area configured, its expressions are only evaluated if the emission detection point falls within that geographic area. This allows regional rules within a single workflow.
ConditionExpressions
Each expression compares a field on the emission event to a value:
| Field | Description |
|---|---|
field_type | The category of field being compared: numeric, extra_data, or site_extra_data |
field_name | The specific field to compare |
operator | The comparison operator |
value | The comparison value |
value2 | Second value, required only for the between operator |
Field Types
| Type | Description |
|---|---|
numeric | Standard numeric fields on the DataPoint model (e.g., concentration, emission rate) |
extra_data | Custom key-value data stored in DataPoint.data (JSONB). Values are compared case-insensitively |
site_extra_data | Custom key-value data stored in Site.extra_data (JSONB). Values are compared case-insensitively |
Operators
| Operator | Symbol | Description |
|---|---|---|
lt | < | Less than |
lte | <= | Less than or equal |
gt | > | Greater than |
gte | >= | Greater than or equal |
eq | == | Equal |
neq | != | Not equal |
between | between | Value is between value and value2 (inclusive). Requires value2 |
Managing Conditions in Django Admin
To create or edit a condition:
- Open a Workflow Definition in Django Admin.
- In the transitions inline, click the Condition link next to the relevant transition. If no condition exists yet, click Add condition.
- You will be taken to the Condition edit form, which shows:
- A formatted summary of the current condition at the top
- Nested inlines for groups and expressions
- Add root-level ConditionGroups first, then add ConditionExpressions within each group.
- To nest groups, add a group with the
parentfield pointing to an existing group.
The condition editor caches available field names per company so that extra_data and site_extra_data field dropdowns are populated based on actual data in the platform.
Validation
When a condition is saved, the system validates that:
- At least one root-level group exists
- Every group has at least one expression, child group, data provider filter, or geo area filter
- The
value2field is populated when thebetweenoperator is used
If validation fails, an error message is shown and the condition is not saved.
Condition Summary Display
In the Condition admin, a formatted HTML summary of the full condition tree is shown at the top of the form. This gives a human-readable overview of all groups and expressions without needing to expand every inline.
Example output:
(concentration > 100.0)
AND
(site_type == "compressor_station" OR site_type == "tank_battery")