fix: strip the PKNCA method attribute from derived AUCtau values - #37
Open
billdenney wants to merge 1 commit into
Open
billdenney wants to merge 1 commit into
billdenney wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PKNCA 0.12.1.9000 attaches a
methodattribute to the value returned bypk.calc.auc.all(), describing the interpolation used (e.g."AUC: lin up/log down"). It arrived with the newPPANMETHcolumn.The attribute survived into
AUCtauand, through theAUCtau/dosearithmetic, intoAUCtau_dose_normalized. The lists returned bycalc_derived()and thecalc_derived_*()functions therefore stopped comparing equal to the plain numbers they are documented to contain: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 smallcalc_auc_tau()helper that returns a bare numeric value. Fixing it at the source rather than relaxing the test also coversAUCtau_dose_normalizedand 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
AUCtauandAUCtau_dose_normalizedcarry 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