Observed since 20 Oct, 17:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Shared formula evaluator library for FastAPI apps. Synchronously evaluates string-template formulas with field-type-aware substitution and pluggable function registry.
A shared formula evaluator library for FastAPI applications that synchronously evaluates string-template formulas with field-type-aware substitution.
counters collection for atomic countersMissingFieldError and FormulaEvaluationErrorpip install abs-formula-core
or with Poetry:
poetry add abs-formula-core
from motor.motor_asyncio import AsyncIOMotorDatabase
from abs_formula_core import FormulaEvaluatorService, MissingFieldError
evaluator = FormulaEvaluatorService(db=cosmos_db)
formula = [
"MULTIPLY(IF(",
{"is_field": True, "field": "<dropdown_field_id>"},
" == \"Yes\", MULTIPLY(",
{"is_field": True, "field": "<number_field_id>"},
", 6), 24))",
]
try:
value = await evaluator.evaluate(formula, record, entity_id="<entity_id>")
except MissingFieldError as e:
# Field referenced by formula has no value on the record
print(e.field_id)
List[Union[
str, # literal expression fragment
{"is_field": True, "field": "<field_id>", # record field reference
"reference_field": "<inner_field_id>"?}, # optional association follow
]]
Strings are concatenated verbatim into the expression. Field-reference dicts are resolved against the record:
reference_field is set:
the referenced record is loaded and its inner field value substituted.datetime objects for date-function compatibility.56 functions across categories: Conditional (IF, SWITCH), Math (SUM, COUNT, AVG, MIN, MAX, ROUND, ABS, DIVIDE, MULTIPLY, MINUS, MOD, POWER, SQRT, LOG), Logical (AND, OR, NOT, XOR, EXACT), String (CONCATENATE, UPPER, LOWER, LEN, LEFT, RIGHT, MID, TRIM, REPLACE, REPT, SEARCH, SUBSTITUTE, TEXT, IN, STR, VALUE), Array (APPEND, EXTEND, REMOVE), Date/Time (TODAY, NOW, DATE, DATEVALUE, DATEADD, DATEDIFF, ADD_DAYS, SUBTRACT_DAYS, WORKDAY, WORKDAYS, DAYS, MONTH, YEAR, DAY, HOUR, MINUTE, SECOND, HOURS_DIFF, MINUTES_DIFF, ADD_MINUTES, SUBTRACT_MINUTES, FORMAT_DATE, IOSWEEKNUM, WEEKNUM), Constants (PI, TRUE, FALSE).
Plus SEQUENCE() preprocessing via the counters Mongo collection.
MissingFieldError(field_id) — raised when a record field referenced
by the formula has no value. Callers should surface a 422 with the
field id.FormulaEvaluationError(message, expression?) — raised when a formula
fails to evaluate for non-missing-field reasons (malformed expression,
division by zero, simpleeval rejection).Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.1 | 13 May 2026 | 4 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 17:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:598cc73505e23555e1fb13940f733647786692bf493c41587de1f7fa1ad5bed6