-
Notifications
You must be signed in to change notification settings - Fork 182
/
Copy pathfiling_status.py
37 lines (32 loc) · 1.08 KB
/
filing_status.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from policyengine_us.model_api import *
class FilingStatus(Enum):
SINGLE = "Single"
JOINT = "Joint"
SEPARATE = "Separate"
HEAD_OF_HOUSEHOLD = "Head of household"
SURVIVING_SPOUSE = "Surviving spouse"
class filing_status(Variable):
value_type = Enum
entity = TaxUnit
possible_values = FilingStatus
default_value = FilingStatus.SINGLE
definition_period = YEAR
label = "Filing status for the tax unit"
def formula(tax_unit, period, parameters):
person = tax_unit.members
is_separated = tax_unit.any(person("is_separated", period))
return select(
[
is_separated,
tax_unit("tax_unit_married", period),
tax_unit("surviving_spouse_eligible", period),
tax_unit("head_of_household_eligible", period),
],
[
FilingStatus.SEPARATE,
FilingStatus.JOINT,
FilingStatus.SURVIVING_SPOUSE,
FilingStatus.HEAD_OF_HOUSEHOLD,
],
default=FilingStatus.SINGLE,
)