Skip to main content

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),


Core Elements of the JSON file (in folder jsonlib)

  1. The name of the file is defined in the respective module, but begins with the Country Code (2-Letter)
  2. The Json begins with a context depending on the scope of the settings included, any number of generic items can be listed.
  3. The actual class of calculations is named and provides a collection of versions
  4. Each version includes a collection of steps, that will be followed consecutively
  5. 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 sense)

{
  "country":"Deutschland",
  "comment1": "Order versions from recent to old, followed by Disclaimer",
  "income":
  	{	
		"2021": [
					...
				],
		"2020": [
					{
						"type":"absolute",
						"from":"0",
						"to":"1200",
                        "part":"1",
						"id":"gez",
						"base":"value",
						"tax":"120"
					},
					{
						"type":"percent",
						"from":"0",
						"to":"1200",
						"id":"est",
						"base":"base",
						"tax":"12%"
					},
					{
						"type":"percent",
						"from":"0",
						"to":"9999999999",
						"id":"soli",
						"base":"est",
						"tax":"5%"
					},
					{
						"rate":"100%"
					}
				],
		"Disclaimer":"Dieser Text erklärt Besonderheiten",
        "Source":"EStG, Dejure.org 31.7.2021"
		}
    }
 }