Skip to content

Commit

Permalink
Merge pull request #48 from Peter-Metz/inputs
Browse files Browse the repository at this point in the history
Reorganize web app inputs
  • Loading branch information
Peter-Metz authored Oct 16, 2020
2 parents a7704ac + b1dec14 commit bcb1ed3
Show file tree
Hide file tree
Showing 14 changed files with 300,277 additions and 180 deletions.
33 changes: 17 additions & 16 deletions cs-config/cs_config/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,33 +142,34 @@ def run_model(meta_params_dict, adjustment):
elif mtr_opt == 'Spouse Earnings':
span = int(ivar[10])
df[10] = increments
elif mtr_opt == 'Qualified Dividends':
span = int(ivar[11])
df[11] = increments
elif mtr_opt == 'Interest Received':
span = int(ivar[12])
df[12] = increments
elif mtr_opt == 'Short Term Gains':
span = int(ivar[13])
df[13] = increments
elif mtr_opt == 'Long Term Gains':
span = int(ivar[14])
df[14] = increments
elif mtr_opt == 'Qualified Dividends':
span = int(ivar[14])
df[11] = increments
elif mtr_opt == 'Interest Received':
span = int(ivar[12])
df[12] = increments
elif mtr_opt == 'Business Income':
span = int(ivar[15])
df[15] = increments
elif mtr_opt == 'Pensions':
span = int(ivar[17])
df[17] = increments
span = int(ivar[21])
df[21] = increments
elif mtr_opt == 'Gross Social Security Benefits':
span = int(ivar[18])
df[18] = increments
span = int(ivar[22])
df[22] = increments
elif mtr_opt == 'Real Estate Taxes Paid':
span = int(ivar[20])
df[20] = increments
elif mtr_opt == 'Mortgage':
span = int(ivar[23])
df[23] = increments
elif mtr_opt == 'Business Income':
span = int(ivar[24])
df[24] = increments
elif mtr_opt == 'Mortgage':
span = int(ivar[27])
df[27] = increments


