-
Notifications
You must be signed in to change notification settings - Fork 15
RXR-2598: consolidate model compilation & tests #132
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
base: master
Are you sure you want to change the base?
Conversation
Move shared model compilations from individual test files to setup.R to reduce redundant compilation during test runs. Models are compiled once at test session startup and reused across test files. Models moved include IOV models, multi-observation models, mixture models, time-varying covariate models, and various library models (3cmt, 2cmt oral, MM kinetics). Conditional compilation (NOT_CRAN) preserved for slower models. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR consolidates model compilations and reorganizes test files to improve test organization and reduce compilation time during testing. Models that were previously compiled separately in individual test files are now compiled once in setup.R, and tests have been reorganized to follow a test_<function> naming convention.
Changes:
- Models consolidated into
setup.Rfor one-time compilation at test session startup - Tests from multiple files (test_iov.R, test_multi_obs.R, test_mixture_model.R, test_compare_results.R, test_cmt_mapping.R, test_timevar_cov.R, test_t_init.R, test_sim_lagtime.R, test_time_rounding_bug.R) moved into test_sim.R
- Tests from test_bioav_def.R moved into test_new_ode_model.R
- Tests from test_advan_with_auc.R and test_advan_with_covariates.R consolidated into test_advan.R
- New test files created for specific functions (test_new_adherence.R, test_check_mixture_model.R, test_calculate_parameters.R, test_pkpdsim_to_nlmixr.R)
- New R implementation file R/new_adherence.R added with adherence simulation functions
Reviewed changes
Copilot reviewed 22 out of 26 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/setup.R | Centralized model compilation with clear organization and comments |
| tests/testthat/test_sim.R | Consolidated tests from multiple files into describe() blocks |
| tests/testthat/test_new_ode_model.R | Added IOV and bioavailability tests from test_bioav_def.R |
| tests/testthat/test_advan.R | Added AUC and covariate tests from separate files |
| tests/testthat/test_new_adherence.R | New test file for adherence functions |
| tests/testthat/test_check_mixture_model.R | New test file extracted from test_mixture_model.R |
| tests/testthat/test_calculate_parameters.R | New test file for parameter calculation |
| tests/testthat/test_pkpdsim_to_nlmixr.R | New test file for nlmixr conversion |
| R/new_adherence.R | New implementation of adherence simulation functions |
| tests/testthat/test_get_var_y.R | Added seed parameters for reproducibility |
| tests/testthat/test_reparametrization.R | Updated to use models from setup.R |
| tests/testthat/test_parameters_table.R | Updated to use models from setup.R |
| tests/testthat/test_calc_ss_analytic.R | Updated to use models from setup.R |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mccarthy-m-g
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Nice clean up 🧹
| ## there is slight difference in how bolus doses are handled. | ||
| ## Analytical equation is perhaps more consistent, so not testing | ||
| ## simulations at dose times. Should look into later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a TODO here?
test_<function>(some where grouped more by topic).No changes to actual code, just tests.