Improve documentation for TradLife_A model spaces#108
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
https://claude.ai/code/session_012v7FkwD5Cn6Z2E9QrGgpcq