b = Batch(df)
df_base = b.create_table()
Expand Down
27 changes: 14 additions & 13 deletions docs/INPUT_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ To analyze multiple tax filers, the user must specify a csv file with the filers
13. intrec (interest received)
14. stcg (short term capital gains)
15. ltcg (long term capital gains)
16. otherprop (other property income subject to NIIT)
17. nonprop (other non-property income)
18. pensions (taxable pensions)
19. gssi (gross social security benefits)
20. ui (unemployment insurance received)
21. proptax (real estate taxes paid)
22. otheritem (other itemized deductions subject to SALT cap, e.g. state and local taxes)
23. childcare (child care expenses)
24. mortgage (itemized deductions not subject to SALT cap, e.g., charitable contributions and home mortgage interest)
25. businc (business income)
26. sstb (1 - business income from professional services business; 0 - business income not from professional pervices business)
27. w2paid (W-2 wages paid by business)
28. qualprop (filer's share of qualified property)
16. businc (business income)
17. sstb (1 - business income from professional services business; 0 - business income not from professional pervices business)
18. w2paid (W-2 wages paid by business)
19. qualprop (filer's share of qualified property)
20. otherprop (other property income subject to NIIT)
21. nonprop (other non-property income)
22. pensions (taxable pensions)
23. gssi (gross social security benefits)
24. ui (unemployment insurance received)
25. proptax (real estate taxes paid)
26. otheritem (other itemized deductions subject to SALT cap, e.g. state and local taxes)
27. childcare (child care expenses)
28. mortgage (itemized deductions not subject to SALT cap, e.g., charitable contributions and home mortgage interest)


For example, a 50-year old single filer with 3 dependents under 13 who makes $50,000 per year could be represented by the following:

Expand Down
4 changes: 2 additions & 2 deletions docs/example_input.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
1,2019,1,50,0,2,1,2,2,160000,0,4500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2,2019,2,38,0,3,2,3,3,35000,12500,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
3,2019,1,58,0,0,0,0,0,70000,0,10000,0,0,0,0,0,0,0,0,0,0,0,0,100000,1,0,0
3,2019,1,58,0,0,0,0,0,70000,0,10000,0,0,0,100000,1,0,0,0,0,0,0,0,0,0,0,0
4,2019,2,44,0,3,1,3,3,80000,43000,1200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5,2019,2,27,0,1,1,1,1,250000,0,1200,0,0,0,0,0,0,0,0,0,0,0,0,50000,0,0,0
5,2019,2,27,0,1,1,1,1,250000,0,1200,0,0,0,50000,0,0,0,0,0,0,0,0,0,0,0,0
6,2019,2,19,0,0,0,0,0,11000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
7,2019,1,48,0,2,2,2,2,39000,0,250,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
69 changes: 36 additions & 33 deletions taxcrunch/cruncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ def batch_inputs(self, ivar):
# Single -> 1; Joint -> 2
mstat_int = np.where(mstat == "Single", 1, 2)
# convert sstb to int
sstb = ivar.loc[:, 25]
sstb = ivar.loc[:, 16]
# True -> 1; False -> 0
sstb_int = np.where(sstb, 1, 0)
self.batch_ivar.loc[:, 2] = mstat_int
self.batch_ivar.loc[:, 25] = sstb_int
self.batch_ivar.loc[:, 16] = sstb_int
return self.batch_ivar

def translate(self, ivar):
Expand Down Expand Up @@ -158,29 +158,31 @@ def translate(self, ivar):
self.invar["e00300"] = ivar.loc[:, 12]
self.invar["p22250"] = ivar.loc[:, 13]
self.invar["p23250"] = ivar.loc[:, 14]
e02000 = ivar.loc[:, 15]
self.invar["e00800"] = ivar.loc[:, 16]
self.invar["e01700"] = ivar.loc[:, 17]
self.invar["e01500"] = self.invar["e01700"]
self.invar["e02400"] = ivar.loc[:, 18]
self.invar["e02300"] = ivar.loc[:, 19]
# no Tax-Calculator use of TAXSIM variable 22, non-taxable transfers
# no Tax-Calculator use of TAXSIM variable 23, rent paid
self.invar["e18500"] = ivar.loc[:, 20]
self.invar["e18400"] = ivar.loc[:, 21]
self.invar["e32800"] = ivar.loc[:, 22]
self.invar["e19200"] = ivar.loc[:, 23]
self.invar["e26270"] = ivar.loc[:, 24]
# e26270 is included in e02000
self.invar["e02000"] = self.invar["e26270"] + e02000
sstb_bool = ivar.loc[:, 25]
self.invar["e26270"] = ivar.loc[:, 15]
sstb_bool = ivar.loc[:, 16]
# convert both Cruncher and Batch inputs (i.e. True/False and 0/1
self.invar["PT_SSTB_income"] = np.where(
np.logical_or(sstb_bool, sstb_bool == 1), 1, 0
)
self.invar["PT_binc_w2_wages"] = ivar.loc[:, 26]
self.invar["PT_ubia_property"] = ivar.loc[:, 27]
self.invar["PT_binc_w2_wages"] = ivar.loc[:, 17]
self.invar["PT_ubia_property"] = ivar.loc[:, 18]

e02000 = ivar.loc[:, 19]
self.invar["e00800"] = ivar.loc[:, 20]
self.invar["e01700"] = ivar.loc[:, 21]
self.invar["e01500"] = self.invar["e01700"]
self.invar["e02400"] = ivar.loc[:, 22]
self.invar["e02300"] = ivar.loc[:, 23]
# no Tax-Calculator use of TAXSIM variable 22, non-taxable transfers
# no Tax-Calculator use of TAXSIM variable 23, rent paid
self.invar["e18500"] = ivar.loc[:, 24]
self.invar["e18400"] = ivar.loc[:, 25]
self.invar["e32800"] = ivar.loc[:, 26]
self.invar["e19200"] = ivar.loc[:, 27]

# e26270 is included in e02000
self.invar["e02000"] = self.invar["e26270"] + e02000

return self.invar

def choose_mtr(self):
Expand All @@ -200,33 +202,34 @@ def choose_mtr(self):
elif self.mtr_options == "Spouse Earnings":
self.ivar2.loc[:, 10] = self.ivar2.loc[:, 10] + 1
return self.ivar2, "e00200s"
elif self.mtr_options == "Short Term Gains":
self.ivar2.loc[:, 13] = self.ivar2.loc[:, 13] + 1
return self.ivar2, "p22250"
elif self.mtr_options == "Long Term Gains":
self.ivar2.loc[:, 14] = self.ivar2.loc[:, 14] + 1
return self.ivar2, "p23250"
elif self.mtr_options == "Qualified Dividends":
self.ivar2.loc[:, 11] = self.ivar2.loc[:, 11] + 1
return self.ivar2, "e00650"
elif self.mtr_options == "Interest Received":
self.ivar2.loc[:, 12] = self.ivar2.loc[:, 12] + 1
return self.ivar2, "e00300"
elif self.mtr_options == "Short Term Gains":
self.ivar2.loc[:, 13] = self.ivar2.loc[:, 13] + 1
return self.ivar2, "p22250"
elif self.mtr_options == "Long Term Gains":
self.ivar2.loc[:, 14] = self.ivar2.loc[:, 14] + 1
return self.ivar2, "p23250"
elif self.mtr_options == "Business Income":
self.ivar2.loc[:, 15] = self.ivar2.loc[:, 15] + 1
return self.ivar2, "e26270"
elif self.mtr_options == "Pensions":
self.ivar2.loc[:, 17] = self.ivar2.loc[:, 17] + 1
self.ivar2.loc[:, 21] = self.ivar2.loc[:, 21] + 1
return self.ivar2, "e01700"
elif self.mtr_options == "Gross Social Security Benefits":
self.ivar2.loc[:, 18] = self.ivar2.loc[:, 18] + 1
self.ivar2.loc[:, 22] = self.ivar2.loc[:, 22] + 1
return self.ivar2, "e02400"
elif self.mtr_options == "Real Estate Taxes Paid":
self.ivar2.loc[:, 20] = self.ivar2.loc[:, 20] + 1
self.ivar2.loc[:, 24] = self.ivar2.loc[:, 24] + 1
return self.ivar2, "e18500"
elif self.mtr_options == "Mortgage":
self.ivar2.loc[:, 23] = self.ivar2.loc[:, 23] + 1
self.ivar2.loc[:, 27] = self.ivar2.loc[:, 27] + 1
return self.ivar2, "e19200"
elif self.mtr_options == "Business Income":
self.ivar2.loc[:, 24] = self.ivar2.loc[:, 24] + 1
return self.ivar2, "e00900p"


def choose_baseline(self):
"""
Expand Down
Loading

0 comments on commit bcb1ed3

Please sign in to comment.