Linux Income Tax Calculator
I promise not to general post very often on Linux but it seems that Linux users love of software freedom carries across to medical freedom and it is surprising how many Linux users are subscribed to this substack. Maintaining our software freedom is also critical to staying free as a society. Non-Linux users please feel free to stop reading here.
Last I knew there was no Canadian Tax Software for Linux. For tax nerds out there who have to submit trust returns, the CRA does supply the XML specs you need to submit 0 dollar trust returns from any platform including Linux. I have successfully submitted a number of years of 0 dollar trust returns from Linux. However the CRA does not supply the specs to submit personal tax returns electronically from Linux. I can’t imagine there is actually any real technical obstacle to prevent the CRA from providing the XML specs for personal returns. I suspect the lack of specs is political due to the paid software tax package industry the CRA has fostered.
I refuse to use online tax software because of privacy, reuse and because I don’t think I should have to pay a third party to submit taxes to the government. By having the return on my hard drive, I can reuse it to calculate tax adjustments, estimate taxes for future years and perform various multi year calculations mostly related to capital gains. So I continue to calculate my own taxes and submit them on paper.
I only use a small subset of the forms so the calculations are not that difficult. The challenge is to avoid errors, to accommodate recalculation, to accommodate reuse and to self document. I have used a number of approaches over the years starting with spreadsheets, then XSLT transformations and finally an AWK based “text spreadsheet”.
A “text spreadsheet” is what you get when you make a text file into a “spreadsheet”, something that probably only Linux users could appreciate! The general process is to
download the CRA forms that you need for your return. I download the pdf version and convert them to text, but you could also try the etext forms for screen readers which are already in text format - except the CRA hasn’t reliably maintained those forms in the past
complete the forms similarly to completing them by hand, except you add a little bit of bc calculator markup to automate your calculations.
run the forms through an AWK script (could be written in any language) which generates bc calculator statements
order the calculations with tsort (topological sort) to handle the dependencies
perform the calculations in bc
insert the results back into a text file. I happened to use AWK for this step too.
steps 3 to 6 are automated into a single bash script
Voilà a “text spreadsheet” that is well suited (in my opinion) to any forms with multi-step calculations. The main benefit vs a standard spreadsheet is better self documentation because the calculations are all embedded in the text representation of the tax form. Errors are still possible, but at least all the formulae are visible on the tax form. Most of the hard lifting is done by tsort and bc so the AWK scripts are actually quite short and therefore should be less prone to error. Currently 153 lines in 2 scripts for step 3 and 46 lines for step 6.
Warning: this is an alpha level project. You must be fully comfortable with the Linux command line. Documentation is idiosyncratic. I had some trouble reading my own documentation from last year. Debugging markup errors could be easier. There are no examples. But once you get it going, I have found it works just fine. I find it quick to fill out the forms. This is so bare bones that I would expect it to run on any distribution and just about any hardware. Glad to share. If anyone else wants to try it please let me know at gknittl@sympatico.ca.