Skip to content

feat: Report builder with modal-based ingredient selection#556

Draft
anth-volk wants to merge 79 commits intomainfrom
feat/report-setup-reflow
Draft

feat: Report builder with modal-based ingredient selection#556
anth-volk wants to merge 79 commits intomainfrom
feat/report-setup-reflow

Conversation

@anth-volk
Copy link
Collaborator

@anth-volk anth-volk commented Jan 9, 2026

Summary

This PR introduces a completely redesigned Report Builder experience with modal-based workflows for selecting and creating policies, populations, and households. This is a major feature addition that provides users with an intuitive, streamlined interface for configuring policy simulations.

Report builder core

  • New ReportBuilderPage with simulation canvas for configuring reports
  • Report meta panel for naming reports and viewing configuration status
  • Support for single and multi-simulation reports
  • Automatic ingredient naming and labeling

Policy selection & creation modal

  • PolicyBrowseModal for browsing existing policies or creating new ones
  • Policy details drawer showing parameter modifications
  • Full policy creation workflow with:
    • Parameter tree navigation with search
    • Value setters for different time modes (default, yearly, date range, multi-year)
    • Historical values chart showing baseline vs reform
    • "Changes for this parameter" list with modification tracking
    • Editable policy naming in header

Population selection & creation modal

  • PopulationBrowseModal for geographic and household population selection
  • Support for US states, congressional districts, and UK constituencies/local authorities
  • Household selection from user's saved households
  • Inline household creation modal

Household creation modal

  • Integrated household builder within population modal
  • Entity-aware variable assignment
  • Support for US and UK household structures

Additional improvements

  • Geography utilities for US/UK administrative divisions
  • Usage tracking infrastructure
  • Various visual and UX refinements

⚠️ Draft PR notice

This PR is in draft status. The following still need investigation before merging:

  • Test coverage for new components
  • Code formatting verification (prettier)
  • ESLint / code quality checks
  • Manual QA across US and UK flows
  • Performance testing with large parameter trees

Test plan

  • Create a new report from Report Builder page
  • Browse and select existing policies
  • Create a new policy with parameter modifications
  • Verify parameter changes display correctly in chart and list
  • Select geographic populations (nationwide, state, district)
  • Create and select household populations
  • Complete full report creation flow
  • Test both US and UK country contexts

🤖 Generated with Claude Code

@vercel
Copy link

vercel bot commented Jan 9, 2026

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

Project Deployment Actions Updated (UTC)
policyengine-app-v2 Ready Ready Preview, Comment Mar 9, 2026 9:10am
policyengine-calculator Ready Ready Preview, Comment Mar 9, 2026 9:10am
policyengine-website Ready Ready Preview, Comment Mar 9, 2026 9:10am

Request Review

@anth-volk anth-volk changed the title feat: Report setup reflow - V6 policy creation modal feat: Report builder with modal-based ingredient selection Jan 9, 2026
@anth-volk anth-volk force-pushed the feat/report-setup-reflow branch from 4469bb7 to a10b646 Compare February 12, 2026 23:39
anth-volk and others added 30 commits March 9, 2026 10:04
The auto-sizing TextInput measured text width and set a fixed pixel width,
which could exceed the container for long names. Replaced with flex: 1 +
minWidth: 0 so the input fills available space without overflowing. Also
added minWidth: 0 and overflow: hidden to the simulation header.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…r from policies page

- Add ActionsColumn component with icon buttons and tooltips for reports/policies tables
- Replace hamburger menus with rename (IconCursorText), view (IconSearch), and edit (IconPencil) icons
- Remove checkbox selection from all ingredient pages (reports, policies, populations, simulations)
- Open PolicyCreationModal from policies page edit action instead of navigating to pathway
- Change "Change policy" tooltip to "Swap policy" and increase editor button size to 34px
- Match "Policy overview" sidebar item background to Mantine NavLink active styling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…on language

Create reusable ActionButtons (ViewButton, EditDefaultButton, EditAndUpdateButton,
EditAndSaveNewButton, ShareButton, SwapButton) and apply consistent icon semantics
across the app: pencil=edit/rename, status-change=update, new-section=save-as-new,
info-circle=view, transfer=swap, share=share.

Split report output "View/edit" into separate View and Edit buttons. Replace all
IconCursorText with IconPencil. Use standardized buttons in policy modal footers,
table action columns, and report builder TopBar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove rename buttons from Reports and Policies tables. Use pencil icon
(EditDefault) for edit actions. Add "View policy" button to Policies table
that opens the policy modal in read-only display mode via new
initialEditorMode prop on PolicyCreationModal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add initialEditorMode to useEffect dependency array so the modal
correctly resets to display (read-only) mode when opened via the
"View policy" button from the Policies table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…icy modal

- Move ReportBuilderPage into reports/create route, remove old report-builder route
- Delete report-only pathway files (ReportPathwayWrapper, 5 views, utilities, tests)
- Remove Report builder sidebar tab, keep New report button targeting reports/create
- Rename page titles: "Create new report", "View report setup", "Edit report"
- Revert policy modal sidebar colors to teal/green (primary), unify tab highlights
- Remove parameter tooltip on overview page, make footer param count clickable
- Add hover color to footer text and darken overview param hover to primary[600]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire up the previously stubbed "Update existing policy" button in both
PolicyBrowseModal and PolicyCreationModal. Follows the same pattern as
report updates: create a new base policy via API, then update the
existing UserPolicy association to point to it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Content

Replace hardcoded FONT_SIZES values with typography tokens, fix "Date Created"
title case violation, replace rgba() values with design token equivalents, and
extract duplicated overview content (~400 lines) into shared PolicyOverviewContent
component used by both PolicyCreationModal and PolicyBrowseModal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ings

Unify empty-state and selected-state vertical padding in IngredientSectionFull
(both now use spacing.md). Remove disabled "Account settings" sidebar item and
unused IconSettings2 import.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the hand-rolled parameter grid in PolicyDetailsDrawer with the
shared PolicyOverviewContent component, making the drawer visually
consistent with the policy editor overview tab.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Swap policy/population colors so policies use teal and populations use
slate. Change checkmark to primary[500]. Default baseline simulation to
Current law + nationwide population. Remove dynamics section from report
builder and "User-created policies" from policy modal sidebar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… msg

Add Enter key handling in parameter value setter to submit on press.
Replace separate view/edit action buttons with single gear icon
(View/edit X) on Policies, Reports, and report output pages. Add
"Back to reports" navigation above report output header. Remove
"Your report is being calculated" info box from loading page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ct map

Combine society-wide report output into a single Migration tab with
collapsible sections for budgetary impact, distributional analysis,
poverty impact, inequality impact, congressional districts, UK
constituency, and local authority. Each section has inline segmented
controls for chart switching.

Key changes:
- New MigrationSubPage with CollapsibleSection pattern and segmented
  controls for distributional (absolute/relative/intra-decile), poverty
  (depth + breakdown), and congressional (absolute/relative) modes
- Choropleth map now uses two-trace approach: background trace shows all
  district outlines (gray borders, white fill) even before data loads,
  data trace overlays colored fills progressively as states complete
- Congressional section shows map immediately with "Compute" button;
  progress bar + message during loading (X of 51 states)
- Reproduce in Python moved from tab to header button (IconCode)
- Pruned migrated charts from Comparative Analysis sidebar tree
- Removed Dynamics, Overview (society-wide), constituency, and local
  authority tabs from ribbon
- Added report mockup page and sidebar link for development

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add UK-only "Budgetary impact by program" section after budgetary impact
- Add UK-only "Wealth distributional analysis" section with same
  absolute/relative/intra-decile segmented control as income section
- Remove all items from Comparative Analysis sidebar tree (all charts
  now live on the Migration tab)
- Remove report mockup page, route, and sidebar entry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove entire tab navigation ribbon from ReportOutputLayout (tabs,
  sidebar, comparative analysis tree references all removed)
- Migration content is now the full report output page for society-wide
- Move "Compute congressional impacts" button to left of Absolute/
  Relative segmented control
- Clean up ReportOutputLayout props, tests, and fixtures
- Remove mockup page route and sidebar entry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace forward-arrow breadcrumbs with "< Back to reports" navigation
in both ReportOutputLayout and ReportBuilderShell. Add gear button
(IconSettings) on policy cards to open the policy modal in view mode,
replacing the separate edit-only pencil button.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…verview

Report output page now renders the unified page directly at
/report-output/:reportId without a /migration subpage. Overview
section wraps the hero metrics and is auto-expanded; all other
sections start collapsed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…factor overview cards

- Create DashboardCard with 6-phase expand/collapse animation (framer-motion)
- Support standard mode (icon+label+slides) and custom content mode (shrunkenContent)
- Add colSpan, shrunkenBackground, shrunkenBorderColor, padding props
- Create playground page with mini charts and mock data for testing
- Refactor SocietyWideOverview to use DashboardCard for all 3 metric cards
- Remove Overview tab, place overview content directly at top of report page
- Fix ReportBuilderPage/useSimulationCanvas hook dependency issues
- Add unnamed policy warning modal in PolicyCreationModal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… breakdowns

- Fix initial card height bug caused by useLayoutEffect clearing styles on mount
- Reduce SHRUNKEN_CARD_HEIGHT from 260 to 200px, center content vertically
- Add chartHeight prop to BudgetaryImpact, PovertyImpactByAge, and
  WinnersLosersIncomeDecile subpages for use in constrained containers
- Calculate precise expanded chart heights from card layout dimensions
- Add federal tax, state tax, and benefit spending breakdowns to
  budgetary impact card (US only) using MetricCard components
- Format values <$1M as "<$1 million" (or £ equivalent for UK)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ix chart heights

- Add CongressionalDistrictCard to SocietyWideOverview with auto-start
  fetch, shrunken loading/gain-lose counts, and expanded choropleth map
- Lift CongressionalDistrictDataProvider in MigrationSubPage to share
  context between overview and dropdown section
- Add expandedRows prop to DashboardCard for variable expanded height
- Add expandedControls prop to render SegmentedControls alongside the
  minimize button in a fixed-height controls row (31px = SC xs height)
- Add shrunkenHeader/shrunkenBody two-part layout to DashboardCard
- Fix chart heights: derive from card dimensions with controls row
  overhead (SECONDARY_CHART_H=252, BUDGET_CHART_H=279) so Box content
  height is ~279px consistently across all chart cards

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove CongressionalDistrictSection from MigrationSubPage since the
DashboardCard now handles congressional district display. Pass computed
height (557px) to the choropleth map so it fills the 3-row expanded
card without blank space.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add red error trace overlay on choropleth map for errored states with
  red hover card background
- Detect missing districts from both pre-computed and progressive fetch
  paths to show error counts on shrunken card
- Add 'error' trend to MetricCard with red label, icon, and value
- Improve fetchSocietyWideCalculation error logging with response body
- Increase mini chart left margin for currency symbol visibility
- Remove "Absolute impacts by decile" legend from decile card
- Expose erroredStates from congressional district context

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t, and UI refinements

- Simplify DashboardCard to single rendering mode (shrunkenHeader/shrunkenBody)
- Add shrunkenRows prop for multi-row shrunken cards (congressional = 2 rows)
- Replace expand icon with "See detailed analysis" ghost button
- Add top 5 / bottom 5 congressional district rankings with conditional headers
- Fix district label lookup by stripping congressional_district/ prefix from metadata keys
- Replace budgetary MetricCards with mini Plotly waterfall chart
- Add dynamic magnitude label ($bn/$m/$k) using Plotly native yaxis.title
- Fix negative sign placement on currency axes (-$500 not $-500)
- Update PlaygroundPage to match new DashboardCard API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all Mantine imports in components/ and report-output/ with
shadcn/ui equivalents: ActionIcon→Button, Tooltip→Radix compound,
Box→div, SimpleGrid→CSS grid, Collapse→Collapsible, UnstyledButton→button,
useDisclosure→useState. Add new SegmentedControl and Collapsible components
built on Radix primitives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…es, fix Chromatic

Replace all Mantine imports across 48 report builder files with shadcn/ui
equivalents and native HTML. Add custom YearPicker and DatePicker components.
Fix Chromatic missing-commit issue with --patch-build for PR builds. Add 18
new Storybook stories for key components. Remove 3 orphaned story files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ylelint

Cast Slot.Root as React.ElementType to work around dual csstype versions
in the monorepo causing SlotProps style mismatch. Add storybook-static to
stylelintignore since it contains generated CSS.

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