add nm_psn nm_pharmpy nlmixr example workflows#57
Conversation
There was a problem hiding this comment.
Pull request overview
Adds three end-to-end example workflows (NONMEM+PharmPy, NONMEM+PsN, nlmixr2) for a busulfan popPK model-building sequence, and makes a few supporting changes in core luna functions around cache loading, config access, and syntax checking.
Changes:
- Added example project folders, model files, and workflow scripts for NONMEM+PharmPy, NONMEM+PsN, and nlmixr2.
- Updated
luna_load_project(),get_luna_config(),luna_check(), andluna_run()to adjust cache/config behavior and (forluna_check) switch to Pharmpy parsing. - Updated
.gitignoreand generated documentation forluna_check().
Reviewed changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| vignettes/example-3-nlmixr2/project/run1.R | Adds nlmixr2 run1 (1-cmt) model function for the example workflow |
| vignettes/example-3-nlmixr2/project/run2.R | Adds nlmixr2 run2 (2-cmt) model function |
| vignettes/example-3-nlmixr2/project/run3.R | Adds nlmixr2 run3 (WT allometry) model function |
| vignettes/example-3-nlmixr2/project/run4.R | Adds nlmixr2 run4 (SEX on CL test) model function |
| vignettes/example-3-nlmixr2/project/run5.R | Adds nlmixr2 run5 (IOV on CL) model function |
| vignettes/example-3-nlmixr2/project/busulfan.yaml | Adds luna project YAML describing the nlmixr2 model-building runs |
| vignettes/example-3-nlmixr2/luna_workflow_nlmixr2.R | Adds an nlmixr2-focused workflow script demonstrating modeling + luna annotations |
| vignettes/example-2-nm-psn/project/run1.mod | Adds NONMEM run1 control stream for PsN example |
| vignettes/example-2-nm-psn/project/run2.mod | Adds NONMEM run2 control stream for PsN example |
| vignettes/example-2-nm-psn/project/run3.mod | Adds NONMEM run3 control stream for PsN example |
| vignettes/example-2-nm-psn/project/run4.mod | Adds NONMEM run4 control stream for PsN example |
| vignettes/example-2-nm-psn/project/run5.mod | Adds NONMEM run5 control stream for PsN example |
| vignettes/example-2-nm-psn/project/busulfan.yaml | Adds luna project YAML for PsN example |
| vignettes/example-2-nm-psn/luna_workflow_nm_psn.R | Adds PsN-backed luna workflow script |
| vignettes/example-1-nm-pharmpy/project/run1.mod | Adds NONMEM run1 control stream for Pharmpy example |
| vignettes/example-1-nm-pharmpy/project/run2.mod | Adds NONMEM run2 control stream for Pharmpy example |
| vignettes/example-1-nm-pharmpy/project/run3.mod | Adds NONMEM run3 control stream for Pharmpy example |
| vignettes/example-1-nm-pharmpy/project/run4.mod | Adds NONMEM run4 control stream for Pharmpy example |
| vignettes/example-1-nm-pharmpy/project/run5.mod | Adds NONMEM run5 control stream for Pharmpy example |
| vignettes/example-1-nm-pharmpy/project/busulfan.yaml | Adds luna project YAML for Pharmpy example |
| vignettes/example-1-nm-pharmpy/luna_workflow_nm_pharmpy.R | Adds Pharmpy-backed luna workflow script |
| R/luna_run.R | Updates model execution to pass nmfe and attempt nmfe resolution via config |
| R/luna_load_project.R | Adjusts cache folder detection and cache reloading behavior |
| R/luna_check.R | Changes syntax check to use Pharmpy parsing + dataset load, updates messaging |
| R/get_luna_config.R | Fixes project config lookup to read YAML from cached project object |
| R/create_cache.R | Removes unused caching of Pharmpy settings |
| man/luna_check.Rd | Updates generated documentation to match new luna_check() behavior |
| .gitignore | Ignores data-raw/ and .claude artifacts |
Files not reviewed (1)
- man/luna_check.Rd: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: roninsightrx <ron@insight-rx.com>
| "project", project | ||
| ) | ||
|
|
||
| ## read pharmpy configuration |
There was a problem hiding this comment.
is there a reason why this was removed? I don't know exactly if this was important, but not sure it can just be removed.
There was a problem hiding this comment.
Yes, this was actually an intentional choice (though maybe should have highlighted the issue to get your sense of best path proactively.,
The issue I found when building the vignettes was that since pharmr is the R interface to pharmpy, any user calling luna_load_project() (PsN and nlmixr2 users who never touch pharmpy) would fail at cache creation if pharmpy wasn't installed.
The fix: remove the eager pharmpy config read from create_cache(). Pharmpy is now only called from functions that actually need it (luna_run(), luna_check(), luna_info(), etc.), so PSN/nlmixr2 users can load projects just fine.
I think PsN workflows here still use pharmpy some, but may want detangle in future. This will also be helpful for building in FeRx so we are necessarily dependent on pharmpy dependency if not using their workflow.
There was a problem hiding this comment.
I will add a comment to the code for better traceability.
Adds example luna workflows for: NONMEM + PsN, NONMEM + PharmPy, and nlmixr2.