Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Django 1.9 and store parameters as JSON object #822

Merged
merged 118 commits into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
945ec65
upgrade to Django 1.9
Feb 5, 2018
69f5190
Update settings.py
Feb 5, 2018
39e4c55
Get rid of unused csv django plugin
Feb 5, 2018
a1c9b89
Update jsonfield and uuid field for 1.9
Feb 5, 2018
47003df
temp fix to print stack trace on warnings
Feb 5, 2018
9e7088c
Pull in changes from 814
Feb 5, 2018
8de8922
Alter uuidfield args so we don't have to run new migrations
Feb 5, 2018
952ae99
Use JSONField type from postgres 9.4
Feb 5, 2018
82e3d63
Restore init migration uuid default to None and save btax result as t…
Feb 5, 2018
bfdd439
Restore default to None in init and add new default as migration for …
Feb 5, 2018
26f5562
Fix to_python call
Feb 5, 2018
2f6e28b
context_processors moved from core to template
Feb 5, 2018
6524e8c
Update url patterns and template settings
Feb 5, 2018
365b447
question on static setting
Feb 5, 2018
d261f60
quick hack for taxbrain-static forms
Feb 6, 2018
f9c0e92
clean up old dubugging print statement
Feb 6, 2018
0c6ccb4
Use request.POST for taxbrain/views.py
Feb 6, 2018
d647e32
Use postgresql for tests
Feb 6, 2018
1054035
add postgres add on for travis
Feb 6, 2018
9aa97cb
Remove print statement for debugging
Feb 6, 2018
fc03666
Refactor for request.POST/GET and remove quick hack from forms.py
Feb 6, 2018
557626e
Use lowercase environ
Feb 6, 2018
60217e5
Merge remote-tracking branch 'upstream/master' into update_django19
Feb 7, 2018
80d715a
Remove jsonfield imports and replace with model.TextField
Feb 7, 2018
771e428
Clean up travis script
Feb 7, 2018
d746aa3
Create db before script
Feb 7, 2018
7495ba9
Try adding test database name
Feb 7, 2018
cef5796
Maybe we need a username
Feb 7, 2018
cdb45e8
Refactor database initiation
Feb 8, 2018
16b7524
Automate local dev database creation
Feb 8, 2018
9f65b08
Further database credential tweaking
Feb 8, 2018
9558d11
Rename forms class and remove unused code
Feb 8, 2018
77e5c3d
Remove unused taxbrain form import
Feb 9, 2018
1cfd34f
Phase in use of JSON object instead of individual fields
Feb 9, 2018
b4492bc
Add raw_fields and fields
Feb 9, 2018
a22b1a6
Change form to TaxBrainForm
Feb 9, 2018
4697e20
Use TaxBrain form in views too
Feb 9, 2018
8ac6520
Add method stubs for parameter formatting refactoring
Feb 9, 2018
af07def
Catch case where value is boolean
Feb 9, 2018
eff36a5
Move param formatting functions into paam_formatters.py
Feb 9, 2018
a4acfac
import json package
Feb 12, 2018
56fc84e
Temporarily add 'raw_fields' to ignored fields to make sure gui tests…
Feb 12, 2018
062e581
Touch-up logic around forms.add_error for < operator
Feb 12, 2018
d546678
further model test refactoring
Feb 12, 2018
8ad9d0f
Move GUI input processing to models.py; restores prior GUI input pars…
Feb 12, 2018
7c1a622
Use safer key popping for get_taxbrain_model test util fn
Feb 12, 2018
3a9e70a
Re-order param_formatters fns in more intuitive way
Feb 12, 2018
19b8556
Refactor switch_fixup call
Feb 12, 2018
270a061
Drop reform argument and temporarily comment out benefit switch fixup…
Feb 12, 2018
bf8db97
Change return value of get_default_policy_param fn to named tuple wit…
Feb 12, 2018
260dc45
Implement parameter processing logic to match taxcalc reqs, see #795,…
Feb 13, 2018
28af549
Include test for negative value parameter
Feb 13, 2018
505d5dc
Clean up helpers.py
Feb 13, 2018
d9fa2a6
Delete unused converter function
Feb 13, 2018
c89d782
Use variable instead of literal for comma-sep value regex
Feb 13, 2018
c3fae74
Remove convert_to_floats import from btax/models.py
Feb 13, 2018
fed2af5
Catch case where cpi param is submitted
Feb 13, 2018
1f610ed
Finish refactoring taxbrain static param processing
Feb 13, 2018
34daccc
Add append_errors_warnings import
Feb 13, 2018
8eeb86c
Remove convert_to_floats import
Feb 13, 2018
45f68d5
Add abstract form to implement 'field' and 'raw_fields' creation and …
Feb 14, 2018
32268cc
Update fields saving logic in taxbrain/views.py
Feb 14, 2018
fb963f2
Set fields in utils.get_taxbrain_model
Feb 14, 2018
213bda7
Refactor taxbrain static models to use mixins for methods
Feb 14, 2018
dee782d
Add mix-in documentation
Feb 14, 2018
5207833
Dynamic behavorial forms inherits new fields generation and validatio…
Feb 14, 2018
0f6d4af
Add behavioral fields fixture
Feb 14, 2018
d2489bd
Get rid of quick_calc key and fix naming error
Feb 15, 2018
c000757
Apply refactored parameter processing logic to dynamic-behavioral
Feb 15, 2018
bb7475b
Implement get_model_specs for dyanmic-behavioral
Feb 15, 2018
b415a2e
Adjust taxbrain/test_models.py for test refactoring required dynamic-…
Feb 15, 2018
58382c7
Update file upload to django 1.9
Feb 15, 2018
cacb87e
Catch case where we have cpi param
Feb 15, 2018
3c6a1ff
Still trying to get the cpi parsing right
Feb 15, 2018
1f876aa
Get rid of growth params since they are not used in static
Feb 15, 2018
c331cb8
Use taxcalc inflatable attribute for cpi param discovery
Feb 15, 2018
03d45bd
Directly update django fields data
Feb 15, 2018
ef9cb92
Change Form mix-in name for dynamic-app import
Feb 15, 2018
db7da25
Fix syntax error in views.py
Feb 15, 2018
60fa187
Use correct base class in taxbrain/test_models
Feb 15, 2018
e004e59
Update fields variable instead of base_fields
Feb 16, 2018
e2b3d18
Move json import out of method and into module
Feb 16, 2018
f681d98
Rename fields to input_fields to avoid inherited fields attribute con…
Feb 16, 2018
6e7685b
No need to pull in this data anymore
Feb 16, 2018
0c8b1b0
Updates form/model somehow--brings back edit inputs feature
Feb 16, 2018
1cdf61a
Update dynamic app to new param storing and django 1.9
Feb 16, 2018
aa97247
Mark ogusa tests with xfail until we have time to re-re-instate it
Feb 16, 2018
a023581
Remvoe traceback printing for warnings
Feb 16, 2018
3a8870d
Finish upgrading b-tax to django 1.9
Feb 16, 2018
4155bf0
Quick fixes from martin's comments
Feb 20, 2018
606140e
Turns out ast.literal_eval does work for negative numbers
Feb 20, 2018
cb0f556
Refactor casting logic to make more readable
Feb 20, 2018
ef93471
Clean up parse_values comments
Feb 20, 2018
493b8ea
Use .lower instead of .title
Feb 20, 2018
8109296
Use custom exception for parameter lookup function
Feb 20, 2018
0fe4d42
Add deprecated field handling to model mixin
Feb 20, 2018
29dbfea
Remove return statement from debugging
Feb 20, 2018
d7ae0f3
Drop Tax-Caclualtor 0.15.0 migrations
Feb 21, 2018
21d6f00
Add deprecated_fields field for dynamic model
Feb 21, 2018
e268298
Add deprecation errors for edit page visit on older runs
Feb 21, 2018
61ca3d9
Switch fixup refactor and captital gain goes to amt is back
Feb 21, 2018
80c0b89
Check if depricated_files has been initialized first
Feb 21, 2018
71d323f
xfailing extra param test until param checking solution is found
Feb 21, 2018
e5ad0a0
Enhance assertion checking in test util func check_posted_params
Feb 21, 2018
90386ba
Drop boolean parameters resolving #765 and #786
Feb 21, 2018
07386ee
Apply new parameter processing logic to cpi variables
Feb 22, 2018
fbcc208
Add deprecated_field for dynamic model
Feb 22, 2018
335d8bb
Clean up migration history and remove migrations for tc 0.15.0
Feb 22, 2018
ef1683d
Fix run-on sentence in deprecation message
Feb 22, 2018
b9aa49d
Needs a period too
Feb 22, 2018
05f21ef
Update to taxcalc 0.15.2
Feb 22, 2018
f6c0180
Upgrade PB version to 1.4.0
Feb 22, 2018
5f7be9a
Don't run tc tests on deploy
Feb 22, 2018
dabbf14
Only store model param fields specified by the user
Feb 22, 2018
f95a420
Add parameters policy document
Feb 23, 2018
1776086
Update RELEASES.md for PolicyBrain 1.4.0
Feb 23, 2018
9af9a2a
Btax results no longer stored as json but as text
Feb 26, 2018
7d01c5d
Add release date to RELEASES.md
Feb 26, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ install:
- popd
- source activate aei_dropq

