Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RXR-1851: add function to calculate auc pre-ss #91

Merged
merged 10 commits into from
Mar 7, 2024
Merged

Conversation

roninsightrx
Copy link
Contributor

@roninsightrx roninsightrx commented Mar 6, 2024

This adds a convenience function to calculate AUC (and conc) using linear models, based on just the PK parameters.

@roninsightrx roninsightrx marked this pull request as draft March 6, 2024 05:53
@roninsightrx roninsightrx marked this pull request as ready for review March 6, 2024 21:17
Copy link
Contributor

@jasmineirx jasmineirx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

one consideration is that this requires standard mapping of doses into the first compartment, and so won't support drugs like tacrolimus where we often have a mix of oral/iv dosing. do you think it makes sense to add some documentation or warnings somewhere? one option could be to check reg for multiple type arguments. the user is more likely to be aware of the limitation if supplying dose/interval/t_inf since the "type" argument is not present.

dose = NULL,
interval = NULL,
t_inf = NULL,
parameters,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be tidier to put the parameters argument second, since then you can pass arguments by position more conveniently

calc_auc_analytic("1cmt_iv_bolus", pars, reg)
calc_auc_analytic("1cmt_iv_bolus", pars, dose = 1000, interval = 24, t_inf = 1)

if(is.null(dose) || is.null(interval)) {
stop("Specify `regimen` or `dose` and `interval`")
}
if(is.null(t_inf) || t_inf == 0) t_inf <- 1e-6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(is.null(t_inf) || t_inf == 0) t_inf <- 1e-6
if(is.null(t_inf) || any(t_inf == 0)) t_inf[t_inf > 0] <- 1e-6

t_inf can be of length > 1. the suggested code handles this situation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually intended it to be a single value, like dose and amount, that just specify the ongoing regimen. I will make that more clear in the code.

@roninsightrx
Copy link
Contributor Author

roninsightrx commented Mar 7, 2024

lgtm

one consideration is that this requires standard mapping of doses into the first compartment, and so won't support drugs like tacrolimus where we often have a mix of oral/iv dosing. do you think it makes sense to add some documentation or warnings somewhere? one option could be to check reg for multiple type arguments. the user is more likely to be aware of the limitation if supplying dose/interval/t_inf since the "type" argument is not present.

Right now it can only be used for iv models, so it shouldn't be an issue. The linear oral models in PKPDsim don't calculate AUC.

Copy link
Contributor

@jasmineirx jasmineirx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@roninsightrx roninsightrx merged commit e75a93e into master Mar 7, 2024
2 checks passed
@roninsightrx roninsightrx deleted the RXR-1851-auc branch March 7, 2024 21:17
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.

2 participants