Skip to content

[FEAT]deprecate date dims - #1304

Open
priyam0k wants to merge 14 commits into
mainfrom
feature/deprecate-date-dims
Open

priyam0k wants to merge 14 commits into
mainfrom
feature/deprecate-date-dims

Conversation

@priyam0k

@priyam0k priyam0k commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

  • Initialize origin and development on Triangle via TriangleAxis descriptors (axis 2 and 3), centralizing axis storage into Triangle._axes alongside index and columns (incorporates [FEAT] Centralize axis descriptors #1454).
  • Move _set_origin, _get_origin, _set_development, and _get_development helpers to chainladder.core.axis.
  • Deprecate odims (Deprecate odims #1012) and ddims (Deprecate ddims #1013) on Triangle with FutureWarning shims pointing to origin and development.
  • Update internal usage across core modules, estimators, adjustments, and tails to prevent internal deprecation warnings.
  • Preserve legacy pickle compatibility in Triangle.__setstate__ to migrate legacy pickled instances cleanly.
  • Add test coverage for 4-axis descriptor validation, edge cases, deprecation warnings, and pickle round-trips.

Related GitHub Issue(s)

Closes #1012, closes #1013, closes #1053 , #1454, refs #601, refs #1216, refs #1466

Additional Context for Reviewers

Checklist

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run --directory docs jb build . --builder=custom --custom-builder=doctest)

Note

Medium Risk
Wide refactor of how all four Triangle axes are stored and accessed touches core slicing, I/O, and every estimator; public origin/development should be compatible but direct odims/ddims use will warn and pickle migration paths add regression surface.

Overview
Refactors Triangle origin/development to match the existing index/columns axis pattern: raw timestamps/lags live in _axes as _odims/_ddims, while origin and development are public TriangleAxis descriptors with get/set logic moved to chainladder.core.axis.

odims and ddims are deprecated (FutureWarning) but remain as thin shims; library code now uses _odims/_ddims internally so estimators and core paths do not warn. Slicing, concat, arithmetic broadcasting, and _get_axis_value were updated accordingly; axis number resolution is centralized via utility_functions / typing re-exports.

Legacy pickle __setstate__ migrates odims/ddims (and redundant _axes keys) into the unified _axes store. DevelopmentConstant pattern detection is tightened so DataFrames with origin/development columns are not mistaken for Triangles.

Tests cover descriptor behavior, deprecation, pickle round-trips, valuation-triangle errors for bootstrap/incremental additive, and assorted estimator edge cases.

Reviewed by Cursor Bugbot for commit a9066cf. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.77778% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.74%. Comparing base (67dea50) to head (a9066cf).

Files with missing lines Patch % Lines
chainladder/core/triangle.py 95.45% 2 Missing and 2 partials ⚠️
chainladder/core/axis.py 94.73% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1304      +/-   ##
==========================================
+ Coverage   94.35%   94.74%   +0.38%     
==========================================
  Files          97       97              
  Lines        6183     6274      +91     
  Branches      796      811      +15     
==========================================
+ Hits         5834     5944     +110     
+ Misses        225      208      -17     
+ Partials      124      122       -2     
Flag Coverage Δ
unittests 94.74% <97.77%> (+0.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 15.7% of exported symbols fully typed (241 / 1532)

Known Ambiguous Unknown Total
Project (head) 241 106 1185 1532

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 348
  • Functions without default param: 0
  • Classes without docstring: 8

Patch (exported symbols added or changed by this PR): 12.5% fully typed (2 / 16)

Known Ambiguous Unknown Total
Patch 2 0 14 16
Patch symbol details
Symbol Status Change
chainladder.adjustments.tests.test_bootstrap.test_bootstrap_odp_val_triangle_error ❌ unknown new
chainladder.core.tests.test_triangle.test_centralized_axis_edge_cases ❌ unknown new
chainladder.core.tests.test_triangle.test_ddims_deprecation_warning ❌ unknown new
chainladder.core.tests.test_triangle.test_odims_deprecation_warning ❌ unknown new
chainladder.core.tests.test_triangle.test_set_axis ❌ unknown new
chainladder.core.triangle.Triangle.ddims ❌ unknown changed (was ✅ known)
chainladder.core.triangle.Triangle.development ✅ known changed (was ❌ unknown)
chainladder.core.triangle.Triangle.odims ❌ unknown changed (was ✅ known)
chainladder.core.triangle.Triangle.origin ✅ known changed (was ❌ unknown)
chainladder.development.tests.test_constant.test_constant_dataframe_with_origin_development_columns ❌ unknown new
chainladder.development.tests.test_constant.test_constant_incr_cumulative_none ❌ unknown new
chainladder.development.tests.test_incremental.test_incremental_additive_val_triangle_error ❌ unknown new
chainladder.development.tests.test_munich.test_munich_properties ❌ unknown new
chainladder.methods.tests.test_predict.test_predict_age_exceeds_model ❌ unknown new
chainladder.tails.tests.test_constant.test_constant_attachment_age ❌ unknown new
chainladder.tails.tests.test_exponential.test_tail_curve_attachment_age ❌ unknown new

@priyam0k
priyam0k changed the base branch from main to feature/deprecate-dims September 5, 2026 16:55
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from 7bcf3d0 to 0c87d2e Compare September 5, 2026 20:10

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/development/constant.py
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from a9f5c57 to c6e0c8d Compare September 8, 2026 23:31
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch 4 times, most recently from 7d7efdc to 4253b6e Compare September 9, 2026 12:37
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from 4253b6e to 8b192f3 Compare September 12, 2026 07:45

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/core/triangle.py
@priyam0k
priyam0k marked this pull request as draft September 20, 2026 09:42
@priyam0k
priyam0k removed this pull request from stack #1305 September 29, 2026 21:58
@priyam0k
priyam0k changed the base branch from feature/deprecate-dims to feature/deprecate-kdims September 29, 2026 21:58
@priyam0k priyam0k changed the title Feature/deprecate date dims [FEAT]deprecate date dims Sep 29, 2026
@priyam0k
priyam0k added this pull request to stack #1437 September 29, 2026 21:59
@priyam0k
priyam0k marked this pull request as ready for review October 2, 2026 10:35
@priyam0k priyam0k mentioned this pull request Oct 2, 2026
3 of 11 tasks
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from 5668b6d to 676678a Compare October 18, 2026 21:02

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/core/triangle.py
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from 676678a to e2ca2bf Compare October 19, 2026 00:45

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/development/outstanding.py

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread chainladder/development/outstanding.py
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from a0a2ac2 to 7d102c9 Compare October 19, 2026 01:28
Base automatically changed from feature/deprecate-dims to main October 19, 2026 02:16
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from 7d102c9 to 6dcecb4 Compare October 19, 2026 02:16

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 93ebeeb. Configure here.

Comment thread chainladder/development/constant.py Outdated
@genedan

genedan commented Oct 19, 2026

Copy link
Copy Markdown
Member

I wasn't sure if this was ready for review, so I figure I'd chime in just in case. Let's follow the general strategy we took in #1303:

  • _ddims will become develoment and be initialized via TriangleAxis
  • _odims will become origin and be initialized via TriangleAxis

@priyam0k

Copy link
Copy Markdown
Contributor Author

I wasn't sure if this was ready for review, so I figure I'd chime in just in case. Let's follow the general strategy we took in #1303:

  • _ddims will become develoment and be initialized via TriangleAxis
  • _odims will become origin and be initialized via TriangleAxis

Folded the descriptor commits into this branch per your note. origin and development are now wired through TriangleAxis (axis 2 and 3) with _set_origin and _set_development in axis.py, and _axes stores all four dimensions (0..3).

Since bringing the descriptors and call-site updates together touches around 40 files, we can either review it in one go to get the full dimension stack in, or split it up if you'd rather review in smaller chunks.

@genedan

genedan commented Oct 20, 2026

Copy link
Copy Markdown
Member

I can review it one go, let's get the ddims and odims replaced with development and origin, respectively.

…1012, #1013)

- Encapsulate internal date dimensions into _odims and _ddims
- Provide backward-compatible odims and ddims properties emitting FutureWarning
- Migrate legacy pickled instances with odims/ddims in Triangle.__setstate__
- Decouple internal usages across core, estimators, tails, and tests
- Address ruff linting and formatting on touched files

Closes #1012, closes #1013, refs #1216, refs #601
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from f9fa951 to 6673db5 Compare October 23, 2026 11:49
@priyam0k
priyam0k force-pushed the feature/deprecate-date-dims branch from 6673db5 to a9066cf Compare October 23, 2026 11:52
@priyam0k

Copy link
Copy Markdown
Contributor Author

I can review it one go, let's get the ddims and odims replaced with development and origin, respectively.

Works for me. The swap to origin and development is in place, so all set for review.

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.

[DISCUSSION] Create centralized axis mapping Deprecate ddims Deprecate odims

2 participants