diff --git a/changelog.d/aca-2027-calculator.added.md b/changelog.d/aca-2027-calculator.added.md new file mode 100644 index 0000000..e80f2a0 --- /dev/null +++ b/changelog.d/aca-2027-calculator.added.md @@ -0,0 +1 @@ +Compare 2027 coverage under current law and under H.R. 1834 in the calculator, with 2026 current law alongside: what the household pays for the benchmark plan after the credit, the credit itself, and both at an income the user enters. diff --git a/changelog.d/aca-2027-calculator.removed.md b/changelog.d/aca-2027-calculator.removed.md new file mode 100644 index 0000000..32e3269 --- /dev/null +++ b/changelog.d/aca-2027-calculator.removed.md @@ -0,0 +1 @@ +Drop the year setting and the other scenarios (the 700% FPL bill and CRFB's two bracket options) from the calculator page; old links still load their household. diff --git a/src/App.jsx b/src/App.jsx index dee304b..2a1f577 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -322,9 +322,9 @@ function App() { {!embedded && (
-

ACA Premium Tax Credits: 2025 vs 2026

+

ACA Premium Tax Credits

- Modeling how the scheduled expiration of IRA enhancements affects health insurance costs + How the expiration of the enhanced credits, and proposals to extend them, affect health insurance costs

)}
@@ -402,12 +410,10 @@ function Calculator() { income: results.income, ptc_baseline: results.ptc_baseline, ptc_ira: results.ptc_ira, - ptc_700fpl: results.ptc_700fpl, - ptc_additional_bracket: results.ptc_additional_bracket, - ptc_simplified_bracket: results.ptc_simplified_bracket, medicaid: results.medicaid, chip: results.chip, fpl: results.fpl, + year: results.year, }} householdDescription={aiExplanation.household_description} onClose={() => setAiExplanation(null)} diff --git a/src/components/CalculatorForm.jsx b/src/components/CalculatorForm.jsx index 114d7e1..dfb0a6a 100644 --- a/src/components/CalculatorForm.jsx +++ b/src/components/CalculatorForm.jsx @@ -10,6 +10,10 @@ const STATES = [ "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY", "DC", ]; +// Every calculation is for 2027 coverage under current law and under H.R. +// 1834, with 2026 current law alongside. +export const YEAR = 2027; + const STATE_NAMES = { AL: "Alabama", AK: "Alaska", AZ: "Arizona", AR: "Arkansas", CA: "California", CO: "Colorado", CT: "Connecticut", DE: "Delaware", FL: "Florida", GA: "Georgia", @@ -52,10 +56,6 @@ const buildShareableUrl = (formData, includeAi = false) => { if (formData.zip_code) { params.set("zip", formData.zip_code); } - if (!formData.show_ira) params.set("ira", "0"); - if (!formData.show_700fpl) params.set("700fpl", "0"); - if (formData.show_additional_bracket) params.set("additional", "1"); - if (formData.show_simplified_bracket) params.set("simplified", "1"); if (includeAi) params.set("ai", "1"); const baseUrl = window.location.origin + window.location.pathname; @@ -81,6 +81,8 @@ const getFormDataFromUrl = () => { const depsStr = params.get("deps"); const dependentAges = depsStr ? depsStr.split(",").map(a => parseInt(a, 10)).filter(a => !isNaN(a)) : []; + // Links from before the calculator compared fixed scenarios also carry a + // year and scenario choices; only the household is read. return { age_head: parseInt(params.get("age"), 10) || 40, age_spouse: parseInt(params.get("spouse"), 10) || 40, @@ -90,10 +92,6 @@ const getFormDataFromUrl = () => { state: STATES.includes(state) ? state : "", county: county, zip_code: params.get("zip") || "", - show_ira: params.get("ira") !== "0", - show_700fpl: params.get("700fpl") !== "0", - show_additional_bracket: params.get("additional") === "1", - show_simplified_bracket: params.get("simplified") === "1", }; }; @@ -123,10 +121,6 @@ const getInitialFormData = () => { state: defaults.state, county: defaults.county, zip_code: "", - show_ira: true, - show_700fpl: true, - show_additional_bracket: false, - show_simplified_bracket: false, }; }; @@ -224,16 +218,15 @@ function CalculatorForm({ onCalculate, loading }) { const depAges = formData.dependent_ages.slice(0, numDeps).map(age => age === "" ? 10 : age); const submitData = { + year: YEAR, age_head: ageHead, age_spouse: formData.married ? ageSpouse : null, dependent_ages: depAges, state: formData.state, county: formData.county, zip_code: formData.zip_code || null, - show_ira: formData.show_ira, - show_700fpl: formData.show_700fpl, - show_additional_bracket: formData.show_additional_bracket, - show_simplified_bracket: formData.show_simplified_bracket, + show_ira: true, + show_prior_year: true, }; // Update form with normalized values @@ -408,84 +401,11 @@ function CalculatorForm({ onCalculate, loading }) { )} - {/* Policy Scenarios */} -
-

