Skip to content

fix: strip the PKNCA method attribute from derived AUCtau values - #37

Open
billdenney wants to merge 1 commit into
claude/ci-failure-master-77fa06from
claude/pknca-dev-auc-method-attr
Open

billdenney wants to merge 1 commit into
claude/ci-failure-master-77fa06from
claude/pknca-dev-auc-method-attr

Conversation

@billdenney

Copy link
Copy Markdown
Collaborator

PKNCA 0.12.1.9000 attaches a method attribute to the value returned by pk.calc.auc.all(), describing the interpolation used (e.g. "AUC: lin up/log down"). It arrived with the new PPANMETH column.

The attribute survived into AUCtau and, through the AUCtau/dose arithmetic, into AUCtau_dose_normalized. The lists returned by calc_derived() and the calc_derived_*() functions therefore stopped comparing equal to the plain numbers they are documented to contain:

── Failure ('test-convert.R:17:3'): 1-compartment model ──
`attr(actual$AUCtau, 'method')` is a character vector ('AUC: lin up/log down')
`attr(expected$AUCtau, 'method')` is absent

This surfaced in a PKNCA reverse-dependency check. pmxTools is clean against CRAN PKNCA 0.12.1 and fails only against the development version.

Change

The 18 pk.calc.auc.all() call sites now go through a small calc_auc_tau() helper that returns a bare numeric value. Fixing it at the source rather than relaxing the test also covers AUCtau_dose_normalized and protects downstream comparison or serialization of the derived-parameter list.

Behavior is unchanged against released PKNCA, where no attribute is set and as.numeric() is a no-op.

Testing

Added a regression test asserting AUCtau and AUCtau_dose_normalized carry no attributes for the 1-, 2-, and 3-compartment models.

212 tests passing under both PKNCA 0.12.1 and 0.12.1.9000.

🤖 Generated with Claude Code

PKNCA 0.12.1.9000 attaches a `method` attribute to the value returned by
pk.calc.auc.all(), describing the interpolation used (for example
"AUC: lin up/log down"). The attribute survived into AUCtau and, through
the AUCtau/dose arithmetic, into AUCtau_dose_normalized, so the lists
returned by calc_derived() and the calc_derived_*() functions no longer
compared equal to the plain numbers they are documented to contain.

That broke the 1-compartment test in test-convert.R against a
development PKNCA, and would break any downstream comparison or
serialization of the derived-parameter list in the same way.

Route the 18 call sites through a small calc_auc_tau() helper that
returns a bare numeric value. The behavior is unchanged against released
PKNCA, where no attribute is set and as.numeric() is a no-op.

Add a regression test asserting that AUCtau and AUCtau_dose_normalized
carry no attributes for the 1-, 2-, and 3-compartment models.

Tests: 212 passing under both PKNCA 0.12.1 and 0.12.1.9000.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

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