Skip to content
PolicyEnginePublic

Latest commit

 

History

145 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ACA Premium Tax Credit Calculator

Compare 2026 Premium Tax Credits with and without Inflation Reduction Act (IRA) enhancements.

🔗 Try the Calculator

Overview

The Inflation Reduction Act enhanced ACA subsidies through 2025. This calculator shows what your credits would be in 2026 with and without extending these enhancements.

Key Differences:

  • With IRA Extension: No income cap, lower premium contributions (0-8.5% of income)
  • After IRA Expires: 400% FPL cap ("subsidy cliff"), higher contributions (2-9.5% of income)

Quick Start

Use the Live App

Visit https://policyengine.org/us/aca-calc to use the calculator immediately.

Run Locally

# Install dependencies
pip install -r requirements.txt

# Run the app
streamlit run app.py

The app will open at http://localhost:8501

Features

  • ✅ All 50 States + DC: Accurate calculations for every jurisdiction
  • ✅ 3,143 Counties: County-specific marketplace pricing
  • ✅ Real-time Comparison: Side-by-side baseline vs. IRA extension
  • ✅ Interactive Charts: See how credits change across income levels
  • ✅ Household Flexibility: Single, married, with/without dependents

Example Results

Scenario Income Baseline PTC With IRA Savings
NJ Family of 3 $50,000 $8,515 $10,626 $2,111/year
TX Couple (Travis) $60,000 $6,974 $9,195 $2,221/year
CA Couple + Child $75,000 $12,913 $15,695 $2,782/year
NY Single @ 400% FPL $62,280 $0 $2,899 $2,899/year

Technical Details

Built with:

County data sourced from PolicyEngine's ACA rating areas database.

Project Structure

.
├── app.py                  # Main Streamlit application
├── counties.json           # County data for all states
├── process_counties.py     # County data processor
├── requirements.txt        # Python dependencies
├── tests/                  # Test files
├── notebooks/              # Analysis notebooks
└── archive/                # Historical files

Development

The optional /api/explain endpoint uses claude-sonnet-5-5 with low effort and requires ANTHROPIC_API_KEY. Run its regression tests without provider credentials or network calls (FastAPI is installed separately in deployment):

uv sync --locked --extra dev
uv run --locked --with fastapi pytest tests/test_api_explain.py -v
# Run tests
python tests/test_reform_verification.py

# Update county data
python process_counties.py

Deploying the API

The calculator page calls a FastAPI backend on Modal: app aca-calc-api in the main environment of PolicyEngine's Modal workspace, defined in modal_app.py. The Modal API workflow (.github/workflows/modal-api.yml) runs the API tests against the image's pinned packages on pull requests that touch the backend. When such a change merges to main, it deploys the app and smoke-tests /api/health, both calculator endpoints (/api/calculate-stream, which the page calls, and /api/calculate, its fallback) and /api/explain. The calculator checks set skip_cache, which makes both endpoints compute a new answer without reading or writing the 7-day cache, and the stream check confirms that the new code computed its answer. Modal can keep sending requests to the previous version's warm containers for a while after a deploy, so the API names the commit a CI deploy came from on every response (X-ACA-API-Commit), and each check waits until the merged commit's containers answer it. If a calculator check fails, the workflow rolls the app back to the previous version.

The image installs the exact package versions in modal-requirements.txt, captured from the container that served the calculator before this workflow existed. Change a pin only with a test of the new set and a comparison of /api/calculate results.

To deploy or roll back by hand (needs access to PolicyEngine's Modal workspace):

uvx --from modal==1.4.2 modal deploy --env main modal_app.py
uvx --from modal==1.4.2 modal app history aca-calc-api --env main
uvx --from modal==1.4.2 modal app rollback aca-calc-api --env main

Each /api/explain request that misses the 7-day explanation cache calls the Anthropic API on PolicyEngine's account.

License

Open source - see PolicyEngine US license for underlying calculations.

Credits

Calculations powered by PolicyEngine US

Releases

Packages

Contributors

Languages