Policy Scenarios

- -
- -
- -
- -
- -
- -
- -
- -
-
-
@@ -504,10 +424,6 @@ function CalculatorForm({ onCalculate, loading }) { {shareMessage && {shareMessage}}
- - {!formData.show_ira && !formData.show_700fpl && !formData.show_additional_bracket && !formData.show_simplified_bracket && ( -

Please select at least one policy scenario

- )} ); } diff --git a/src/components/CalculatorResults.jsx b/src/components/CalculatorResults.jsx index 15358f2..9e19c96 100644 --- a/src/components/CalculatorResults.jsx +++ b/src/components/CalculatorResults.jsx @@ -1,168 +1,184 @@ -import { useState, useMemo, useEffect } from "react"; -import HealthBenefitsChart from "./HealthBenefitsChart"; +import { useState, useMemo } from "react"; +import PremiumChart from "./PremiumChart"; import "./Calculator.css"; +const TABS = [ + { id: "net", label: "What You'd Pay" }, + { id: "credit", label: "Premium Tax Credits" }, + { id: "impact", label: "Your Household" }, +]; + +const formatCurrency = (value) => + new Intl.NumberFormat("en-US", { + style: "currency", + currency: "USD", + maximumFractionDigits: 0, + }).format(value); + +// A monthly change in what the household pays, such as "+$12/month". +const formatChange = (monthly) => { + const rounded = Math.round(monthly); + if (rounded === 0) return "No change"; + return `${rounded > 0 ? "+" : "−"}${formatCurrency(Math.abs(rounded))}/month`; +}; + +// Linear interpolation of an array along the income axis. +const interpolate = (income, incomeArray, values) => { + if (!incomeArray || !values || income <= 0) return 0; + let i = 0; + while (i < incomeArray.length - 1 && incomeArray[i + 1] < income) { + i++; + } + if (i >= incomeArray.length - 1) { + return values[values.length - 1]; + } + const x0 = incomeArray[i]; + const x1 = incomeArray[i + 1]; + if (x1 === x0) return values[i]; + return values[i] + ((values[i + 1] - values[i]) * (income - x0)) / (x1 - x0); +}; + +const closestIndex = (income, incomeArray) => { + let closest = 0; + for (let i = 0; i < incomeArray.length; i++) { + if (Math.abs(incomeArray[i] - income) < Math.abs(incomeArray[closest] - income)) { + closest = i; + } + } + return closest; +}; + function CalculatorResults({ data, formData }) { - const [activeTab, setActiveTab] = useState("gain"); + const [activeTab, setActiveTab] = useState("net"); const [userIncome, setUserIncome] = useState(""); - // Determine which reforms were actually calculated - const selectedReforms = useMemo(() => ({ - ira: formData?.show_ira ?? true, - fpl700: formData?.show_700fpl ?? false, - additionalBracket: formData?.show_additional_bracket ?? false, - simplifiedBracket: formData?.show_simplified_bracket ?? false, - }), [formData]); + // An answer from before the API took a year is for 2026. + const year = data?.year || 2026; + // A server that predates the year setting answers for 2026 whatever is asked. + const requestedYear = formData?.year; + const yearMismatch = Boolean(requestedYear) && requestedYear !== year; + const hasPrior = Boolean(data?.ptc_prior_year?.length); - const [visibleLines, setVisibleLines] = useState({ - baseline: true, - ira: true, - fpl700: false, - additionalBracket: false, - simplifiedBracket: false, - }); - - // Sync visibleLines with selectedReforms when formData changes - useEffect(() => { - setVisibleLines({ - baseline: true, - ira: selectedReforms.ira, - fpl700: selectedReforms.fpl700, - additionalBracket: selectedReforms.additionalBracket, - simplifiedBracket: selectedReforms.simplifiedBracket, + // Annual amounts at the income entered, for each scenario. + const userResults = useMemo(() => { + const income = parseFloat(userIncome) || 0; + if (!data || income <= 0) return null; + const at = (values) => interpolate(income, data.income, values); + const scenario = (benchmark, credit) => ({ + benchmark, + credit, + net: Math.max(0, benchmark - credit), }); - }, [selectedReforms]); - - const toggleLine = (line) => { - setVisibleLines(prev => ({ ...prev, [line]: !prev[line] })); - }; - - // Format data for HealthBenefitsChart - const chartData = useMemo(() => { - if (!data) return null; + const index = closestIndex(income, data.income); return { - income: data.income, - ptc_baseline: data.ptc_baseline, - ptc_ira: data.ptc_ira, - ptc_700fpl: data.ptc_700fpl, - ptc_additional_bracket: data.ptc_additional_bracket, - ptc_simplified_bracket: data.ptc_simplified_bracket, - medicaid: data.medicaid, - chip: data.chip, - fpl: data.fpl, + income, + fplPct: (income / data.fpl) * 100, + onMedicaid: data.medicaid?.[index] > 0, + onChip: data.chip?.[index] > 0, + prior: hasPrior ? scenario(at(data.slcsp_by_income_prior_year), at(data.ptc_prior_year)) : null, + current: scenario(at(data.slcsp_by_income), at(data.ptc_baseline)), + revived: scenario(at(data.slcsp_by_income), at(data.ptc_ira)), }; - }, [data]); - - // Interpolate PTC value at user's income - const interpolatePTC = (income, incomeArray, ptcArray) => { - if (!incomeArray || !ptcArray || income <= 0) return 0; - - // Find surrounding points - let i = 0; - while (i < incomeArray.length - 1 && incomeArray[i + 1] < income) { - i++; + }, [userIncome, data, hasPrior]); + + const cards = userResults + ? [ + userResults.prior && { + key: "prior", + title: `${year - 1}, current law`, + values: userResults.prior, + }, + { + key: "baseline", + title: `${year}, current law`, + values: userResults.current, + change: userResults.prior && { + monthly: (userResults.current.net - userResults.prior.net) / 12, + from: `from ${year - 1}`, + }, + }, + { + key: "ira", + title: `${year}, H.R. 1834`, + values: userResults.revived, + change: { + monthly: (userResults.revived.net - userResults.current.net) / 12, + from: "from current law", + }, + }, + ].filter(Boolean) + : []; + + const explanation = () => { + const { fplPct, onMedicaid, onChip, prior, current, revived } = userResults; + const fpl = fplPct.toFixed(0); + const monthly = (annual) => `${formatCurrency(annual / 12)}/month`; + + if (onMedicaid || onChip) { + const programs = [onMedicaid && "Medicaid", onChip && "CHIP"].filter(Boolean).join(" and "); + return ( +

