Skip to content

One select-row stitcher - #144

Merged
alecloudenback merged 2 commits into
masterfrom
refactor/09-select-row
Oct 1, 2026
Merged

alecloudenback merged 2 commits into
masterfrom
refactor/09-select-row

Conversation

@alecloudenback

@alecloudenback alecloudenback commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Merge map (updated 2026-10-01)

Part of the coordinated FinanceCore 2.8, FinanceModels 7.0, ActuaryUtilities 6.0 and MortalityTables 3.0 releases. Merge each stack bottom-up with Create a merge commit. Automatic branch deletion is on, so after each merge GitHub retargets the next PR onto the default branch: check that its base says master and let its CI finish before merging it.

Order Package Merged Open, merge left to right Then
1 FinanceCore #56 — 2.8.0 registered (2026-09-30)
2 FinanceModels #311, #314, #295, #308, #315, #316 #327 → #317 → #318 → #319 → #320 → #322 → #323 → #324 → #325 → #326 (#315 and #316 were merged into stacked branches, not master; #327 lands them) register 7.0.0
3 ActuaryUtilities — #161 (includes #160's change, so #160 is closed; merges after FinanceModels 7.0.0 is registered) register 6.0.0
any MortalityTables #136, #137, #138, #139, #140, #141 #152 → #142 → #143 → #144 → #145 → #146 → #147 → #149 → #151 → #148 (#138–#141 were merged into stacked branches, not master; #152 lands them. Independent of the other three) register 3.0.0

This PR: MortalityTables #144, number 4 of 10 open (base #143; next #145).


Updated 2026-09-24 (review fix), one commit added: Place XTbML rates by their labels. Rates were placed by position, so any gap or grouping in the age/duration labels shifted later rates to the wrong ages. Eight bundled mort.SOA.org tables label grouped ages (for example t352, issue ages 12, 17, 22, …): select[17] returned issue age 37's rates. Rates now sit at their own labels, with missing between groups; an empty cell inside a select row no longer shifts later rates; a repeated label throws.


"Select rates followed by the ultimate tail, indexed by attained age" was implemented three times with three treatments of leading missing values: SelectMortality, the XTbML converter, and the CSV loader.

Changes

  • New private _select_row(issue_age, select_rates, ultimate) next to SelectMortality. A select period longer than the ultimate table simply has no tail.
  • SelectMortality maps _select_row over the rows.
  • XTbML converter: per issue age, the rates vector preceded by duration - 1 leading missings, allocating a Union vector only when that count is nonzero, then _select_row.
  • CSV extension: per row, trailing blanks are trimmed but a leading or interior blank is kept as missing, so a row with a gap is not silently truncated (the old backward scan did the same; a forward scan would not).

Baseline facts recorded before editing and now asserted: rows without leading missings stay Vector{Float64} (only rows with leading missings are Union{Missing,Float64}), cso2001.select[15][15] is missing, and omega(cso2001.select[98]) == 120 (issue #71).

Testing

  • Unit tests for _select_row with leading missing, a select period ending exactly at omega, and one extending past omega.
  • Unit test of the CSV row trimming with an interior blank.
  • The SOA value-equality tests and the CSV-vs-XTbML equality tests pass unchanged.

Stacked on #143 (base branch refactor/08-vector-constructor). Merge the stack in order; once the base PR is merged and its branch deleted, GitHub retargets this PR to master.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JFnc6pvofuNXTW2xdCcewT

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.93%. Comparing base (bcd9510) to head (31b9699).

Additional details and impacted files
@@                        Coverage Diff                         @@
##           refactor/08-vector-constructor     #144      +/-   ##
==================================================================
- Coverage                           91.05%   90.93%   -0.12%     
==================================================================
  Files                                  10       10              
  Lines                                 380      375       -5     
==================================================================
- Hits                                  346      341       -5     
  Misses                                 34       34              

☔ 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.

alecloudenback and others added 2 commits September 24, 2026 16:39
SelectMortality, the XTbML converter, and the CSV extension all built
"select rates followed by the ultimate tail, indexed by attained age"
with their own index arithmetic and their own treatment of leading
missing values. They now share _select_row. Rows are only widened to
Union{Missing,Float64} when they actually contain a missing value, and
the CSV loader keeps an interior blank rather than truncating the row.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFnc6pvofuNXTW2xdCcewT
The select-row rewrite rebuilt each row from its first defined duration
and concatenated the rest, so an empty cell inside a row moved every
later rate to an earlier attained age. Issue ages and ultimate ages were
placed by position the same way: eight bundled SOA tables label grouped
ages (t352's issue ages are 12, 17, 22, ...), and their select[17]
silently returned issue age 37's rates.

Place every rate at its own duration or age instead, with missing where
the table gives none; a repeated label throws.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@alecloudenback
alecloudenback force-pushed the refactor/08-vector-constructor branch from bcd9510 to b8f54a9 Compare September 24, 2026 22:50
This was referenced Sep 24, 2026
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