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 engine
The API makes use of this concept in several locations. 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 is given back, along with messages raised, disclaimer and sources.
Core Elements of the JSON file (in folder jsonlib)
- The name of the file is defined in the respective module, but begins with the Country Code (2-Letter)
- The Json begins with a context depending on the scope of the settings included, any number of generic items can be listed.
- The actual
classtype of calculations is named and provides a collection of versions - Each version includes a collection of steps, that will be followed consecutively
- Each calculation scheme ends with a Disclaimer and Source tag, this must contain any limitations to the accuracy of the calculation and the source of the information included in the scheme.
Example for a file (not making a lot of sense)
{
"country":"Deutschland",
"comment1": "Order versions from recent to old, followed by Disclaimer",
"input":
{
},
"income":
{
"2021": [
...
],
"2020": [
{
"type":"absolute",
"from":"0",
"to":"1200",
"part":"1",
"id"label":"gez",
"base":"value",
"tax":"120"
},
{
"type":"percent",
"from":"0",
"to":"1200",
"id"label":"est",
"base":"base",
"tax":"12%"
},
{
"type":"percent",
"from":"0",
"to":"9999999999",
"id"label":"soli",
"base":"est",
"tax":"5%"
},
{
"rate":"100%"
}
],
"Disclaimer":"Dieser Text erklärt Besonderheiten",
"Source":"EStG, Dejure.org 31.7.2021"
}
}
}