+ At {fpl}% FPL, your household would be covered by {programs}. + Premium tax credits are not available to people eligible for these programs. +

+ ); } - if (i >= incomeArray.length - 1) { - return ptcArray[ptcArray.length - 1]; + if (fplPct < 100 && current.credit <= 0 && revived.credit <= 0) { + return ( +

+ At {fpl}% FPL, you fall into the coverage gap. Your state has not + expanded Medicaid, so adults at this income don't qualify, and premium tax credits + start at 100% FPL. +

+ ); } - // Linear interpolation - const x0 = incomeArray[i]; - const x1 = incomeArray[i + 1]; - const y0 = ptcArray[i]; - const y1 = ptcArray[i + 1]; - - if (x1 === x0) return y0; - return y0 + (y1 - y0) * (income - x0) / (x1 - x0); - }; - - // Calculate values at user's income - const userResults = useMemo(() => { - const income = parseFloat(userIncome) || 0; - if (!data) return null; - - // Find closest index for medicaid/chip lookup - const findClosestIndex = (targetIncome, incomeArray) => { - if (!incomeArray || targetIncome <= 0) return 0; - let closest = 0; - let minDiff = Infinity; - for (let i = 0; i < incomeArray.length; i++) { - const diff = Math.abs(incomeArray[i] - targetIncome); - if (diff < minDiff) { - minDiff = diff; - closest = i; - } - } - return closest; - }; - - const closestIdx = findClosestIndex(income, data.income); - const onMedicaid = data.medicaid?.[closestIdx] > 0; - const onChip = data.chip?.[closestIdx] > 0; - - // At 0 income, check actual medicaid status - if (income <= 0) { - return { - income: 0, - baseline: 0, - ira: 0, - fpl700: 0, - additionalBracket: 0, - simplifiedBracket: 0, - iraGain: 0, - fpl700Gain: 0, - additionalBracketGain: 0, - simplifiedBracketGain: 0, - fplPct: 0, - onMedicaid: data.medicaid?.[0] > 0, - onChip: data.chip?.[0] > 0, - }; + if (current.credit <= 0 && fplPct > 400) { + return ( +

+ At {fpl}% FPL, your household is above current law's 400% FPL limit, so + it gets no credit and pays the whole benchmark premium: {monthly(current.benchmark)} in {year} + {prior && <>, against {monthly(prior.benchmark)} in {year - 1}}.{" "} + {revived.credit > 0 + ? `H.R. 1834 would limit what it pays for the benchmark plan to 8.5% of income, a credit of ${monthly(revived.credit)}.` + : "Under H.R. 1834 it would get no credit either: the benchmark plan costs less than 8.5% of its income."} +

+ ); } - const baseline = interpolatePTC(income, data.income, data.ptc_baseline); - const ira = interpolatePTC(income, data.income, data.ptc_ira); - const fpl700 = interpolatePTC(income, data.income, data.ptc_700fpl); - const additionalBracket = interpolatePTC(income, data.income, data.ptc_additional_bracket); - const simplifiedBracket = interpolatePTC(income, data.income, data.ptc_simplified_bracket); - const fplPct = (income / data.fpl) * 100; - - return { - income, - baseline, - ira, - fpl700, - additionalBracket, - simplifiedBracket, - iraGain: ira - baseline, - fpl700Gain: fpl700 - baseline, - additionalBracketGain: additionalBracket - baseline, - simplifiedBracketGain: simplifiedBracket - baseline, - fplPct, - onMedicaid, - onChip, - }; - }, [userIncome, data]); + if (current.credit > 0) { + return ( +

+ At {fpl}% FPL, current law limits what your household pays for the benchmark plan to a + share of its income, and the credit pays the rest, so the credit grows when premiums do. + Your household would pay {monthly(current.net)} in {year} + {prior && <>, against {monthly(prior.net)} in {year - 1}}. H.R. 1834 would lower its + share of income, to {monthly(revived.net)}. +

+ ); + } - // Format currency - const formatCurrency = (value) => { - return new Intl.NumberFormat("en-US", { - style: "currency", - currency: "USD", - maximumFractionDigits: 0, - }).format(value); + return ( +

+ At {fpl}% FPL, the benchmark plan costs less than the share of income current law asks your + household to pay, so it gets no credit.{" "} + {revived.credit > 0 + ? `H.R. 1834 would lower that share, giving a credit of ${monthly(revived.credit)}.` + : "H.R. 1834 wouldn't give it a credit either."} +

+ ); }; - const tabs = [ - { id: "gain", label: "Gain from Reform" }, - { id: "comparison", label: "Baseline vs Extension" }, - { id: "impact", label: "Your Impact" }, - ]; - return (
+ {yearMismatch && ( +

+ These results are for {year}: the calculator's server doesn't support {requestedYear} yet. +

+ )}
- {tabs.map(tab => ( + {TABS.map((tab) => (