before_script:
- python manage.py syncdb --noinput
- python manage.py makemigrations taxbrain
- python manage.py migrate taxbrain
- python manage.py migrate --fake
addons:
postgresql: "9.4"

before_script:
- psql -c 'create database test_db;' -U postgres

script:
- py.test webapp/apps/
45 changes: 45 additions & 0 deletions PARAMETERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Parameter Policy
====================

Goal: document parameter handling approach

Parameter Parsing
-------------------

Ideally, the string received from the user input is parsed into the the
Python type it most closely matches. That means that `'True'` parses
to `True`, `'1'` to `1`, `'20000.0'` to `20000.0`, and so on. It is then
up to the upstream package to perform type and range validation on the
converted object and provide the appropriate error messages.

However, due to issues with the interface, the user's input has to be massaged
into the correct format. For instance, places where we expect a boolean
string display `1.0` as a default value instead of `True`. Thus, the value
parsing logic must be capable of parsing `'1.0'`, `'1'`, or `'True'` to `True`.
There are other issues such as values that should only be integers (e.g. age)
are displayed as floating point values. Once we display more accurate
default values, we should remove this functionality in order to simplify the
codebase. Note that there will always be some element of string massaging
since PolicyBrain users tend to be less technical and thus, may not realize
the significance of entering `True` versus `true` or `TRUE`.


