Skip to content

Add a Local impact page with county and district Marketplace enrollment - #41

Draft
DTrim99 wants to merge 50 commits into
mainfrom
local-marketplace-impact
Draft

DTrim99 wants to merge 50 commits into
mainfrom
local-marketplace-impact

Conversation

@DTrim99

@DTrim99 DTrim99 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

This carries over the Local impact view from @daphnehanse11's #24, rebuilt on #37's app. #24's Streamlit removal already merged in #36, so only the new page comes across. Daphne is a co-author on the commit, and her original commits stay on codex/local-impact (2617fae).

  • Local impact tab, between Calculator and Methodology. Pick a state and county to see its 2026 Marketplace plan selections, consumers with advance credits, average advance credit, and average premium after the credit.
  • District map of average paid premium, consumers with advance credits and consumers without them, by 119th Congress district.
  • Data: compact extracts of CMS's 2026 open enrollment county file (2,052 counties in the 30 HealthCare.gov states), and those counties allocated to 218 districts by population share. The Python loaders and ingest scripts that build them come with their tests.
  • States with their own marketplace stay selectable but show a note instead of figures, because CMS doesn't publish their county data.

Stacked on #37

The base is aca-2027-overview. The repo doesn't delete branches on merge, so retarget this to main by hand after #37 merges.

Before this leaves draft

Changes from #24

Checks

  • bun run build passes, including the data check.
  • I rendered the page in a simulated browser (jsdom), not yet in a real one. Travis County, Texas, shows 184,355 plan selections, 162,349 consumers with advance credits, a $562/month average credit and a $130/month average paid premium. California shows the state-based marketplace note, the district map draws, and React logs no errors.
  • The 14 carried-over Python tests pass. On Windows they need UTF-8 mode (PYTHONUTF8=1), because one fixture writes a byte-order mark with the default encoding.

🤖 Generated with Claude Code

DTrim99 and others added 30 commits November 7, 2026 19:01
- Requests take a year, 2026 or 2027 (2026 if absent, so the live page's
  answers don't change), and every period, the household and both cache
  keys follow it. Responses report the year, the guideline's year and the
  policyengine-us version.
- The FPL the API reports is now the prior year's guideline, the one the
  credit uses, and the household's state is set for that year too, so
  Alaska and Hawaii households get their own guideline for it.
- One scenario table drives both calculator endpoints. New: the enhanced
  schedule capped at 700% FPL, and the enhanced schedule with a $5 minimum
  premium, which returns a 400 until policyengine-us models it (#10681).
  H.R. 1834's reform ends in 2028, as the bill does.
- Responses include the benchmark premium at each income.
- The AI explanation prompt takes the year and names the new scenarios.
- Pin policyengine-us 2.105.0 (policyengine-core 3.34.9, spm-calculator
  1.1.0), give the Modal function 4 GB, and smoke-test a 2027 answer after
  each deploy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…remium

2.115.0 is the first release with the published 2027 premiums
(policyengine-us #10682) and the minimum premium reform (#10681), so the $5
minimum premium scenario now runs. The tests check that it leaves $60 a year
where H.R. 1834's credit covers the whole benchmark and matches H.R. 1834
where the household pays more, and that a model without it still gets a 400
that says so. Its requirements are those of 2.105.0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- A coverage year setting, 2027 by default with 2026 selectable, sent to the
  API and kept in share links (year=).
- H.R. 1834 replaces the "IRA Extension" label, and the enhanced credits
  capped at 700% FPL (a January 2026 draft variant) join the scenarios. The $5
  minimum premium variant is built but hidden behind MIN_PREMIUM_AVAILABLE
  until the API's policyengine-us models it. Each description says the
  proposal's status.
- Each result card shows what the benchmark plan costs after its credit,
  from the API's benchmark premium at each income.
- Current law is labeled with the year, the browser cache key includes the
  year and a model version, and the page header no longer says 2025 vs 2026.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Until the backend that takes a year is deployed, the API answers for 2026
whatever the page asks. The results already label the year the answer
reports; a notice now says when that isn't the year requested.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The API now pins policyengine-us 2.115.0, which models it, so the checkbox
shows, and the browser cache key names that version.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…om data

- The precompute scripts write src/data/, where the site reads, and the
  .gitignore rule that hid any data/ folder now covers only the root's.
- precompute_cliff_household.py: the example household at one income in
  2025 (enhanced credits), 2026 and 2027 (current law) and under H.R. 1834
  and the 700% FPL bill in 2027; the charts show 2027.
- precompute_households.py: the Explore households for 2027, without the
  net income runs no chart used.
- precompute_contribution_schedules.py (new): the contribution schedules as
  policyengine-us computes them, which the schedule chart now draws instead
  of rates typed into it (its 700% FPL bill line disagreed with the model).
- The Overview's figures, the cliff table and the Explore narratives' income
  limits come from that data; the Texas narrative no longer says H.R. 1834
  covers incomes below 100% FPL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The three precompute scripts, run on Modal with the API image's packages.
2027 premiums here are still 2026's trended forward; rerun the scripts
after the release with policyengine-us #10682 is pinned. The site reads
only the combined household file, so the script stops writing the
per-household copies, and the three tracked ones go.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
policyengine-us 2.115.0 has the published 2027 premiums (policyengine-us
#10682), so the pages' 2027 figures are no longer 2026's premiums trended
forward. The three precompute scripts ran on Modal with the API image's
packages.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The calculator now compares 2027 current law with H.R. 1834 and shows 2026
current law beside them, so the January 2026 draft variants (the 700% FPL
cap and the $5 minimum premium) go. A 2027 request with show_prior_year
also gets 2026 current law for the same household and incomes:
ptc_prior_year, slcsp_by_income_prior_year and fpl_prior_year. The smoke
test asks for it, and the explanation prompt uses it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The calculator now makes one comparison: 2027 coverage under current law
and under H.R. 1834, with 2026 current law alongside. The year setting and
the scenario checkboxes go; old links still load their household.

- What You'd Pay charts the benchmark plan after the credit by income, and
  Premium Tax Credits the credit, for the three scenarios (PremiumChart).
- Your Household shows, at the income entered, each scenario's benchmark
  premium, credit and net premium, and the changes from 2026 and from
  current law.
- HealthBenefitsChart goes back to main's version, keeping only the wording
  ("current law", "H.R. 1834") and the chart year in its title; the
  Overview still uses it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… 1834

The Overview's data now covers what the page tells: premiums in 2026 and
2027 under current law, and 2027 if H.R. 1834 revived the enhanced
credits. The 2025 rows and the 700% FPL bill go.

- precompute_cliff_household.py: the Pennsylvania example in 2026 and 2027
  and under H.R. 1834, with its income sweeps named as the calculator API
  names them.
- precompute_households.py: four example households at one income each
  (examples.json), replacing the Explore Households data.
- precompute_contribution_schedules.py: current law for 2026 and 2027 and
  the enhanced schedule.

Run on Modal with policyengine-us 2.115.0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The chart's title already names what it shows; the longer label could run
past a short chart.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ACA_API_APP_NAME names the Modal app (aca-calc-api by default). A preview
deploy, such as aca-calc-api-preview, gets caches of its own, and the image
carries the name so its containers open them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
precompute_national.py runs policyengine-us 2.115.0 over its default
microdata for 2027, under current law and with H.R. 1834, and writes
src/data/national_impacts.json: credits and recipients (with 2026 current
law), federal cost, income deciles, winners and losers, SPM poverty and
inequality, following policyengine.py's definitions.

policyengine-us leaves the premium tax credit out of household net income
by default, so each household's change in its credit is added to its net
income. SPM resources already count the credit, through the marketplace
premium net of it, so poverty is the model's own.

It needs about 32 GB of memory and ran on Modal (about 45 minutes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Overview and Explore Households pages become one Overview: how
benchmark premiums rise in 2027, how the credit absorbs the increase below
400% FPL while households above it pay all of it, what H.R. 1834 would
mean for four example households and across incomes, and its national
effects (cost, recipients, deciles, winners, poverty, inequality), then
the methods. Every figure comes from the precomputed data.

- New ExampleHouseholdsTable and NationalImpactChart; PremiumChart (from
  the calculator) takes the lines to draw.
- The Explore Households page and its components go; its links open the
  Overview. The last section opens the calculator tab.
- ContributionScheduleChart drops the 700% FPL bill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…come

2.138.2 counts the used premium tax credit in household net income
(policyengine-us #10773), keeps a claimable filer out of the credit's tax
family (#10041) and uses the Alaska and Hawaii guidelines when the state is
supplied only for the coverage year (#10860). precompute_national.py drops
its credit adjustment: it reads the reform's net income directly, uses the
used credit for the cost and recipients, and checks that the change in net
income matches the change in the credit. The browser cache key follows the
pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne-us 2.138.2

Every figure matches the 2.115.0 run to within 50 cents; only the model
version changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kbox to the calculator

The Overview drops the split view: each section's chart or table sits under
its text in one column. Charts take a fixed height inside a bordered card,
so none runs past its box, and the households table scrolls sideways on a
narrow screen. The calculator's chart no longer overflows its panel either.

Colors, fonts and radii come from @policyengine/ui-kit's theme: the app's
--pe-* variables now point at its tokens, and the charts use its chart
palette (2026 current law slate and dashed, 2027 current law dark blue,
H.R. 1834 teal).

The calculator shows 2026 and 2027 under current law; a checkbox adds 2027
under H.R. 1834 to the charts, the household cards and the explanation,
without a new request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The credits, cost and recipients now use the credit tax units use, which
household net income counts since policyengine-us #10773. H.R. 1834 adds
$43.5 billion in 2027 ($54.0 billion under current law, $97.5 billion
under the bill), and SPM resources rise by the same amount. The SPM poverty
rate falls from 13.67% to 13.47%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each value now sits just past its bar's end (below a decrease) instead of at
the zero line, with room on the axis for the label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The form's new Comparison section holds the checkbox; Calculator keeps the
setting and passes it to the results, which update without a new request.
The form's labels are now in sentence case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e 400% FPL cliff

precompute_cliff_household.py saves household net income in 2027 under
current law and H.R. 1834 across incomes, and the marginal tax rate from each
$1,000 step to the next. A new Overview section charts them: under current
law, earning $1,000 more at 400% FPL costs the household its $8,398 credit
(a rate of 863%); under H.R. 1834 its rate is 8.5 points higher from 400% FPL
until the credit ends at $174,000, with no cliff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DTrim99 and others added 20 commits November 16, 2026 12:14
…eholds

The calculator now reads top to bottom: the four example households as
cards, the household form, then the results. Choosing a card fills the form,
shows the household's stored result without a request and enters its income
on the household tab.

precompute_calculator_examples.py sends each household to the calculator API
with the request the form sends and stores the response
(calculator_examples.json; run here against the preview API on
policyengine-us 2.138.2). The results match the Overview's table for all four
households. The four households now live in example_households.py, which
precompute_households.py also reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ata check

After the story components in PolicyEngine/uk-growth-with-ai (Vahid's
animated story), built for the single-column Overview:
- Line charts name each line beside it, where the lines are furthest apart,
  and fall back to a legend when they run within 18px (DirectLabels.jsx).
- Hovering marks the income with a dashed line and a dot on each line.
- Charts fade in the first time they scroll into view (not when already on
  screen, without JavaScript, or under reduced motion).
- Three key figures open the Overview and count up once; the exact value is
  always in the page.
- A section rail beside the story on wide screens highlights the section
  being read.

scripts/check_data.mjs runs before next build: the data files must share one
policyengine-us version and year, the national cost must equal H.R. 1834's
credits less current law's, the calculator's stored examples must match the
Overview's table, and the marginal-rate arrays must cover every income.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… CBO's estimate

The microdata's Marketplace take-up flags made 6.7 million people above
400% FPL unsubsidized Marketplace buyers in 2027, against CBO's 2.8 million
unsubsidized enrollees at all incomes; H.R. 1834 gave each a credit. Above
400% FPL, only tax units in which someone reported Marketplace or other
individual coverage now take up, in both simulations. Unsubsidized
enrollment falls to 2.7 million and the static cost of H.R. 1834 in 2027
from $43.5 billion to $25.0 billion; poverty and current-law credits are
unchanged.

The Overview shows CBO's $31.8 billion fiscal 2027 estimate, which includes
induced enrollment and lower premiums, beside ours, and drops current-law
spending levels, which sit below CBO's baseline. The data check rejects a
national file without the enrollment rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Overview's methods section becomes its own page beside the Overview and
the Calculator (#methodology): the model and data, with links to the
precompute scripts; the policies compared; how the credit is counted; who
enrolls, including the take-up rule above 400% FPL; a table of
PolicyEngine's figures beside CBO's, with sources; and limitations. The
Overview's cost section points to it, and the Overview ends with buttons to
the calculator and the Methodology tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tabs go back to the deployed app's look: bordered, fully rounded pills,
filled with the primary teal when active. They wrap on narrow screens and
shrink below 640px so all three fit at phone width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Overview opens with a paragraph summarizing the first three sections of
the earlier app: how the premium tax credit works, the 2021–2025 ARPA/IRA
enhancements, and their expiry in 2026. It also spells out FPL, which the
Overview used without defining.

Restyle, keeping the single column:
- tinted page background with raised white cards (charts, key figures,
  the calculator's panels), and the earlier app's medium shadow
- a teal-to-blue wash behind the title and tabs
- key figures as white tiles topped with their scenario's chart color
- part headings as pills, teal section titles, and a teal bar beside the
  section being read (useActiveSection, now shared with the section rail)
- buttons that lift on hover with a sliding arrow
- Medicaid expansion badges on the calculator's example households

The chart colors stay as they were: the brighter blue separated less from
H.R. 1834's teal in the palette validator and fell below 3:1 contrast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Say the credits lower premiums rather than that they help people, and
split the last sentence, which ran on after a colon, into two full ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The section rail still highlights the section being read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The paragraph now follows the earlier app's first section: the credits
reduce enrollees' premiums by capping what they pay for the benchmark plan,
and the government pays the difference. ARPA and the IRA enhanced them from
2021 through 2025; the last two sentences on their expiry stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add Idaho (expanded 2020) to the calculator's Medicaid expansion states,
  which feed the AI explanation; Idaho adults got a 0% threshold before.
- Say where H.R. 1834's credit ends for the Pennsylvania adult from its
  benchmark premium: about $174,550, where 8.5% of income reaches $14,837.
- Say both above-400% examples live in their state's highest-cost rating
  area in the model's 2027 premium data (area 9 in PA and CA).
- Name KFF as the source of the 2026 and 2027 benchmark premiums, in the
  Overview and the Methodology tab.

H.R. 1834 is still on the Senate calendar (last action Feb 10, 2026), so
the "has not been enacted" lines stand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Max's review (step 1): the calculator and household story go out first,
and the national estimates come back only once the step 4 validation run
supports them.

- Overview: drop the three key figures, the national-average paragraph in
  the premiums section, and Part 3 (cost and reach, deciles, who gains,
  poverty, inequality).
- Methodology: drop "How the credit is counted", "Who enrolls" and the CBO
  comparison, the national paragraph of "Model and data", and the
  Limitations lines on enrollment and spending levels. The model version
  now comes from the household data.
- Remove the national changelog fragment and the key figures, Who enrolls
  and CBO comparison from the Overview fragment; README notes the national
  script's output isn't shown yet.

precompute_national.py, national_impacts.json, cbo_estimate.json,
NationalImpactChart and CountUp stay in the repo, and check_data.mjs still
checks the national file, so reverting this commit restores the section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On wide screens (1025px and up) the active section's chart is pinned on the
left (55%) while the text scrolls past in cards on the right (45%), as the
deployed app lays it out; the active card is outlined in teal and the others
dimmed (kept readable at 70% opacity), and each new chart fades in. The
opening paragraph sits above at reading width. On narrower screens the page is
one column with each chart under its text, inside its card.

The Overview no longer shows the section rail; the Methodology tab keeps its
own. The calculator page is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same structure as the deployed Overview, with one policy option:

1. How the credits work: how premium tax credits work, the 2021-2025
   enhancements and their expiry (the opening paragraph's text, now in the
   first three cards, each with its contribution-schedule chart).
2. A household facing the 2027 increase: the Pennsylvania adult at about
   650% FPL pays the whole benchmark premium in 2026 ($1,127/month) and in
   2027 ($1,236/month, up 9.7%), with no credit.
3. A clean extension of the enhanced credits, naming H.R. 1834 as the bill
   that would do it: $737/month for the household, then the premium and
   marginal rate charts across incomes.
4. Other households: the four example households.

A new HouseholdYearTable shows the household's premium, credit and payment,
adding a column at each step, as the deployed CliffComparisonTable did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The example now follows the same 45-year-old in Lebanon County at $50,000
(about 315% FPL) and $104,000 (about 650% FPL), with the same benchmark
plan: $1,127/month in 2026 and $1,236/month in 2027.

- Below 400% FPL the credit rises $99 to $811/month, so the payment rises
  only $11 (to $426/month), from the share of income rising from 9.96% to
  10.22%.
- Above 400% FPL there is no credit, so the household pays the whole $109
  increase.
- Under a clean extension, $264/month and $737/month.

HouseholdYearTable reads both incomes from the Pennsylvania sweep
(cliff_demo.json), and check_data.mjs now checks the sweep against the
household table at $104,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The header drops its teal-to-blue gradient and widens to 1200px, so the
title, subtitle and page tabs line up with the left edge of the Overview's
split layout, as on the deployed app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part 2 now follows the Texas adult (40, Harris County, $40,000, about 250%
FPL) and the Pennsylvania adult (45, Lebanon County, $104,000, about 650%
FPL) instead of the Pennsylvania adult at two incomes, and no longer calls
them middle-income.

- Texas: the benchmark premium rises $89 to $770/month; the credit rises to
  $481/month, so the payment rises only $2, to $289/month.
- Pennsylvania: the premium rises $109 to $1,236/month, all of it paid.
- Under a clean extension, $133/month and $737/month.

HouseholdYearTable reads both from examples.json. The four-household card
now covers the Florida family and the California couple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Dollar changes in the 2027 card are now taken between the rounded monthly
  amounts the table shows (monthlyChange), so the Texas adult's payment rises
  $3 ($286 to $289) and its premium $88 ($682 to $770), as the table reads.
- "gets/get no credit" becomes "receives/receive no credit" on the Overview,
  in the calculator's results and on the Methodology tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… year asked

The household table, the calculator's cards and the text round what the
household pays from its exact value and show the credit as the rounded
premium less it, so each column adds up: the Texas adult's 2026 credit
reads $396 (was $395, beside $682 and $286) and the Pennsylvania adult's
H.R. 1834 credit $499 (was $500, beside $1,236 and $737).

The calculator stores an answer in the browser only when it is for the
year asked. Right after the relaunch Vercel serves the new page before the
API deploy finishes, and the previous API answers every request for 2026
without naming a year; caching that would show 2026 results for a day.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…limits

Between the API's $1,000 steps the cards drew a straight line, so a step holding the 100% or 400% FPL limit or a Medicaid or CHIP limit showed a mix of the two sides. The credit's limits now apply exactly. Medicaid and CHIP limits aren't in the API's answer, so those steps show the closest income calculated and say so. The monthly change lines now match the payments on the cards, and the README describes the household-only app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Carries over the Local impact view from #24, built on #37's app: a tab
that shows a county's 2026 Marketplace plan selections, advance credit
consumers, average advance credit and average paid premium, a 119th
Congress district map, the compact CMS extracts and district allocation
behind them, and the Python loaders, ingest scripts and tests. #24's
Streamlit removal already merged in #36, so it isn't repeated here.

Co-authored-by: Daphne Hansell <128793799+daphnehanse11@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
aca-calc Ready Ready Preview Nov 19, 2026 4:23am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 91a21fc2 Deployed Nov 19, 2026 by vercel[bot]
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