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

Copying TaxBrain reform to Tax-Calculator API #957

Open
MaxGhenis opened this issue Feb 7, 2019 · 1 comment
Open

Copying TaxBrain reform to Tax-Calculator API #957

MaxGhenis opened this issue Feb 7, 2019 · 1 comment

Comments

@MaxGhenis
Copy link
Contributor

Is there an easy way to copy reforms between TaxBrain and the Tax-Calculator API (Python or CLI)? I made a reform in TaxBrain (https://apps.ospc.org/taxbrain/38482) and tried to copy the reform from the top, but since it splits out each element of the MARS array into their own parameters (e.g., _CG_brk3_single), I had to re-create it.

@hdoupe
Copy link
Collaborator

hdoupe commented Feb 7, 2019

Hey Max, you can convert the reform like this:

In [1]: from taxcalc import Calculator

In [2]:             ]
   ...:         },
   ...:         "_AMT_CG_brk3_separate": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_AMT_CG_brk3_headhousehold": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_AMT_CG_rt4": {
   ...:             "2017": [
   ...:                 0.7
   ...:             ]
   ...:         },
   ...:         "_II_brk7_single": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_II_brk7_joint": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_II_brk7_separate": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_II_brk7_headhousehold": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_II_rt8": {
   ...:             "2017": [
   ...:                 0.7
   ...:             ]
   ...:         },
   ...:         "_PT_brk7_single": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_PT_brk7_joint": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_PT_brk7_separate": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_PT_brk7_headhousehold": {
   ...:             "2017": [
   ...:                 10000000.0
   ...:             ]
   ...:         },
   ...:         "_PT_rt8": {
   ...:             "2017": [
   ...:                 0.7
   ...:             ]
   ...:         }
   ...:     }
   ...: }"""

In [3]: spec = Calculator.read_json_param_objects(reform=ref, assump=None)

In [4]: spec
Out[4]: 
{'policy': {2017: {'_CG_rt4': [0.7],
   '_AMT_CG_rt4': [0.7],
   '_II_rt8': [0.7],
   '_PT_rt8': [0.7],
   '_CG_brk3': [[10000000.0, 10000000.0, 10000000.0, 10000000.0, 9e+99]],
   '_AMT_CG_brk3': [[10000000.0, 10000000.0, 10000000.0, 10000000.0, 9e+99]],
   '_II_brk7': [[10000000.0, 10000000.0, 10000000.0, 10000000.0, 9e+99]],
   '_PT_brk7': [[10000000.0, 10000000.0, 10000000.0, 10000000.0, 9e+99]]}},
 'consumption': {},
 'behavior': {},
 'growdiff_baseline': {},
 'growdiff_response': {},
 'growmodel': {}}

In [5]: 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants