# JSON-Calculation Scheme This concept is used in a number of calculation formats in the Fortune-Teller API. Generally speaking, a JSON-File, that is committed in the GIT project contains a calculation structure, that is to be applied on a base value. The structure provided in the JSON-File provides the raw-data for the calculation scheme, so that it is highly adjustable, without impacting the APIs code. --- **API calculation engine** The scheme calculator is called with Localization (i.e. DE), with the calculation type, a base value and a number of variables. The input items are checked, the versions are identified and errors / alternatives raised if not available. As a result the calculation is performed and a number of labelled items and the values are given back, along with messages raised, disclaimer and sources.
**Step Elements** | Possible Values | Example |
type | Absolute *if range is met, this value or the referenced labelvalue is added* Percent *a percentage is applied on an amount in the range* StepPercent *a percentage is applied for each part of the range that is below the base value* Add *if range is met, the label value is added* Multiply *if range is met, the label value is added* | |
base | label id *any label available as input or in the calculation* | |
from, to | Decimal value *lower and upper range of applicable base value. Range includes these values.* | |
part | Decimal value of 1 or below *applied on the range of the base amount (only percent or absolute amount) | |
label | label id *result is cumulatively saved under this label* | |
var | Decimal value *i.e. an amount or a decimal below 1 for a rate to be applied.* | |
labelvar | label id *any label available as input or in the calculation* |