An easily changable Tax Calculator for the german tax code
The App by @mgoltzsche interprets the XML Pseudo Codes by BMF and generates a calculation in Javascript. I simply wrote something to input a CSV and get the values out into a Textarea. This can be used f.e. in the social sciences to create counterfactual models, especially beacuse this app can be run locally and doesn't require any remote connections.
@mgoltzshces project is published with an Apache 2.0 Lincense so the license must be maintained.
This Version isn't served anywhere I'm aware of. You will need to clone the repository and open the src/index.html file.
Big thanks to @JonnyTischbein for helping out big time on the CSV read hook :) !
Using the App
The order you input these files matters
-
Clone this repository from your terminal by running
git clone https://github.com/git-girl/bmf-taxcalculator-csv.git
. Optionally you can just download it as a zip file. For properly building the app see further below. -
Download and modify the pseudo-codes in XML from (BMF).
-
Create the Dataset in your statistics software of choice and export it to CSV.
- For some rough tips on operationalization based on popular datasets see the (Operationalization Wiki Entry) (currently only SOEP with STATA ).
-
Open your local repository and open the
dist/index.html
in your browser ( making sure to enable javascript ). -
Select your XML file
-
Select your CSV file
-
Wait a bit depending on the processing power of your machine.
-
Copy and paste the text from the Output field into a csv file.
-
for example: in your terminal run
cd ~/some/directory/path touch output.csv vim output.csv
-
then paste in the results (saving and exiting vim by :wq)
-
-
Your output CSV is ready to be imported into your statistics software
Tips for modiying the XML
-
The flowcharts by BMF are quite helpful in identifying the area that needs to be changed
-
Another option is to search through the XML by some specific numeric value, f.e. of a tax rate
-
The XML while human readable, is a bit overwhelming at times, just try focussing on the general structure, rather than trying to understand all the commands
Debugging
- When Inputting a different PAP-XML file, or modifying it it is not unlikely that it will throw some errors.
- Look in the XML file first, the Javascript written by @mgoltzsche is really nice.
- The Errors shown in the Red bordered window should help
- If not than you can make changes to the javascript by @mgoltzsche by making changes in the ./src folder then running, make publish.
- For example you can add a
console.log(some_variable)
to some line, runmake publish
, and check that the generatedindex_bundle.js
is specified in theindex.html
you are opening in the script tag - As some console logging can slow the app down you might need to comment out the testing from the
package.json
file as this will throw errors if some part takes more than 2 seconds
- For example you can add a
Build
- make requires podman or docker but worked best with podman for me
- add a new podman machine
- run it
- in directory of cloned repo add the podman ssh key to your ssh agent
(ssh-add ~/.ssh_ORYOURSSHFILEPATH/.podman-machine-default
- NOW run make