Skip to content

Preferred units when some unit sets need no conversion - #711

Merged
billdenney merged 1 commit into
mainfrom
fix/concu-pref-per-group-units
Nov 12, 2026
Merged

billdenney merged 1 commit into
mainfrom
fix/concu-pref-per-group-units

Conversation

@billdenney

Copy link
Copy Markdown
Member

concu_pref (or doseu_pref) with unit columns that differ between groups stopped PKNCAdata() with "arguments imply differing number of rows: 1, 0" when a group was already in the preferred units. Repro: parent in mg/L and metabolite in ng/mL, with concu_pref = "mg/L".

Fix

Every unit set now has the PPSTRESU/conversion_factor columns, using its own units and a factor of 1 where it does not convert, as pknca_units_table() already does within one set.

Tests

The units table and the PPSTRES values for both concentration and dose unit columns.

Stacked on fix/units-join-group-types; this PR's diff is only this fix.

🤖 Generated with Claude Code

@billdenney
billdenney added this pull request to stack #705 November 11, 2026 15:44
@billdenney
billdenney force-pushed the fix/concu-pref-per-group-units branch from e6db766 to 5d36149 Compare November 11, 2026 20:41
Base automatically changed from fix/units-join-group-types to main November 12, 2026 15:20
With unit columns and a preferred unit, a unit set already in the
preferred units got a table without PPSTRESU and conversion_factor,
while the sets that convert had them.  Composing the secondary
parameter units read the missing columns as zero-length and stopped
with "arguments imply differing number of rows: 1, 0".  Every unit set
now has the standardization columns when any has them, with the set's
own units and a factor of 1 where it does not convert, as
pknca_units_table() does within one set.

The comment that preferred units only apply to scalar units was wrong:
pknca_set_units() keeps them for unit columns too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@billdenney
billdenney force-pushed the fix/concu-pref-per-group-units branch from 5d36149 to eb84176 Compare November 12, 2026 15:20
@billdenney
billdenney merged commit be353ef into main Nov 12, 2026
9 checks passed
@billdenney
billdenney deleted the fix/concu-pref-per-group-units branch November 12, 2026 15:42
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