Skip to content

ENH: Standardize cell naming in TradLife_A.BaseProj#100

Merged
fumitoh merged 1 commit into
mainfrom
claude/sad-hypatia-5e1f91
May 9, 2026
Merged

ENH: Standardize cell naming in TradLife_A.BaseProj#100
fumitoh merged 1 commit into
mainfrom
claude/sad-hypatia-5e1f91

Conversation

@fumitoh
Copy link
Copy Markdown
Member

@fumitoh fumitoh commented May 9, 2026

Summary

Standardize the cell naming convention in TradLife_A's BaseProj (and the four mirror cells in PV) so naming reflects the role each cell plays:

  • claims is now the umbrella term for benefit cashflows (was benefit_total).
  • Individual benefit components use claims_* (was benefit_*).
  • Per-policy values use a _pp suffix (was size_*), with size_benefit_*claims_*_pp as the combined case.
  • Existing per-policy cells without size_ get the _pp suffix too: claim_ppclaims_death_pp, expense_acqexpense_acq_pp, expense_maintexpense_maint_pp.
  • The PV mirror cells are renamed for parity: pv_claimspv_claims_death, pv_benefit_totalpv_claims, pv_benefit_matpv_claims_mat, pv_benefit_surrpv_claims_surr.

Files touched

  • lifelib/libraries/annuallife/TradLife_A/BaseProj/__init__.py — cell definitions, internal references, module docstring.
  • lifelib/libraries/annuallife/TradLife_A/PV/__init__.py — mirror-cell renames + body updates referencing renamed BaseProj cells.
  • lifelib/libraries/annuallife/plot_tradlife_a.pyvars list strings.
  • lifelib/libraries/annuallife/plot_pvcashflows.pyvars list strings.
  • lifelib/libraries/annuallife/tradlife_a-demo.ipynb — same vars list strings.
  • makedocs/source/libraries/annuallife/BaseProj.rst — autosummary/autofunction listings.
  • makedocs/source/libraries/annuallife/PV.rst — autosummary/autofunction listings.

Test plan

  • pytest lifelib/tests/libraries/test_tradlife_a.pytest_pv_net_cf_matches_simplelife passes for all three policy pairs.
  • Smoke check: all 37 new cell names load and produce sensible numerical values; all 13 old cell names (benefit_total, benefit_*, size_*, size_benefit_*, claim_pp, expense_acq, expense_maint, pv_benefit_*) are gone from the loaded model.
  • String-keyed cell access used by both plot scripts and the demo notebook (proj.cells['claims_surr'](t), proj.cells['claims_death'](t), proj.cells['pv_claims_surr'](t), proj.cells['pv_claims_death'](t)) resolves and yields cashflows.

Notes for reviewers

  • Module docstrings in BaseProj/__init__.py were updated so the prose still matches the convention (e.g. the old Size and Benefit sections are now _pp and Claims).
  • An unrelated pre-existing issue surfaced during smoke checks: invst_income_pp (formerly size_invst_income) chains into reserve_prem_rsrv_aft_mat_pp, which calls pol.ReserveNLP_Rate('VAL', t) — that attribute is missing on the policy interface. The formula body is unchanged from the pre-rename code, and test_pv_net_cf_matches_simplelife doesn't traverse this path. Out of scope for this PR.

🤖 Generated with Claude Code

Rename benefit/size cells to a unified ``claims_*`` and ``*_pp``
convention so naming reflects the role each cell plays:

- ``claims`` -> ``claims_death`` and ``benefit_total`` -> ``claims``
  promote ``claims`` to the umbrella term for benefit cashflows.
- ``benefit_*`` -> ``claims_*`` for individual benefit components.
- ``size_*`` -> ``*_pp`` for per-policy values, with
  ``size_benefit_*`` -> ``claims_*_pp`` as the combined case.
- ``claim_pp`` -> ``claims_death_pp``, ``expense_acq`` -> ``expense_acq_pp``,
  and ``expense_maint`` -> ``expense_maint_pp`` so every per-policy
  cell follows the ``_pp`` suffix.
- The four mirror cells in the ``PV`` space are renamed accordingly:
  ``pv_claims`` -> ``pv_claims_death``, ``pv_benefit_total`` -> ``pv_claims``,
  ``pv_benefit_mat`` -> ``pv_claims_mat``, ``pv_benefit_surr`` -> ``pv_claims_surr``.

Updates the BaseProj/PV module docstrings, the ``BaseProj.rst`` /
``PV.rst`` autosummary listings, and the cell-name strings used by
``plot_tradlife_a.py``, ``plot_pvcashflows.py``, and
``tradlife_a-demo.ipynb``.

Verified by ``test_pv_net_cf_matches_simplelife`` (passes for all
three policy pairs) and a smoke check confirming all 37 new names
resolve and all 13 old names are gone.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@fumitoh fumitoh merged commit 3f738b3 into main May 9, 2026
17 checks passed
@fumitoh fumitoh deleted the claude/sad-hypatia-5e1f91 branch May 10, 2026 15:15
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