Skip to main content

Calculations

Calculations are used to dynamically calculate the value of a question based on the values of other questions.

The extensions that fall under this category are:

Variable

Used to define a variable that is available for use in expressions within the same item and any descendant items. This allows it to be consumed by calculatedExpressions when the renderer executes a calculation.

For more information, refer to http://hl7.org/fhir/uv/sdc/expressions.html#variable.

For usages, refer to the CalculatedExpression section on this page.

CalculatedExpression

The basis of calculations in SDC. Allows an item value to update continuously as the answers to dependent questions change. In Smart Forms, calculated expressions are driven by FHIRPath.

Not all components support calculated expressions. The following components support calculated expressions:

ComponentsLimitations
boolean-
decimal-
integer-
string-
text-
choiceOnly supports the following itemControls:
- radio-button
- drop-down

Basic usage

Basic usage examples are covered in the respective components:

BMI Calculation usage

Absolute Cardiovascular Risk Calculation usage

Cqf-expression

While calculated expressions are used to update the value of a question dynamically, cqf-expression is used to update the elements/controls within the Questionnaire resource itself during render runtime.

At the moment, the only supported element/control is text.

Text usage