Skip to content

Implement Singapore tax-benefit system#5

Open
PavelMakarchuk wants to merge 12 commits intomainfrom
implement-sg-tax-benefit-system
Open

Implement Singapore tax-benefit system#5
PavelMakarchuk wants to merge 12 commits intomainfrom
implement-sg-tax-benefit-system

Conversation

@PavelMakarchuk
Copy link

Summary

  • Implement Singapore's personal income tax with 13 progressive brackets (0-24%), 10+ relief types (earned income, CPF, spouse, child, parent, NSman, SRS, course fees, life insurance, donations), PIT rebates, and non-resident tax handling
  • Add CPF contribution calculations with 5 age bands (employee + employer rates) and 2024-2025 rate updates per official CPF schedule
  • Add social benefit calculations: Workfare Income Supplement (WIS), Silver Support Scheme, GST Voucher cash, CDC vouchers
  • Add property tax calculations for owner-occupied (8 progressive brackets) and non-owner-occupied (4 brackets) properties
  • Add Skills Development Levy (SDL) calculation
  • Total: 59 variables, ~100 parameter files, 29 YAML tests — all sourced from .gov.sg primary sources

Key components

  • Parameters: gov/iras/ (income tax, property tax, GST, stamp duty), gov/cpf/ (contributions, WIS, Silver Support), gov/mof/ (GSTV, CDC), gov/mom/ (SDL)
  • Variables: Input variables (demographics, income, housing, family), formula variables (income tax chain, CPF, benefits)
  • Tests: YAML tests covering income tax (5 cases + 3 integration), CPF contributions (6 age bands), WIS (4 cases), Silver Support (2 cases), GSTV (4 cases), property tax (3 cases)

Primary sources

Test plan

  • All 29 YAML tests pass
  • System loads 59 variables successfully
  • End-to-end simulation verified with manual calculations
  • Code formatted with black (79 char line limit)
  • CI checks pass

🤖 Generated with Claude Code

…al benefits

Add comprehensive implementation covering:
- Personal income tax with 13 progressive brackets (0-24%) and 10+ relief types
- CPF contributions with 5 age bands and 2024-2025 rate updates
- Workfare Income Supplement (WIS) eligibility and benefit calculations
- Silver Support Scheme eligibility and payment calculations
- GST Voucher cash, CDC vouchers, and property tax calculations
- Skills Development Levy (SDL) calculation
- 59 variables and ~100 parameter files sourced from .gov.sg primary sources
- 29 YAML tests covering all calculation chains

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@PavelMakarchuk PavelMakarchuk marked this pull request as ready for review February 25, 2026 23:00
PavelMakarchuk and others added 11 commits February 25, 2026 18:26
…ring

- Add buyer's stamp duty (BSD) with 6 progressive brackets
- Add additional buyer's stamp duty (ABSD) with 7 buyer profile categories
- Add GST calculation on taxable consumption
- Add GST Voucher U-Save rebates with HDB flat-type tiering
- Add ComCare Long-Term Assistance with household-size-based amounts
- Enhance Silver Support with HDB flat-type and income-based tiering
- Add immigration status and buyer profile enums
- Add 21 new tests covering all new calculation chains and edge cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix CPF above-55-to-60 rates: employee 15.5%/17%, employer 15.5%/15.5% (2024/2025)
- Fix CPF above-60-to-65 rates: employee 11.5%, employer 12% for 2025
- Add working mother's child relief (WMCR) with fixed amounts ($8k/$10k/$12k)
- Add grandparent caregiver relief ($3,000)
- Add handicapped sibling relief ($5,500 per sibling)
- Wire all 3 new reliefs into total_personal_reliefs
- Add income per capita ceiling check to Silver Support eligibility
- Add disability age exemption to WIS eligibility
- Add 7 new tests for reliefs, WIS disability, and Silver Support income ceiling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add GST Voucher MediSave top-up with age bands and AV tiering (9 params + 6 tests)
- Add GST Voucher S&CC rebate with HDB flat-type-based months (6 params + 5 tests)
- Add parenthood tax rebate capped at tax after PIT rebate
- Add CPF cash top-up relief for family members
- Wire PTR into income tax calculation chain
- Add GAPS.md tracking all known missing programs and needed adjustments

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Programs added: Baby Bonus, CDA First Step Grant, Childcare Subsidy,
KiFAS, MOE FAS, Edusave, CHAS tier, EHG, FDW Levy, SSD, Assurance
Package Cash, SCFA. Each with parameters, variables, and tests.

