The Open Source Policy Center maintains a Python package (“Tax Calculator”) that uses Numba to model the federal income tax code for policy analysis. In this talk, we describe the construction of TaxBrain, a web app deployed on Heroku that allows non-programmers to use this package. We discuss the particulars of handling computationally intensive workloads with compiled code on a cloud platform.
The Open-Source Policy Center (OSPC) seeks to make policy analysis more transparent, trustworthy, and collaborative by harnessing open-source methods to build cutting-edge economic models. Our first package for release is the Tax Calculator. This Python package encodes current federal tax law and can be used to assess how policy reforms will affect government revenue and the distribution of the tax burden across income groups. In order to make this resource available to a large audience, we have created TaxBrain, a web application that allows users to specify Tax Calculator computations through a browser. The results are displayed in the browser as a number of tables, downloadable as CSV files. In this talk, we discuss the architecture of this web app, and its deployment on the Heroku platform. Tax Brain is a unique combination of web-enabled and traditional “scientific stack” Python code. We discuss our lessons learned, and give advice for those who wish to deploy numerical calculation codes in web-accessible environments.