Variable Types
Contents
Variable Types#
This guide is for implementers who need to understand the different source types available for variables.
Source Types Overview#
Source Type |
Data Origin |
Use Case |
|---|---|---|
Model Field |
Odoo model field |
Map existing fields to variables |
Computed (CEL) |
CEL expression |
Calculate derived values |
Member Aggregate |
Household members |
Count, sum, average over members |
Constant/Parameter |
Fixed value |
Thresholds, configuration values |
External Source |
External API |
Credit scores, external data |
Vocabulary Concept |
Concept group |
Boolean from vocabulary membership |
Scoring Result |
PMT/scoring |
Proxy means test scores |
Model Field Variables#
Reference an existing field on an Odoo model.
When to Use#
Map a custom field to a simpler variable name
Abstract field names from business logic
Enable field renaming without breaking expressions
Configuration#
Field |
Value |
Notes |
|---|---|---|
Source Type |
Model Field |
|
Source Model |
|
The Odoo model name |
Source Field |
|
The field name on the model |
Example: Map Income Field#
Setting |
Value |
|---|---|
Name |
|
Source Type |
Model Field |
Source Model |
|
Source Field |
|
Value Type |
Money |

CEL Usage: income > 5000
Field Status Indicator#
The system shows whether the source field exists:
Status |
Meaning |
|---|---|
Field Exists |
Field found on model |
Field Missing |
Field not found (check spelling) |
Unknown |
Status not yet checked |
Not Applicable |
Not a field-based variable |
Computed (CEL) Variables#
Calculate values using CEL expressions.
When to Use#
Derive values from other variables or fields
Perform calculations (age from birthdate)
Create conditional logic
Configuration#
Field |
Value |
Notes |
|---|---|---|
Source Type |
Computed (CEL) |
|
CEL Expression |
|
The computation expression |
Example: Calculate Age#
Setting |
Value |
|---|---|
Name |
|
Source Type |
Computed (CEL) |
CEL Expression |
|
Value Type |
Number |
Unit |
years |

CEL Usage: age >= 18 && age <= 65
Example: Dependency Ratio#
Setting |
Value |
|---|---|
Name |
|
Source Type |
Computed (CEL) |
CEL Expression |
|
Value Type |
Number |
Expression Guidelines#
Reference other variables by name:
income,hh_sizeUse built-in functions:
age_years(),size(),sum()Avoid circular references (A depends on B, B depends on A)
Member Aggregate Variables#
Compute values over household members, enrollments, entitlements, or events.
When to Use#
Count members meeting criteria
Sum values across members
Check if any member matches condition
Configuration#
Field |
Value |
Notes |
|---|---|---|
Source Type |
Member Aggregate |
|
Aggregate Type |
Count / Sum / Avg / Min / Max / Exists |
|
Aggregate Target |
Household Members |
What to aggregate over |
Aggregate Filter |
|
Filter expression |
Aggregate Field |
|
For sum/avg/min/max only |
Aggregate Types#
Type |
Returns |
Use For |
|---|---|---|
Count |
Number |
How many members match |
Sum |
Number |
Total of a field across members |
Average |
Number |
Mean of a field across members |
Minimum |
Number |
Smallest value |
Maximum |
Number |
Largest value |
Exists |
Yes/No |
True if any member matches |

Aggregate Targets#
Target |
Aggregates Over |
|---|---|
Household Members |
Members of the household |
Program Enrollments |
Program membership records |
Entitlements |
Entitlement records |
Events |
Event data records |
Example: Count Children#
Setting |
Value |
|---|---|
Name |
|
Aggregate Type |
Count |
Aggregate Target |
Household Members |
Aggregate Filter |
|
Value Type |
Number |
Example: Total Member Income#
Setting |
Value |
|---|---|
Name |
|
Aggregate Type |
Sum |
Aggregate Target |
Household Members |
Aggregate Field |
|
Value Type |
Money |
Example: Has Elderly Member#
Setting |
Value |
|---|---|
Name |
|
Aggregate Type |
Exists |
Aggregate Target |
Household Members |
Aggregate Filter |
|
Value Type |
Yes/No |
Filter Expression Syntax#
Use m. prefix for member fields:
# Age-based filters
age_years(m.birthdate) < 5 # Under 5
age_years(m.birthdate) >= 65 # 65 and older
# Field comparisons
m.gender == "female" # Female members
m.is_disabled == true # Disabled members
# Combined conditions
age_years(m.birthdate) < 18 && m.is_enrolled_in_school == true
Event Aggregate Variables#
Aggregate over event data with time filtering.
Configuration#
Field |
Value |
Notes |
|---|---|---|
Source Type |
Member Aggregate |
|
Aggregate Target |
Events |
|
Event Type |
(select event type) |
Which event type |
Time Range |
This Year |
Temporal filter |
Event Field |
|
For sum/avg (JSON field in event) |
Time Range Options#
Option |
Description |
|---|---|
All Time |
All events |
This Year |
Current calendar year |
This Quarter |
Current quarter |
This Month |
Current month |
Within N Days |
Last N days (specify N) |
Within N Months |
Last N months (specify N) |
Example: Health Visits This Year#
Setting |
Value |
|---|---|
Name |
|
Aggregate Type |
Count |
Aggregate Target |
Events |
Event Type |
Health Visit |
Time Range |
This Year |
Value Type |
Number |
Example: Total Training Hours#
Setting |
Value |
|---|---|
Name |
|
Aggregate Type |
Sum |
Aggregate Target |
Events |
Event Type |
Training Session |
Time Range |
All Time |
Event Field |
|
Value Type |
Number |
Constant/Parameter Variables#
Fixed values that can optionally be overridden per program.
When to Use#
Define thresholds (poverty line, age limits)
Configuration values shared across expressions
Values that programs can customize
Configuration#
Field |
Value |
Notes |
|---|---|---|
Source Type |
Constant/Parameter |
|
Default Value |
|
The base value |
Program Configurable |
Yes/No |
Allow program overrides |
Example: Poverty Line#
Setting |
Value |
|---|---|
Name |
|
Source Type |
Constant/Parameter |
Default Value |
|
Program Configurable |
Yes |
Value Type |
Money |
Unit |
USD |

CEL Usage: income < poverty_line
Program Override#
When Program Configurable is enabled:
Each program can set its own value
If not set, the default value is used
Allows same logic with different thresholds
Vocabulary Concept Variables#
Check membership in a vocabulary concept group.
When to Use#
Boolean based on vocabulary code membership
Check if value belongs to a concept group
Abstract vocabulary logic
Configuration#
Field |
Value |
Notes |
|---|---|---|
Source Type |
Vocabulary Concept |
|
Source Concept Group |
(select concept group) |
The concept to check |
Example: Is Female#
Setting |
Value |
|---|---|
Name |
|
Source Type |
Vocabulary Concept |
Source Concept Group |
Feminine Gender |
Value Type |
Yes/No |
CEL Usage: is_female == true
External Source Variables#
Fetch data from external providers.
When to Use#
Credit scores from external bureau
Data from government databases
Third-party verification services
Configuration#
Field |
Value |
Notes |
|---|---|---|
Source Type |
External Source |
|
External Provider |
(select provider) |
Pre-configured data provider |
Note
External providers must be configured separately in Settings → Data Providers.
Caching Recommendation#
External sources should use caching to:
Reduce API calls
Handle rate limits
Improve performance
Setting |
Recommended |
|---|---|
Cache Strategy |
TTL-based |
Cache TTL |
3600+ seconds |
Scoring Result Variables#
Output from PMT (Proxy Means Test) or scoring calculations.
When to Use#
PMT scores for targeting
Composite vulnerability indices
Weighted scoring results
Configuration#
Scoring variables are typically created by the scoring module automatically.
Are You Stuck?#
Which source type should I use?
If you need... |
Use |
|---|---|
Existing field value |
Model Field |
Calculated value |
Computed (CEL) |
Count/sum over members |
Member Aggregate |
Fixed threshold |
Constant/Parameter |
External lookup |
External Source |
Aggregate filter not matching?
Use
m.prefix for member fieldsCheck field exists on member model
Verify filter syntax in CEL builder first
Computed expression causing errors?
Avoid circular references
Check referenced variables exist and are active
Test expression in CEL builder
Next Steps#
To... |
See... |
|---|---|
Create a new variable |
|
Use variables in expressions |
|
Understand caching |
openspp.org