Parameter Deprecation
---------------------

Our primary goal is to preserve the results and relevant information for all
runs. The goal of allowing the user to edit and re-submit previous runs is a
lower priority than the first goal. The underlying modeling packages change
overtime which means that parameter names change, their underlying definitions
change, they are split in to multiple components, and some are removed.
PolicyBrain only allows the user to view and submit parameters that are
supported by the current version of the underlying package. Thus, when a user
tries to access a run submitted on an older version of the underlying package
via the edit parameters page, some of the parameters may not exist on the page
anymore. The PolicyBrain policy in this situation is to allow the user to view
and edit the parameters that still exist and for the parameters that do not,
display an error message at the top of the page for each missing parameter that
says:

Field {parameter name} has been deprecated. Refer to the Tax-Caclulator
documentation for a sensible replacement.
20 changes: 20 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ Go
[here](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pulls?q=is%3Apr+is%3Aclosed)
for a complete commit history.

Release 1.4.0 on 2018-02-26
----------------------------
**Major Changes**
- None

**Minor Changes**
- [#798](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/798) - Add examples for get_default_policy_param_name - Hank Doupe
- [#800](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/800) - Refactor warning/error parsing - Hank Doupe
- [#808](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/808) - Upgrade to Tax-Calculator 0.15.0 - Hank Doupe
- [#809](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/809) - Add Legend to Bubble Plot - Anderson Frailey
- [#810](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/810) - Small changes to .gitignore and install script - Ben Bolte
- [#822](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/822) - Update to Django 1.9 and store parameters as JSON object - Hank Doupe

**Bug Fixes**
- [#797](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/797) - Remove Expanded-Income/or/Adjusted-Income row buttons - Sean Wang
- [#799](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/799) - .travis.yml update to fix build errors - Hank Doupe
- [#807](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/807) - Fix "Vizualization" typo in Gallery - Max Ghenis
- [#814](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/814) - Resolve more backwards compatibility issues related to old taxcalc tables - Hank Doupe
- [#818](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/818) - Changed all instances of TJ Alumbaugh's email address - Ben Bolte

Release 1.3.0 on 2017-12-23
----------------------------
**Major Changes**
Expand Down
4 changes: 2 additions & 2 deletions conda-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nomkl
taxcalc==0.15.1
btax==0.1.9
taxcalc==0.15.2
btax==0.2.2
numba>=0.33.0
pandas>=0.22.0
gevent
Expand Down
3 changes: 0 additions & 3 deletions deploy/fab/reset_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ redis-cli FLUSHALL
cd ${DEP}/../Tax-Calculator && git fetch origin
conda list | grep 'taxcalc' | awk -F' ' '{print $2}' | xargs -n 1 git checkout
cp ~/deploy/puf.csv.gz ./ && gunzip -k puf.csv.gz
cd taxcalc/tests
echo $rs Test the correct puf is here - Tax-Calculator
py.test -m "requires_pufcsv"
cd $DEP/taxbrain_server/tests
echo $rs Test the mock celery - mock flask tests in deploy
MOCK_CELERY=1 TAX_ESTIMATE_PATH=$OGUSA_PATH py.test -p no:django -v
Expand Down
5 changes: 3 additions & 2 deletions deploy/taxbrain_server/celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def ogusa_async(user_mods, ogusa_params, guid):
def btax_async(user_mods):
print("user mods: ", user_mods)
results = {}
tables = runner_json_tables(**user_mods)
tables = json.loads(runner_json_tables(**user_mods))
if tables.get("json_table"):
results.update(tables["json_table"])
if tables.get("dataframes"):
Expand All @@ -171,7 +171,8 @@ def btax_async(user_mods):
results['dropq_version'] = vinfo['version']
binfo = btax._version.get_versions()
results['btax_version'] = binfo['version']
return json.dumps(results)
json_res = json.dumps(results)
return json_res


@celery_app.task
Expand Down
5 changes: 3 additions & 2 deletions deploy/taxbrain_server/flask_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ def btax_endpoint():
raw_results = btax_async.delay(user_mods)
RUNNING_JOBS[raw_results.id] = raw_results
length = client.llen(queue_name) + 1
results = {'job_id':str(raw_results), 'qlength':length}
return str(json.dumps(results))
results = {'job_id': str(raw_results), 'qlength':length}
json_res = json.dumps(results)
return json_res


@app.route("/elastic_gdp_start_job", methods=['POST'])
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==1.8.2
Django==1.9
argparse==1.2.1
dj-database-url==0.3.0
dj-static==0.0.6
Expand All @@ -11,12 +11,10 @@ sendgrid-django
psycopg2>=2.5.4
django-user-accounts
django-uuidfield==0.5.0
django-queryset-csv==0.2.10
newrelic==2.58.2.45
pdfkit==0.4.1
django-hermes
mock
jsonfield
eventlet
django-debug-toolbar==1.2.1
django_import_export
Expand Down
7 changes: 3 additions & 4 deletions webapp/apps/btax/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

from django.db import models, migrations
import datetime
import jsonfield.fields
from django.conf import settings
import uuidfield.fields
import uuid
import webapp.apps.taxbrain.models


Expand All @@ -22,7 +21,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('model_pk', models.IntegerField(default=None, null=True)),
('exp_comp_datetime', models.DateTimeField(default=datetime.datetime(2015, 1, 1, 0, 0))),
('uuid', uuidfield.fields.UUIDField(null=True, default=None, editable=False, max_length=32, blank=True, unique=True)),
('uuid', models.UUIDField(null=True, default=None, editable=False, max_length=32, blank=True, unique=True)),
('btax_vers', models.CharField(default=None, max_length=50, null=True, blank=True)),
('taxcalc_vers', models.CharField(default=None, max_length=50, null=True, blank=True)),
],
Expand Down Expand Up @@ -93,7 +92,7 @@ class Migration(migrations.Migration):
('job_ids', webapp.apps.taxbrain.models.SeparatedValuesField(default=None, null=True, blank=True)),
('jobs_not_ready', webapp.apps.taxbrain.models.SeparatedValuesField(default=None, null=True, blank=True)),
('first_year', models.IntegerField(default=None, null=True)),
('tax_result', jsonfield.fields.JSONField(default=None, null=True, blank=True)),
('tax_result', models.TextField(default=None, null=True, blank=True)),
('creation_date', models.DateTimeField(default=datetime.datetime(2015, 1, 1, 0, 0))),
],
options={
Expand Down
26 changes: 26 additions & 0 deletions webapp/apps/btax/migrations/0003_auto_20180205_2151.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2018-02-05 21:51
from __future__ import unicode_literals

from django.db import migrations, models
import uuid


class Migration(migrations.Migration):

dependencies = [
('btax', '0002_btaxoutputurl_webapp_vers'),
]

operations = [
migrations.AlterField(
model_name='btaxoutputurl',
name='uuid',
field=models.UUIDField(blank=True, default=uuid.uuid4, editable=False, null=True, unique=True),
),
migrations.AlterField(
model_name='btaxsaveinputs',
name='tax_result',
field=models.TextField(blank=True, default=None, null=True),
),
]
11 changes: 5 additions & 6 deletions webapp/apps/btax/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
import uuid

from django.db import models
from django.core import validators
Expand All @@ -7,13 +8,11 @@
from django.core.validators import MinValueValidator, MaxValueValidator, RegexValidator
from django.contrib.auth.models import User

from uuidfield import UUIDField
from jsonfield import JSONField
from django.contrib.postgres.fields import JSONField
import datetime

from ..taxbrain.models import (SeparatedValuesField,
CommaSeparatedField,
convert_to_floats)
CommaSeparatedField)



Expand Down Expand Up @@ -117,7 +116,7 @@ class BTaxSaveInputs(models.Model):
first_year = models.IntegerField(default=None, null=True)

# Result
tax_result = JSONField(default=None, blank=True, null=True)
tax_result = models.TextField(default=None, blank=True, null=True)
# Creation DateTime
creation_date = models.DateTimeField(default=datetime.datetime(2015, 1, 1))

Expand All @@ -138,7 +137,7 @@ class BTaxOutputUrl(models.Model):
model_pk = models.IntegerField(default=None, null=True)
# Expected Completion DateTime
exp_comp_datetime = models.DateTimeField(default=datetime.datetime(2015, 1, 1))
uuid = UUIDField(auto=True, default=None, null=True)
uuid = models.UUIDField(default=uuid.uuid4, null=True, editable=False, max_length=32, blank=True, unique=True)
btax_vers = models.CharField(blank=True, default=None, null=True, max_length=50)
taxcalc_vers = models.CharField(blank=True, default=None, null=True, max_length=50)
webapp_vers = models.CharField(blank=True, default=None, null=True,
Expand Down
1 change: 0 additions & 1 deletion webapp/apps/btax/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from ..models import BTaxSaveInputs, BTaxOutputUrl
from ...taxbrain.models import WorkerNodesCounter
from ..models import convert_to_floats
from ..compute import (DropqComputeBtax, MockComputeBtax,
MockFailedComputeBtax, NodeDownComputeBtax)
import taxcalc
Expand Down
4 changes: 2 additions & 2 deletions webapp/apps/btax/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
edit_btax_results, generate_mock_results)


urlpatterns = patterns('',
urlpatterns = [
url(r'^$', btax_results, name='btax_tax_form'),
url(r'^(?P<pk>\d+)/', output_detail, name='btax_output_detail'),
url(r'^edit/(?P<pk>\d+)/', edit_btax_results, name='btax_edit_btax_results'),
url(r'^mock-ccc-results', generate_mock_results, name='btax_generate_mock_results')
)
]
26 changes: 13 additions & 13 deletions webapp/apps/btax/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ipware.ip import get_real_ip

from django.core import serializers
from django.core.context_processors import csrf
from django.template.context_processors import csrf
from django.core.exceptions import ValidationError
from django.contrib.auth.decorators import login_required, permission_required
from django.http import HttpResponseRedirect, HttpResponse, Http404, JsonResponse
Expand All @@ -31,8 +31,6 @@
from django.contrib.auth.models import User
from django import forms

from djqscsv import render_to_csv_response

from .forms import BTaxExemptionForm, has_field_errors
from .models import BTaxSaveInputs, BTaxOutputUrl
from .helpers import (get_btax_defaults,
Expand All @@ -42,8 +40,7 @@
make_bool, convert_val)
from ..taxbrain.helpers import (format_csv,
is_wildcard)
from ..taxbrain.views import (benefit_switch_fixup,
denormalize, normalize)
from ..taxbrain.views import denormalize, normalize
from .compute import DropqComputeBtax, MockComputeBtax, JobFailError

from ..constants import (METTR_TOOLTIP, METR_TOOLTIP, COC_TOOLTIP, DPRC_TOOLTIP,
Expand Down Expand Up @@ -101,15 +98,18 @@ def btax_results(request):
"""
no_inputs = False
start_year = START_YEAR
REQUEST = request.REQUEST
if request.method=='POST':
print 'POST'
# Client is attempting to send inputs, validate as form data
# Need need to the pull the start_year out of the query string
# to properly set up the Form
has_errors = make_bool(request.POST['has_errors'])
start_year = REQUEST['start_year']
fields = dict(REQUEST)
fields = dict(request.GET)
fields.update(dict(request.POST))
fields = {k: v[0] if isinstance(v, list) else v for k, v in fields.items()}
start_year = fields.get('start_year', START_YEAR)
# TODO: migrate first_year to start_year to get rid of weird stuff like
# this
fields['first_year'] = fields['start_year']
btax_inputs = BTaxExemptionForm(start_year, fields)
btax_inputs = make_bool_gds_ads(btax_inputs)
Expand Down Expand Up @@ -355,8 +355,8 @@ def output_detail(request, pk):
if model.tax_result:
exp_num_minutes = 0.25
JsonResponse({'eta': exp_num_minutes, 'wait_interval': 15000}, status=202)

tables = url.unique_inputs.tax_result[0]
tax_result = url.unique_inputs.tax_result
tables = json.loads(tax_result)[0]
first_year = url.unique_inputs.first_year
created_on = url.unique_inputs.creation_date
tables["tooltips"] = {
Expand All @@ -365,7 +365,7 @@ def output_detail(request, pk):
"coc": COC_TOOLTIP,
"dprc": DPRC_TOOLTIP,
}
bubble_js, bubble_div, cdn_js, cdn_css = bubble_plot_tabs(model.tax_result[0]['dataframes'])
bubble_js, bubble_div, cdn_js, cdn_css = bubble_plot_tabs(tables['dataframes'])

inputs = url.unique_inputs
is_registered = True if request.user.is_authenticated() else False
Expand Down Expand Up @@ -416,8 +416,8 @@ def output_detail(request, pk):


if all([job == 'YES' for job in jobs_ready]):
model.tax_result = dropq_compute.btax_get_results(normalize(job_ids))

tax_result = dropq_compute.btax_get_results(normalize(job_ids))
model.tax_result = json.dumps(tax_result)
model.creation_date = datetime.datetime.now()
print 'ready'
model.save()
Expand Down