Skip to content

Commit

Permalink
Merge pull request #85 from rickecon/colton
Browse files Browse the repository at this point in the history
Merging
  • Loading branch information
rickecon authored Oct 10, 2024
2 parents c7942a5 + 2c5ca7a commit 9cfa419
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 23 deletions.
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 @@ def formula(person, period, parameters):
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(
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(
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(
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)

# Attempt calculation again
result = is_older_child & (income < income_limit)
print("Calculation succeeded after type conversion")
return result
return result
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

0 comments on commit 9cfa419

Please sign in to comment.