Source code for PolicyBrain, ospc.org, and related assets.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.profile.d initial commit Jul 21, 2015
distributed Make sure in correct current working directory Aug 24, 2018
docs PEP8 fixes Jul 9, 2018
fixtures initial commit Jul 21, 2015
static Improve and add comments to CSV caption functionality Jun 14, 2018
staticfiles Use whitenoise to serve staticfiles Jun 4, 2018
templates Small fixes to results page Aug 22, 2018
webapp Update migrations files Aug 22, 2018
.buildpacks initial commit Jul 21, 2015
.condarc No longer use binstar endpoint. Jun 27, 2017
.gitignore Fix some of the issues per @hdoupe's review comments Jun 15, 2018
.travis.yml Restore .travis.yml to default settings Aug 22, 2018
DATABASE.md Fix section formatting for DATABASE.md Mar 22, 2018
DOCKER.md Update DOCKER.md to reflect changes in build interface Jul 2, 2018
Dockerfile Re-configure newrelic Jun 4, 2018
LICENSE initial commit Jul 21, 2015
Makefile Add makefile command for local docker install Aug 23, 2018
PARAMETERS.md Fix typo in 'Tax-Caclulator' Jun 15, 2018
Procfile restrict request body size to 2MB Oct 5, 2016
README.md Remove extraneous step Jun 14, 2018
RELEASES.md Set release date Jul 2, 2018
RELEASE_PROCESS.md fix number types Jul 28, 2017
bower.json Added media logos and links May 18, 2016
conda-requirements.txt update bokeh version Jun 13, 2018
copy_static.py More PEP8 fixes Jul 16, 2018
environment.yml Update to tax-calculator 0.20.1 May 22, 2018
flatblocks.json Put 'get-started' tag directly on Get Started text Apr 13, 2016
flatblocks_heroku.json Navbar updated, gettingstarted page created, youtube videos added Oct 11, 2017
gulpfile.js Fixed Taxbrain Formatting Mar 9, 2016
manage.py initial commit Jul 21, 2015
package.json Update readme, package.json. Jan 3, 2017
post_reform.py Remove unused variables and imports Jul 5, 2018
pytest.ini initial commit Jul 21, 2015
python_env_build.sh Perhaps conda likes yml files more than one-liners Mar 23, 2018
requirements.txt Move tags to data classes Aug 2, 2018
requirements_dev.txt add missing pytest-django dev requirement Aug 15, 2016
sendfile.py More PEP8 fixes Jul 16, 2018
webapp_env.sh Go back to 5050 port for flask app Mar 13, 2018

README.md

About PolicyBrain

PolicyBrain provides a platform for open-source policy simulation models. It serves as an interface to powerful models for those who do not want to work directly with the models themselves. PolicyBrain’s primary jobs are to send the user-input to the models, provide feedback if the user-input causes warnings or errors, schedule jobs on available machines, retrieve the results from the models, and deliver the results to the user. Essentially, PolicyBrain provides the infrastructure and resources for the models that it hosts.

The apps that are currently hosted are TaxBrain and Cost-of-Capital Calculator. TaxBrain enables the user to perform static and dynamic analyses on their specified personal income tax reform. Cost-of-Capital Calculator enables the user to perform a static analysis on their specified business tax reform.

PolicyBrain is a Django app which is deployed on Heroku and uses Flask, Celery, and Redis to schedule jobs.

Release Process

To review the steps for the release process, see RELEASE_PROCESS.md

Local Deployment Setup

First, if you plan on contributing to PolicyBrain, then fork PolicyBrain and work off of that fork. If you do not plan to contribute, then you can clone the main repo.

Make sure that Anaconda/Miniconda is installed. Make sure that the local Postgres Server is running. Then, open a terminal window and run the following commands using bash:

# swap out YOURUSERNAME with OpenSourcePolicyCenter if you did not fork this project and
# your user name if you did
git clone https://github.com/YOURUSERNAME/PolicyBrain.git
cd PolicyBrain
git remote add upstream https://github.com/OpenSourcePolicyCenter/PolicyBrain
./python_env_build.sh
export DATABASE_USER=YOUR_POSTGRES_USERNAME DATABASE_PW=YOUR_POSTGRES_PASSWORD
source activate pb_env && source webapp_env.sh
python manage.py collectstatic
python manage.py migrate
python manage.py runserver

Now, the Django app should be up and running. You can access the local instance of https://www.ospc.org/ at http://localhost:8000. Next, set up Redis, Flask, and Celery. This step allows you to submit and run jobs. These services are configured via Docker in a docker-compose file. You need access to these images for the following commands to work. See DOCKER.md for more information.

# Login to docker with `docker login`
# Go to the PolicyBrain/distributed directory
cd PolicyBrain/distributed
docker-compose up -d

Now, that the server has been installed, you can start it up simply by running:

export DATABASE_USER=YOUR_POSTGRES_USERNAME DATABASE_PW=YOUR_POSTGRES_PASSWORD
source activate pb_env && source webapp_env.sh
python manage.py runserver

and in another terminal window, run:

docker-compose up -d