From 83ca6beb2d4421fd56d8eda3bcab52aa606bc582 Mon Sep 17 00:00:00 2001 From: Henry Doupe Date: Tue, 13 Mar 2018 10:45:01 -0400 Subject: [PATCH 1/4] Updates to TC tables in PR 1917 --- static/js/taxbrain-tablebuilder.js | 16 +++++++---- webapp/apps/taxbrain/helpers.py | 44 +++++++++++++----------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/static/js/taxbrain-tablebuilder.js b/static/js/taxbrain-tablebuilder.js index 08bc8396..6dc36e2d 100644 --- a/static/js/taxbrain-tablebuilder.js +++ b/static/js/taxbrain-tablebuilder.js @@ -105,7 +105,9 @@ $(function() { rowLabels: function() { if (this.get('grouping') == 'bin') { return [ - '<$10K', + '<$0K', + '=$0K', + '$0-10K', '$10-20K', '$20-30K', '$30-40K', @@ -116,11 +118,13 @@ $(function() { '$200-500K', '$500-1000K', '>$1000K', - 'All' + 'ALL' ]; } else if (this.get('grouping') == 'dec') { return [ - '0-10', + '0-10n', + '0-10z', + '0-10p', '10-20', '20-30', '30-40', @@ -130,8 +134,10 @@ $(function() { '70-80', '80-90', '90-100', - 'All' - ]; + 'ALL', + '90-95', + '95-99', + 'Top 1%' ]; } } }); diff --git a/webapp/apps/taxbrain/helpers.py b/webapp/apps/taxbrain/helpers.py index 0061012e..107a7c6c 100644 --- a/webapp/apps/taxbrain/helpers.py +++ b/webapp/apps/taxbrain/helpers.py @@ -245,22 +245,26 @@ def default_taxcalc_data(cls, start_year, metadata=False): [1000000000, 'Dollars', 1], # "Total Tax Difference", [ 1, '%', 1], # "Share of Overall Change" ] -TAXCALC_RESULTS_BIN_ROW_KEYS = taxcalc.WEBBIN_ROW_NAMES +TAXCALC_RESULTS_BIN_ROW_KEYS = taxcalc.STANDARD_ROW_NAMES TAXCALC_RESULTS_BIN_ROW_KEY_LABELS = { - '<$10K':'Less than 10', - '$10-20K':'10-20', - '$20-30K':'20-30', - '$30-40K':'30-40', - '$40-50K':'40-50', - '$50-75K':'50-75', - '$75-100K':'75-100', - '$100-200K':'100-200', - '$200-500K':'200-500', - '$500-1000K':'500-1000', - '>$1000K':'1000+', - 'all':'All' + k: k for k in taxcalc.STANDARD_ROW_NAMES } -TAXCALC_RESULTS_DEC_ROW_KEYS = taxcalc.DECILE_ROW_NAMES[:-3] +# '<$0K': 'Negative', +# '=$0k': '0', +# '$0-10K':'0-10', +# '$10-20K':'10-20', +# '$20-30K':'20-30', +# '$30-40K':'30-40', +# '$40-50K':'40-50', +# '$50-75K':'50-75', +# '$75-100K':'75-100', +# '$100-200K':'100-200', +# '$200-500K':'200-500', +# '$500-1000K':'500-1000', +# '>$1000K':'1000+', +# 'all':'All' +# } +TAXCALC_RESULTS_DEC_ROW_KEYS = taxcalc.DECILE_ROW_NAMES # -DEC_ROW_NAMES = ['perc0-10', 'perc10-20', 'perc20-30', 'perc30-40', # - 'perc40-50', 'perc50-60', 'perc60-70', 'perc70-80', # - 'perc80-90', 'perc90-100', 'all'] @@ -317,17 +321,7 @@ def default_taxcalc_data(cls, start_year, metadata=False): } TAXCALC_RESULTS_DEC_ROW_KEY_LABELS = { - '0-10':'0-10%', - '10-20':'10-20%', - '20-30':'20-30%', - '30-40':'30-40%', - '40-50':'40-50%', - '50-60':'50-60%', - '60-70':'60-70%', - '70-80':'70-80%', - '80-90':'80-90%', - '90-100':'90-100%', - 'all':'All' + k: k for k in taxcalc.DECILE_ROW_NAMES } TAXCALC_RESULTS_TABLE_LABELS = { 'diff_comb_xbin': 'Combined Payroll and Individual Income Tax: Difference between Base and User plans by expanded income bin', From ed798103860cf1d2123784c0738f274dc76cbfbc Mon Sep 17 00:00:00 2001 From: Henry Doupe Date: Wed, 14 Mar 2018 11:49:47 -0400 Subject: [PATCH 2/4] Add TODO's and update labels --- static/js/taxbrain-tablebuilder.js | 7 ++++--- staticfiles/js/taxbrain-tablebuilder.js | 17 ++++++++++----- webapp/apps/taxbrain/helpers.py | 28 +++++++++---------------- webapp/apps/taxbrain/views.py | 3 ++- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/static/js/taxbrain-tablebuilder.js b/static/js/taxbrain-tablebuilder.js index 6dc36e2d..d0fa72a9 100644 --- a/static/js/taxbrain-tablebuilder.js +++ b/static/js/taxbrain-tablebuilder.js @@ -104,6 +104,7 @@ $(function() { rowLabels: function() { if (this.get('grouping') == 'bin') { + // TODO: retrieve labels from the context and display them instead of hardcode labels here return [ '<$0K', '=$0K', @@ -122,9 +123,9 @@ $(function() { ]; } else if (this.get('grouping') == 'dec') { return [ - '0-10n', - '0-10z', - '0-10p', + '0-10: <$0', + '0-10: =$0', + '0-10: >$0', '10-20', '20-30', '30-40', diff --git a/staticfiles/js/taxbrain-tablebuilder.js b/staticfiles/js/taxbrain-tablebuilder.js index 08bc8396..d0fa72a9 100644 --- a/staticfiles/js/taxbrain-tablebuilder.js +++ b/staticfiles/js/taxbrain-tablebuilder.js @@ -104,8 +104,11 @@ $(function() { rowLabels: function() { if (this.get('grouping') == 'bin') { + // TODO: retrieve labels from the context and display them instead of hardcode labels here return [ - '<$10K', + '<$0K', + '=$0K', + '$0-10K', '$10-20K', '$20-30K', '$30-40K', @@ -116,11 +119,13 @@ $(function() { '$200-500K', '$500-1000K', '>$1000K', - 'All' + 'ALL' ]; } else if (this.get('grouping') == 'dec') { return [ - '0-10', + '0-10: <$0', + '0-10: =$0', + '0-10: >$0', '10-20', '20-30', '30-40', @@ -130,8 +135,10 @@ $(function() { '70-80', '80-90', '90-100', - 'All' - ]; + 'ALL', + '90-95', + '95-99', + 'Top 1%' ]; } } }); diff --git a/webapp/apps/taxbrain/helpers.py b/webapp/apps/taxbrain/helpers.py index 107a7c6c..e490fe14 100644 --- a/webapp/apps/taxbrain/helpers.py +++ b/webapp/apps/taxbrain/helpers.py @@ -245,26 +245,21 @@ def default_taxcalc_data(cls, start_year, metadata=False): [1000000000, 'Dollars', 1], # "Total Tax Difference", [ 1, '%', 1], # "Share of Overall Change" ] +#TODO: apply these labels to the rows displayed on the output page TAXCALC_RESULTS_BIN_ROW_KEYS = taxcalc.STANDARD_ROW_NAMES TAXCALC_RESULTS_BIN_ROW_KEY_LABELS = { k: k for k in taxcalc.STANDARD_ROW_NAMES } -# '<$0K': 'Negative', -# '=$0k': '0', -# '$0-10K':'0-10', -# '$10-20K':'10-20', -# '$20-30K':'20-30', -# '$30-40K':'30-40', -# '$40-50K':'40-50', -# '$50-75K':'50-75', -# '$75-100K':'75-100', -# '$100-200K':'100-200', -# '$200-500K':'200-500', -# '$500-1000K':'500-1000', -# '>$1000K':'1000+', -# 'all':'All' -# } +# TODO: TAXCALC_RESULTS_DEC_ROW_KEYS = taxcalc.DECILE_ROW_NAMES +# use our own PolicyBrain names for the first three items +POLICYBRAIN_DEC_ROW_LABELS = ( + ['0-10: <$0', '0-10: =$0', '0-10 >$0'] + + taxcalc.DECILE_ROW_NAMES[3:] +) +TAXCALC_RESULTS_DEC_ROW_KEY_LABELS = { + v: k for k, v in zip(POLICYBRAIN_DEC_ROW_LABELS, taxcalc.DECILE_ROW_NAMES) +} # -DEC_ROW_NAMES = ['perc0-10', 'perc10-20', 'perc20-30', 'perc30-40', # - 'perc40-50', 'perc50-60', 'perc60-70', 'perc70-80', # - 'perc80-90', 'perc90-100', 'all'] @@ -320,9 +315,6 @@ def default_taxcalc_data(cls, start_year, metadata=False): 'fiscal_tot_ref': 'aggr_2' } -TAXCALC_RESULTS_DEC_ROW_KEY_LABELS = { - k: k for k in taxcalc.DECILE_ROW_NAMES -} TAXCALC_RESULTS_TABLE_LABELS = { 'diff_comb_xbin': 'Combined Payroll and Individual Income Tax: Difference between Base and User plans by expanded income bin', 'diff_comb_xdec': 'Combined Payroll and Individual Income Tax: Difference between Base and User plans by expanded income decile', diff --git a/webapp/apps/taxbrain/views.py b/webapp/apps/taxbrain/views.py index 7c92aabe..6f394156 100644 --- a/webapp/apps/taxbrain/views.py +++ b/webapp/apps/taxbrain/views.py @@ -706,7 +706,8 @@ def get_result_context(model, request, url): tables['cdf_bin'] = tables.pop('diff_comb_xbin') json_table = json.dumps(tables) - + # TODO: Add row labels for decile and income bin tables to the context here + # and display these instead of hardcode in the javascript context = { 'locals':locals(), 'unique_url':url, From 8d7b06a2fdb71555957df40143d40111820e451e Mon Sep 17 00:00:00 2001 From: Henry Doupe Date: Mon, 19 Mar 2018 13:21:22 -0400 Subject: [PATCH 3/4] Update to tc 0.17.0 --- conda-requirements.txt | 2 +- deploy/fab/dropq_environment.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conda-requirements.txt b/conda-requirements.txt index f9682d47..0d423734 100644 --- a/conda-requirements.txt +++ b/conda-requirements.txt @@ -1,5 +1,5 @@ nomkl -taxcalc==0.15.2 +taxcalc==0.17.0 btax==0.2.2 ogusa==0.5.8 numba>=0.33.0 diff --git a/deploy/fab/dropq_environment.yml b/deploy/fab/dropq_environment.yml index fd234cd7..a5f42cf8 100644 --- a/deploy/fab/dropq_environment.yml +++ b/deploy/fab/dropq_environment.yml @@ -3,7 +3,7 @@ dependencies: - python<=2.7.14,>=2.7.12 - numpy >=1.12.1 - pandas >=0.22.0 -- taxcalc =0.15.2 +- taxcalc =0.17.0 - btax =0.2.2 - ogusa =0.5.8 - numba From 455b248b01930ad3276042620a60f14c5bfe6f92 Mon Sep 17 00:00:00 2001 From: Henry Doupe Date: Mon, 19 Mar 2018 13:21:50 -0400 Subject: [PATCH 4/4] Use taxcalc row names for decile table --- webapp/apps/taxbrain/helpers.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/webapp/apps/taxbrain/helpers.py b/webapp/apps/taxbrain/helpers.py index 814b0abe..16f5b8cf 100644 --- a/webapp/apps/taxbrain/helpers.py +++ b/webapp/apps/taxbrain/helpers.py @@ -253,13 +253,8 @@ def default_taxcalc_data(cls, start_year, metadata=False): # TODO: TAXCALC_RESULTS_DEC_ROW_KEYS = taxcalc.DECILE_ROW_NAMES # use our own PolicyBrain names for the first three items -POLICYBRAIN_DEC_ROW_LABELS = ( - ['0-10: <$0', '0-10: =$0', '0-10 >$0'] + - taxcalc.DECILE_ROW_NAMES[3:] -) -TAXCALC_RESULTS_DEC_ROW_KEY_LABELS = { - v: k for k, v in zip(POLICYBRAIN_DEC_ROW_LABELS, taxcalc.DECILE_ROW_NAMES) -} +POLICYBRAIN_DEC_ROW_LABELS = taxcalc.DECILE_ROW_NAMES +TAXCALC_RESULTS_DEC_ROW_KEY_LABELS = {k: k for k in taxcalc.DECILE_ROW_NAMES} # -DEC_ROW_NAMES = ['perc0-10', 'perc10-20', 'perc20-30', 'perc30-40', # - 'perc40-50', 'perc50-60', 'perc60-70', 'perc70-80', # - 'perc80-90', 'perc90-100', 'all']