Fixes: WIS now uses exact piecewise linear formulas from CPF
calculator for all 4 age bands. NSman relief fixed mutual
exclusivity (max of self vs family) and key_appointment_non_active
parameter corrected to $3,500. WMCR split into pre/post-2024
calculation. Spouse relief now enforces dependant income threshold.

112 variable files, 154 parameters, 122 tests (all passing).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.5: Verified GSTV MediSave has no income ceiling (correct as-is)
1.6: Added clarifying comment to PTR about unused per-child params
1.7: Added comcare_smta_eligible variable (eligibility only, amounts
     are caseworker-assessed) with $800 PCI benchmark
1.8: Added NOTE to silver_support_eligible about CPF savings limitation

Also includes previously uncommitted input variables:
number_of_children_born_before_2024, spouse_income.

All 122 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add root .gitignore for __pycache__, .venv, uv.lock, IDE files
- Add towncrier fragment for CI changelog check
- Update changelog_entry.yaml to reflect full implementation scope

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix cpf_contributions -> cpf_total_contribution in quick start
- Add benefit_units to situation example
- Replace "coming soon" with actual implemented programs
- Remove broken docs/ links (directory doesn't exist)
- Remove outdated roadmap (everything already implemented)
- Add Known Limitations table and link to GAPS.md
- Update citation year and project stats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CDC Vouchers: 3 tests (citizen, mixed household, non-citizen)
- Life insurance relief: 3 tests (below cap, CPF exceeds cap, no premium)
- NSman relief: 5 tests (active, key appointment, wife, mutual exclusivity, not NSman)
- Parent relief: 4 tests (living together, not living, disabled, mixed)
- Skills Development Levy: 4 tests (standard, minimum floor, maximum cap, zero income)

Total tests: 122 -> 141 (all passing)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hardcoded numeric values with parameter references across 11
variable files. Create 25 new parameter YAML files covering age
thresholds, property limits, child tier boundaries, SSD holding
periods, and WIS piecewise linear schedules. Rewrite wis_amount.py
to use np.interp with bracket schedule parameters instead of
hardcoded slope/intercept coefficients.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix WIS property AV ceiling: $21,000 applies from Work Year 2024, not 2025
- Add 2026 AP income threshold update ($34,000 -> $39,000) and higher
  income amount reduction ($200 -> $100)
- Document U-Save quarterly amounts as including AP doubling for FY2025
- Add CPF (Revised WIS Scheme) Regulations S46/2025 reference to all
  16 WIS parameter files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Critical fixes:
- Change sellers_stamp_duty from Person to Household entity for
  consistency with other stamp duties
- Add 2 WMCR pre-2024 test cases exercising rate-based code path
- Fix 13 GSTV Cash/U-Save broken reference URLs (404 -> /am-i-eligible/)
- Fix CHAS references to use specific eligibility page
- Fix FDW standard levy reference to corroborating MOM page
- Update MOE FAS thresholds with 2025 revision ($4,000/$1,000)

Should-address fixes:
- Remove trailing zeros in 5 ABSD/SCC parameter values
- Remove duplicate import in model_api.py
- Fix wrong unit on WIS max_properties (person -> property)
- Add missing reference fields to 3 variables
- Update GSTV reference titles to be descriptive

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant