Skip to content

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

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

feat: Report builder with modal-based ingredient selection#556
anth-volk wants to merge 73 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 3, 2026 10:18pm
policyengine-calculator Ready Ready Preview, Comment Mar 3, 2026 10:18pm
policyengine-website Ready Ready Preview, Comment Mar 3, 2026 10:18pm

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
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>
anth-volk and others added 7 commits February 27, 2026 00:02
…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>
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