Skip to content

One select-row stitcher - #144

Open
alecloudenback wants to merge 1 commit into
refactor/08-vector-constructorfrom
refactor/09-select-row
Open

alecloudenback wants to merge 1 commit into
refactor/08-vector-constructorfrom
refactor/09-select-row

Conversation

@alecloudenback

Copy link
Copy Markdown
Member

"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

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

This branch has not been deployed

No deployments
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