Skip to content

Improve documentation for TradLife_A model spaces#108

Merged
fumitoh merged 4 commits into
mainfrom
claude/improve-tradlife-docstrings-FIyBn
May 11, 2026
Merged

Improve documentation for TradLife_A model spaces#108
fumitoh merged 4 commits into
mainfrom
claude/improve-tradlife-docstrings-FIyBn

Conversation

@fumitoh
Copy link
Copy Markdown
Member

@fumitoh fumitoh commented May 10, 2026

Summary

This PR significantly improves the documentation across the TradLife_A model by replacing outdated references to simplelife with accurate descriptions of the annual projection model, adding comprehensive docstrings to cells, and clarifying the model's architecture and data flow.

Key Changes

  • InputData module: Rewrote module docstring to explain the lazy-loading pattern and added a reference table mapping cells to Excel named ranges. Added docstrings to all public cells explaining their purpose and data sources.

  • Assumptions module: Updated module docstring to describe the annual model's array-based approach, added docstrings to cells explaining mortality tables, assumption lookups, and index resolution logic.

  • PolicyAttrs module: Clarified that cells return per-policy NumPy arrays indexed by policy index, added docstrings to all attribute accessor cells.

  • BaseProj module: Updated module docstring with accurate naming conventions (snake_case), clarified cell naming patterns (pols_, pp, exps, claims_), and added docstrings explaining projection length calculation and discount rate resolution.

  • CommTable module: Rewrote module docstring to reference the correct input data sources, updated parameter descriptions to use actual parameter names (Sex, IntRate, Table), and added docstring to mortality_rates() cell.

  • Economic module: Simplified module docstring, updated parameter documentation, and added docstring to disc_rate_mth() explaining the data source.

  • Projection module: Updated module docstring to remove outdated inheritance diagrams and clarify the parameterization with idx and scen_id.

  • PV module: Clarified that present-value cells use recursive definitions with termination at proj_len(), and added docstrings to validation cells.

  • Utilities module: Added module docstring explaining the helper cells and their role in mapping pandas tables to per-policy arrays.

  • Enum modules (Enums, ProductID, SexID, RateBasisID, AsmpID): Added comprehensive docstrings explaining the purpose of each enum and how they're used throughout the model.

  • TradLife_A root module: Added comprehensive module docstring describing the model's purpose, spaces, and key references.

  • Minor fixes: Corrected typos ("Matuirty" → "Maturity", "Intrest" → "Interest", "Bae" → "Base").

Implementation Details

  • All docstrings follow NumPy/Google style with proper cross-references to related cells and modules using Sphinx roles.
  • Removed outdated references to simplelife, nestedlife, ifrs17sim, and solvency2 models.
  • Replaced generic ExcelRange documentation with specific references to actual Excel named ranges and input data cells.
  • Clarified the array-based input model where per-policy values are indexed by integer policy index rather than policy ID.

https://claude.ai/code/session_012v7FkwD5Cn6Z2E9QrGgpcq

claude added 4 commits May 10, 2026 15:37
The space-level and cell-level docstrings carried over from
simplelife.model still pointed at the old module paths and used the
legacy CamelCase cell names. Update them to refer to the current
annuallife.TradLife_A layout, fix typos (Bae, matuirty, Intrest), add
missing module docstrings to TradLife_A, Utilities, Enums and the enum
child spaces, and document cells that were previously undocumented in
PolicyAttrs, Assumptions, Economic, InputData, PV and BaseProj.
…Data

The previous docstrings used `DataFrame`_ / `Series`_ named-link
references whose targets are only defined in the rst page, so docutils
flagged unknown-target errors when building the docs (including from
the autosummary table). Switch to inline literal style so the
docstrings render standalone.
…fe-docstrings-FIyBn

# Conflicts:
#	lifelib/libraries/annuallife/TradLife_A/Assumptions/__init__.py
The mort_rate cell was deleted from TradLife_A.Assumptions as dead
code, but Assumptions.rst still listed it in the autosummary and
autofunction directives.
@fumitoh fumitoh merged commit a1a274d into main May 11, 2026
17 checks passed
@fumitoh fumitoh deleted the claude/improve-tradlife-docstrings-FIyBn branch May 11, 2026 12:44
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.

2 participants