Skip to content

Rewrite docs content for v4 API#308

Merged
MaxGhenis merged 2 commits intomainfrom
docs-content-rewrite
Apr 20, 2026
Merged

Rewrite docs content for v4 API#308
MaxGhenis merged 2 commits intomainfrom
docs-content-rewrite

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Summary

Replaces the legacy multi-concept docs with task-shaped pages aligned to the v4 API. Stacked on top of PR #304 (Quarto toolchain swap); should be rebased onto main once #304 merges.

Structure

Added

  • getting-started.md — install, first household, first reform, first microsim
  • households.mdpe.us.calculate_household / pe.uk.calculate_household reference
  • reforms.md — parametric-reform dict shape (reform= on household, policy= on Simulation), time-varying, scale bracket indexing, structural fallback via the country package
  • microsim.mdSimulation + ensure() lifecycle, ensure_datasets, managed_microsimulation
  • outputs.md — full catalog of Aggregate / ChangeAggregate / DecileImpact / Poverty / Inequality / ProgramStatistics / geographic impacts
  • impact-analysis.mdeconomic_impact_analysis(baseline, reform) and its PolicyReformAnalysis return type
  • regions.md — state filtering, congressional districts, constituencies, local authorities, RowFilterStrategy
  • countries.md — US vs UK entity mapping, default dataset, default income variable, parameter trees

Removed (content folded into the new pages)

  • core-concepts.md
  • economic-impact-analysis.md
  • country-models-us.md, country-models-uk.md
  • regions-and-scoping.md
  • advanced-outputs.md

Updated

  • index.md — one-pager with a "where to go next" matrix
  • _quarto.yml — sidebar split into Get started / Calculate / Analyse / Reference
  • dev.md — references Quarto (not MyST) and the branch.type.md towncrier format; source-tree diagram reflects cli.py, results/, data/

Correctness fixes

The rewrite corrects errors in the prior documentation against the actual v4 API:

  • Outputs use simulation= / baseline_simulation= / reform_simulation= kwargs and the .run() → result-fields pattern (not Aggregate(...).compute(baseline))
  • AggregateType / ChangeAggregateType list only SUM / MEAN / COUNT
  • Filters are filter_variable= / filter_variable_eq/leq/geq / quantile= (not pandas-style filter="state_code == 'CA'" strings)
  • Parametric reforms use the flat dict shape compiled at construction time with [0].amount bracket indexing for scale parameters
  • Regional scoping uses RowFilterStrategy / WeightReplacementStrategy; region registry is get_by_type(...) / get(code)

Test plan

  • quarto render docs builds cleanly (13 pages, no broken-link warnings)
  • Internal .md links resolve to generated .html (grep -o 'href=' docs/_site/index.html shows expected targets)
  • CI docs-build job passes after rebase onto main post-Swap docs toolchain from MyST to Quarto #304

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits April 20, 2026 10:57
Replaces the legacy multi-concept pages (core-concepts, economic-impact-analysis, country-models-us/uk, regions-and-scoping, advanced-outputs) with task-shaped pages: getting-started, households, reforms, microsim, outputs, impact-analysis, regions, countries.

Rewrites fix real v4 API usage:
- Outputs use ``simulation=``/``baseline_simulation=``/``reform_simulation=`` kwargs plus ``.run()`` + result fields (no ``.compute(baseline)``).
- ``AggregateType``/``ChangeAggregateType`` list only ``SUM``/``MEAN``/``COUNT``.
- Filters use ``filter_variable``/``filter_variable_eq/leq/geq`` and quantile kwargs, not pandas-style strings.
- Parametric reforms use ``reform=`` on ``calculate_household`` and ``policy=`` on ``Simulation`` with flat ``{"param.path": value}`` dicts and ``base[0].amount`` bracket indexing.
- Regional analysis uses ``RowFilterStrategy``/``WeightReplacementStrategy`` and ``region_registry.get_by_type(...)``.

Also updates ``dev.md`` to reflect the Quarto toolchain (not MyST) and the ``.added.md``/``.changed.md`` changelog-fragment format, and refreshes the source-tree diagram.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reviewer flagged four factual errors against the real v4 API:

- calculate_us_poverty_rates and calculate_us_inequality take a single
  ``simulation=`` and return a single-simulation output (OutputCollection
  or Inequality). The docs had them returning a baseline+reform pair.
  Fix outputs.md and impact-analysis.md to call them once per simulation.
- region.scoping_strategy is only populated for regions that filter (US
  places, UK countries); US states use dataset_path instead. regions.md
  now documents that distinction and swaps the state/ca example for a
  place/* region.
- UK dataset label updated to "Enhanced FRS 2023/24" to match the
  filename.
- Drop "plus official thresholds" — the model only tracks SPM and deep
  SPM in US_POVERTY_VARIABLES.
@MaxGhenis MaxGhenis force-pushed the docs-content-rewrite branch from 4272e8c to 11a2e08 Compare April 20, 2026 14:58
@MaxGhenis MaxGhenis merged commit f8a6830 into main Apr 20, 2026
12 checks passed
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