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

Use ParamTools #2401

Merged
merged 68 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
73b5ede
checpoint: most policy, calculator tests pass
hdoupe Nov 19, 2019
6000bc4
Add paramtools to environment.yaml
hdoupe Nov 19, 2019
f41ec08
Add warning handling
hdoupe Dec 15, 2019
16b0ee6
Add docstring to base parameters class and clean up args
hdoupe Dec 15, 2019
d9e5428
Update tests in test_parameters.py
hdoupe Dec 17, 2019
c50e8d0
Fix terminology in comment
hdoupe Dec 22, 2019
d9f7c93
Remove debugging print statement from calcfunctions
hdoupe Dec 22, 2019
8217150
Revert inflation_rates and wage_growth_rates back to being methods to…
hdoupe Dec 22, 2019
5cd798a
Use pm/pf terminology instead of paremeter_list for determining if it…
hdoupe Dec 22, 2019
88bde60
Fix missed inflation_rates to method reversion
hdoupe Dec 22, 2019
058f4a4
Progress on reform docs
hdoupe Jan 28, 2020
7605b25
Parameters is not iterable and use leading underscore to get value fo…
hdoupe Feb 29, 2020
2e464a3
Catch paramtools.ValidationErrors instead of ValueErrors in taxcalcio
hdoupe Feb 29, 2020
c8e13c1
Fix documentation tests for growdiff.py
hdoupe Feb 29, 2020
af6b64c
Updata consumption tests for paramtools format and validation error
hdoupe Feb 29, 2020
ab5ba93
Swap back to old style json files to make merge conflict resolution e…
hdoupe Feb 29, 2020
4972a33
Merge in TC 2.7.0 and 2.8.0
hdoupe Feb 29, 2020
9040601
Comment out code for testing _expand_array since it is tested in Para…
hdoupe Feb 29, 2020
d5a4e81
Fix cpi offset bug reported in #2381
hdoupe Feb 29, 2020
9afeb46
Update tests for 2017 law and tcja round trip. Also try to handle rem…
hdoupe Feb 29, 2020
c0a3e81
Re-write paramtools versions of json files
hdoupe Feb 29, 2020
98e3fe5
Update pt version and add to packages test
hdoupe Feb 29, 2020
6b00c61
Fix a whole bunch of codestyle errors
hdoupe Mar 4, 2020
d282f5a
Fix code-style
hdoupe Mar 4, 2020
59c90ed
Set up data in initialize method
hdoupe Mar 5, 2020
9820412
Add start year to initial state to prevent extra set_state call
hdoupe Mar 5, 2020
395af1c
Revert inflation_rates and wage_growth_rates back to lists to preserv…
hdoupe Mar 21, 2020
5bbf7ac
Updates for paramtools 0.12.0
hdoupe Apr 9, 2020
55f6e63
Add tests for parameter index status/cpi offset interactions
hdoupe Apr 9, 2020
d950421
First pass back through adjust method to fix typos, clarify and simpl…
hdoupe Apr 10, 2020
86880ab
Update parameter docs
hdoupe Apr 10, 2020
b1f9615
Update for forthcoming pt 0.13 release
hdoupe Apr 11, 2020
d8a410a
Add back logic for resetting to initial values to fix tcja tests
hdoupe Apr 11, 2020
ccafe51
Bump paramtools dep to 0.13.0
hdoupe Apr 11, 2020
d62928e
Fix punctuation, use more informative variable name
hdoupe Apr 11, 2020
fd956dc
Clean up tests
hdoupe Apr 11, 2020
ccbcd5a
Bump version in test_4package
hdoupe Apr 11, 2020
8fa88d5
Fix merge conflicts
hdoupe Apr 11, 2020
74f8e64
Remove hard-coded start and end years and handle rounding in tests
hdoupe Apr 11, 2020
5cd655c
fix line-length issues
hdoupe Apr 11, 2020
74265a4
oh my pep8
hdoupe Apr 11, 2020
1bb86c4
Update docstring formatting and raise pt.ValidationError instead of g…
hdoupe Apr 13, 2020
7e9b4c7
Add tests for redefined parameters and indexed status parsing
hdoupe Apr 13, 2020
eb7282b
pep8 ur killing me
hdoupe Apr 13, 2020
39096e7
Add back test for setting a float value to an int param
hdoupe Apr 16, 2020
a0c928b
Fix validation for array parameters passed through _update
hdoupe Apr 17, 2020
7c763d4
Update environment.yaml to req at least paramtools 0.13.1
hdoupe Apr 17, 2020
419dbb8
Rework array validation logic in _update
hdoupe Apr 17, 2020
65f259e
Simplify array shape validation
hdoupe Apr 17, 2020
3dd3240
Remove no-longer needed check for IndexError
hdoupe Apr 17, 2020
397265c
Remove unnecessary super() calls
hdoupe Apr 17, 2020
635b1ec
Revert stylistic change in test
hdoupe Apr 22, 2020
c2f74e2
fix typo, thx @Peter-Metz
hdoupe Apr 22, 2020
22d9fcc
remove years 2020-2025 for TCJA-reverting params
Peter-Metz Apr 23, 2020
2cdbcbf
change hardcoded var to last_known_year
Peter-Metz Apr 23, 2020
51aa559
Merge pull request #1 from hdoupe/del_int_years
hdoupe Apr 23, 2020
c44dfbb
Add back print_warnings argument
hdoupe Apr 27, 2020
5cc1c2e
remake uguide to resemble old tax-calc format
Peter-Metz Apr 30, 2020
65f5083
Updates for forthcoming paramtools release
hdoupe May 1, 2020
756a8f1
Fixes to improve git diff
hdoupe May 1, 2020
dd5cb89
Update for better git diff in test_parameters expand tests
hdoupe May 1, 2020
e32346c
Update paramtools requirement to 0.14.0
hdoupe May 1, 2020
437c33c
Fix key order in defaults json files
hdoupe May 1, 2020
f2c1dbd
Merge pull request #2 from hdoupe/uguide
hdoupe May 1, 2020
2c9aab7
Remove extra set_state calls in _update
hdoupe May 3, 2020
fa1103e
Fix docstring
hdoupe May 4, 2020
17adb96
Remove ctc_c warnings
hdoupe May 4, 2020
a892c37
Update test for inflation/wage growth rate accesser methods
hdoupe May 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 43 additions & 30 deletions docs/make_uguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ def policy_param_text(pname, param):
'Not in Tax-Brain webapp')
txt += '<br><i>tc Name:</i> {}'.format(pname)
if sec1:
txt += '<br><i>TB Name:</i> {}'.format(param['long_name'])
txt += '<br><i>TB Name:</i> {}'.format(param['title'])
else:
txt += '<br><i>Long Name:</i> {}'.format(param['long_name'])
txt += '<br><i>Long Name:</i> {}'.format(param['title'])
txt += '<br><i>Description:</i> {}'.format(param['description'])
if param.get('notes', ''):
txt += '<br><i>Notes:</i> {}'.format(param['notes'])
Expand All @@ -104,27 +104,28 @@ def policy_param_text(pname, param):
txt += 'True'
else:
txt += 'False'
txt += '<br><i>Value Type:</i> {}'.format(param['value_type'])
txt += '<br><i>Value Type:</i> {}'.format(param['type'])
txt += '<br><i>Known Values:</i>'
if param.get('vi_vals', []):
cols = ', '.join(param['vi_vals'])
txt += '<br>&nbsp;&nbsp; for: [{}]'.format(cols)
for cyr, val in zip(param['value_yrs'], param['value']):
final_cyr = cyr
final_val = val
txt += '<br>{}: {}'.format(cyr, val)
if not param['indexed']:
fcyr = int(final_cyr)
if fcyr < Policy.LAST_KNOWN_YEAR:
# extrapolate final_val thru Policy.LAST_KNOWN_YEAR if not indexed
for cyr in range(fcyr + 1, Policy.LAST_KNOWN_YEAR + 1):
txt += '<br>{}: {}'.format(cyr, final_val)
for vo in param["value"]:
labels = " ".join(
f"{label}={value}" for label, value in vo.items()
if label not in ("year", "value")
)
txt += f"<br>{vo['year']}: {vo['value']} {labels}"
# if not param['indexed']:
# fcyr = int(final_cyr)
# if fcyr < Policy.LAST_KNOWN_YEAR:
# # extrapolate final_val thru Policy.LAST_KNOWN_YEAR if not indexed
# for cyr in range(fcyr + 1, Policy.LAST_KNOWN_YEAR + 1):
# txt += '<br>{}: {}'.format(cyr, final_val)
txt += '<br><i>Valid Range:</i>'
minval = param['valid_values']['min']
maxval = param['valid_values']['max']
txt += ' min = {} and max = {}'.format(minval, maxval)
invalid_action = param.get('invalid_action', 'stop')
txt += '<br><i>Out-of-Range Action:</i> {}'.format(invalid_action)
validators = param.get("validators", None)
if validators:
minval = validators['range']['min']
maxval = validators['range']['max']
txt += ' min = {} and max = {}'.format(minval, maxval)
invalid_action = validators["range"].get('level', 'error')
txt += '<br><i>Out-of-Range Action:</i> {}'.format(invalid_action)
txt += '</p>'
return txt

