Skip to content

add nm_psn nm_pharmpy nlmixr example workflows#57

Merged
JordanBrooks33 merged 9 commits into
mainfrom
add-example-vignette
Jun 29, 2026
Merged

add nm_psn nm_pharmpy nlmixr example workflows#57
JordanBrooks33 merged 9 commits into
mainfrom
add-example-vignette

Conversation

@JordanBrooks33

Copy link
Copy Markdown
Contributor

Adds example luna workflows for: NONMEM + PsN, NONMEM + PharmPy, and nlmixr2.

@JordanBrooks33 JordanBrooks33 removed the request for review from roninsightrx April 30, 2026 12:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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(), and luna_run() to adjust cache/config behavior and (for luna_check) switch to Pharmpy parsing.
  • Updated .gitignore and generated documentation for luna_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.

Comment thread R/luna_load_project.R Outdated
Comment thread R/luna_run.R Outdated
Comment thread R/luna_run.R Outdated
Comment thread R/luna_check.R
Comment thread vignettes/example-3-nlmixr2/project/run1.R Outdated
Comment thread vignettes/example-3-nlmixr2/project/run3.R Outdated
Comment thread vignettes/example-3-nlmixr2/project/run4.R Outdated
Comment thread vignettes/example-3-nlmixr2/project/run5.R
Comment thread vignettes/example-2-nm-psn/project/busulfan.yaml
Comment thread vignettes/example-1-nm-pharmpy/project/busulfan.yaml

@roninsightrx roninsightrx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Few minor things.

Comment thread R/luna_check.R
Comment thread vignettes/example-1-nm-pharmpy/luna_workflow_nm_pharmpy.R Outdated
Comment thread vignettes/example-3-nlmixr2/luna_workflow_nlmixr2.R Outdated
roninsightrx and others added 4 commits May 12, 2026 15:22
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>
Comment thread R/create_cache.R
"project", project
)

## read pharmpy configuration

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will add a comment to the code for better traceability.

Comment thread vignettes/example-1-nm-pharmpy/luna_workflow_nm_pharmpy.R Outdated

@roninsightrx roninsightrx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@JordanBrooks33 JordanBrooks33 merged commit 47e4912 into main Jun 29, 2026
2 checks passed
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.

3 participants