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

Colton #85

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.2] - 2024-10-10 3:00:00

### Added

- Updated 4 files to remove type errors.

## [0.3.1] - 2024-10-04 12:00:00

### Added
Expand Down Expand Up @@ -225,6 +231,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First prototype version based off of openfisca-us and tax-calculator.


[0.3.2]: https://github.com/TheCGO/fiscalsim-us/compare/v0.3.1...v0.3.2
[0.3.1]: https://github.com/TheCGO/fiscalsim-us/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.9...v0.3.0
[0.2.9]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.8...v0.2.9
Expand Down
7 changes: 6 additions & 1 deletion changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,14 @@
- Updates South Carolina tax logic and tests.
- Replaces Mambaforge Python installer with Miniforge in GH Actions
date: 2024-10-03 02:00:00
- bump: minor
- bump: patch
changes:
added:
- Updates IRS rate threshholds and standard deduction amounts in `parameters.gov.irs.income.bracket.yaml` and in `parameters.gov.irs.deductions.standard.amount.yaml`
- Renames `WIDOW` filer type to `SURVIVING_SPOUSE`
date: 2024-10-04 12:00:00
- bump: patch
changes:
added:
- Updated 4 files to remove type errors.
date: 2024-10-10 3:00:00
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
from fiscalsim_us.model_api import *


class is_older_child_for_medicaid(Variable):
value_type = bool
entity = Person
Expand All @@ -23,16 +24,26 @@
return result
except Exception as e:
print(f"Calculation failed: {str(e)}")
print(f"is_older_child: type={type(is_older_child)}, value={is_older_child}")
print(

Check warning on line 27 in fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py

View check run for this annotation

Codecov / codecov/patch

fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py#L27

Added line #L27 was not covered by tests
f"is_older_child: type={type(is_older_child)}, value={is_older_child}"
)
print(f"income: type={type(income)}, value={income}")
print(f"income_limit: type={type(income_limit)}, value={income_limit}")

print(

Check warning on line 31 in fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py

View check run for this annotation

Codecov / codecov/patch

fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py#L31

Added line #L31 was not covered by tests
f"income_limit: type={type(income_limit)}, value={income_limit}"
)

# Convert to numpy arrays and ensure correct types
is_older_child = np.asarray(is_older_child if is_older_child is not None else False).astype(bool)
income = np.asarray(income if income is not None else 0).astype(float)
income_limit = np.asarray(income_limit if income_limit is not None else 0).astype(float)
is_older_child = np.asarray(

Check warning on line 36 in fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py

View check run for this annotation

Codecov / codecov/patch

fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py#L36

Added line #L36 was not covered by tests
is_older_child if is_older_child is not None else False
).astype(bool)
income = np.asarray(income if income is not None else 0).astype(

Check warning on line 39 in fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py

View check run for this annotation

Codecov / codecov/patch

fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py#L39

Added line #L39 was not covered by tests
float
)
income_limit = np.asarray(

Check warning on line 42 in fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py

View check run for this annotation

Codecov / codecov/patch

fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py#L42

Added line #L42 was not covered by tests
income_limit if income_limit is not None else 0
).astype(float)

# Attempt calculation again
result = is_older_child & (income < income_limit)
print("Calculation succeeded after type conversion")
return result
return result

Check warning on line 49 in fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py

View check run for this annotation

Codecov / codecov/patch

fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py#L49

Added line #L49 was not covered by tests
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
from fiscalsim_us.model_api import *


class is_ptc_eligible(Variable):
value_type = bool
entity = TaxUnit
Expand All @@ -16,8 +17,8 @@ def formula(tax_unit, period, parameters):
add(tax_unit, period, ["has_marketplace_health_coverage"]) > 0
)
income_eligible = eligibility.calc(income_level)

on_marketplace = np.array(on_marketplace, dtype=bool)
income_eligible = np.array(income_eligible, dtype=bool)
return on_marketplace & income_eligible

return on_marketplace & income_eligible
18 changes: 8 additions & 10 deletions fiscalsim_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ def formula(person, period, parameters):
assets = person("ssi_countable_resources", period)
joint_claim = person("ssi_claim_is_joint", period)
p = parameters(period).gov.states.co.ssa.oap

assets = np.array(assets)
joint_claim = np.array(joint_claim, dtype=bool)

asset_limit = np.where(
joint_claim,
p.resources.couple,
p.resources.single
joint_claim, p.resources.couple, p.resources.single
)

below_asset_limit = assets <= asset_limit

age = person("age", period)
in_age_range = p.age_range.calc(age)

in_age_range = np.array(in_age_range, dtype=bool)

below_asset_limit = below_asset_limit.astype(bool)

return below_asset_limit & in_age_range
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from fiscalsim_us.model_api import *
import numpy as np


class co_state_supplement_eligible(Variable):
value_type = bool
entity = Person
Expand All @@ -27,4 +28,4 @@ def formula(person, period, parameters):
in_age_range = np.array(in_age_range).astype(bool)

# Use bitwise & for the final operation
return disabled_or_blind & ssi_eligible & in_age_range
return disabled_or_blind & ssi_eligible & in_age_range
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="fiscalsim-us",
version="0.3.1",
version="0.3.2",
author="Richard W. Evans",
author_email="rick@abundance.institute",
long_description=readme,
Expand Down
Loading