Expand All @@ -144,6 +145,8 @@ def policy_params(path, text):
section = OrderedDict()
using_other_params_section = False
for pname in params:
if pname == "schema":
continue
param = params[pname]
sec1_sec2 = '{}{}{}'.format(param['section_1'],
concat_str,
Expand All @@ -161,6 +164,8 @@ def policy_params(path, text):
sec2 = split_list[1]
ptext = ''
for pname in params:
if pname == "schema":
continue
param = params[pname]
if sec1 == param['section_1'] and sec2 == param['section_2']:
ptext += policy_param_text(pname, param)
Expand Down Expand Up @@ -233,24 +238,30 @@ def assumption_param_text(pname, ptype, param):
ptype.capitalize())
txt += '<br><i>tc Name:</i> {}'.format(pname)
if sec1:
txt += '<br><i>TB Name:</i> {}'.format(param['long_name'])
txt += '<br><i>TB Name:</i> {}'.format(param['title'])
else:
txt += '<br><i>Long Name:</i> {}'.format(param['long_name'])
txt += '<br><i>Long Name:</i> {}'.format(param['title'])
txt += '<br><i>Description:</i> {}'.format(param['description'])
if param.get('notes', ''):
txt += '<br><i>Notes:</i> {}'.format(param['notes'])
txt += '<br><i>Default Value:</i>'
if param.get('vi_vals', []):
cols = ', '.join(param['vi_vals'])
txt += '<br>&nbsp;&nbsp; for: [{}]'.format(cols)
for cyr, val in zip(param['value_yrs'], param['value']):
txt += '<br>{}: {}'.format(cyr, val)
for vo in param["value"]:
labels = " ".join(
f"{label}={value}" for label, value in vo.items()
if label not in ("year", "value")
)
txt += f"<br>{vo['year']}: {vo['value']} {labels}"
txt += '<br><i>Valid Range:</i>'
minval = param['valid_values']['min']
maxval = param['valid_values']['max']
txt += ' min = {} and max = {}'.format(minval, maxval)
invalid_action = param.get('invalid_action', 'stop')
txt += '<br><i>Out-of-Range Action:</i> {}'.format(invalid_action)
validators = param.get("validators", None)
if validators:
minval = validators['range']['min']
maxval = validators['range']['max']
txt += ' min = {} and max = {}'.format(minval, maxval)
invalid_action = validators["range"].get('level', 'error')
txt += '<br><i>Out-of-Range Action:</i> {}'.format(invalid_action)
txt += '</p>'
return txt

Expand All @@ -267,6 +278,8 @@ def assumption_params(ptype, path, text):
# construct parameter text for each param
ptext = ''
for pname in params:
if pname == "schema":
continue
param = params[pname]
ptext += assumption_param_text(pname, ptype, param)
# integrate parameter text into text
Expand Down
Loading