| Title: | Interactive Platform for Pharmacometrics Model Visualization and Simulation |
|---|---|
| Description: | An interactive 'shiny' application for exploring pharmacometrics models with minimal setup. Users can explore model structures, parameters and dosing regimens with 'mrgsolve', and compare simulations with observed data. Additional features include parameter sensitivity analysis, non-compartmental analysis (NCA), data exploration, variability assessment with virtual populations, and optional AI-assisted model translation. For design considerations of the app, see Choy et al. (2025) <doi:10.1002/psp4.70023>. |
| Authors: | Steve Choy [aut, cre, cph], Jin Gyu Kim [aut], Matthew Fidler [ctb], Jason Bryer [ctb, cph] (Author of the ShinyDemo package, from which run_mvp() is adapted) |
| Maintainer: | Steve Choy <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.0 |
| Built: | 2026-10-19 01:35:39 UTC |
| Source: | https://github.com/stevechoy/MVPapp |
A virtual pediatric population (birth to 20 years) simulated from the US Centers for Disease Control and Prevention (CDC) growth charts. Used by the app to sample age, weight and height when the "CDC" database is selected for variability simulations.
cdc.expandcdc.expand
A data frame with 97,177 rows and 6 columns:
Sex: 0 = male, 1 = female.
Age (months).
Age (years).
Body weight (kg).
Length/stature (cm).
Body mass index (kg/m).
Body weight and stature were simulated from the published LMS parameters
(Box-Cox power, median and coefficient of variation) of the weight-for-age
and stature-for-age charts for each sex and month of age, by drawing
standard normal Z-scores and applying . Rows
with implausible BMI (outside 10 to 50 kg/m) were removed. See
data-raw/databases.R in the
GitHub repository
for the code.
CDC growth charts, percentile data files with LMS values: https://www.cdc.gov/growthcharts/percentile_data_files.htm.
Sex, age, body weight and height of participants in the US National Health and Nutrition Examination Survey (NHANES), cycles 1999-2000 to 2021-2023, aged 2 years and older. Used by the app to sample age, weight and height when the "NHANES" database is selected for variability simulations.
nhanes.filterednhanes.filtered
A data frame with 101,400 rows and 5 columns:
Sex: 0 = male, 1 = female.
Age (months), derived from AGEYR.
Age (years).
Body weight (kg).
Standing height (cm).
Demographics and body measures files were merged by participant
and only complete records were kept. Age is recorded in whole years, so
AGEMO is AGEYR * 12. See
data-raw/databases.R in the
GitHub repository
for the code.
Centers for Disease Control and Prevention (CDC), National Center for Health Statistics, National Health and Nutrition Examination Survey: https://wwwn.cdc.gov/nchs/nhanes/Default.aspx.
run_mvp() launches the MVP app. mvp_app() returns the app as a Shiny app
object without running it, e.g. for deployment on Posit Connect or
shinyapps.io (an app.R containing MVPapp::mvp_app() is sufficient).
The app is evaluated in its own environment (whose parent gives access to MVPapp and its key dependencies), so neither the global environment nor the search path is modified. Global options changed by the app are set when it starts and restored when it stops.
mvp_app( appDir = system.file("shiny", package = "MVPapp"), insert_watermark = TRUE, max_dataset_size = 200, authentication_code = NA_character_, internal_version = TRUE, pw_models_path = NA_character_, llm_choices = c("Claude", "Gemini", "OpenAI", "OpenRouter", "OpenAI-Compatible", "DeepSeek", "Azure OpenAI", "AWS Bedrock"), api_upload = NA_character_, api_chat = NA_character_, user_id = "MVP_user", reuse_context = FALSE, model_gemini = "gemini-3.8-flash", model_openai = "gpt-6.1-sol", model_anthropic = "claude-sonnet-5-5", model_openrouter = "arcee-ai/trinity-large-preview:free", model_openai_compatible = "gpt-5.2", model_deepseek = "deepseek-flash", model_apollo = "claude_4_6_sonnet", model_azure = "gpt-5.2", model_aws = "anthropic.claude-sonnet-5", temperature = 1, llm_seed = 42, model_lang = c("mrgsolve", "nonmem", "rxode2"), prompts_path = system.file("shiny/prompts.R", package = "MVPapp"), show_debugging_msg = FALSE, brand_color = NULL, brand_text_color = NULL, brand_logo = NULL, brand_favicon = NULL, page_title = NULL, ... ) run_mvp( appDir = system.file("shiny", package = "MVPapp"), insert_watermark = TRUE, max_dataset_size = 200, authentication_code = NA_character_, internal_version = TRUE, pw_models_path = NA_character_, llm_choices = c("Claude", "Gemini", "OpenAI", "OpenRouter", "OpenAI-Compatible", "DeepSeek", "Azure OpenAI", "AWS Bedrock"), api_upload = NA_character_, api_chat = NA_character_, user_id = "MVP_user", reuse_context = FALSE, model_gemini = "gemini-3.8-flash", model_openai = "gpt-6.1-sol", model_anthropic = "claude-sonnet-5-5", model_openrouter = "arcee-ai/trinity-large-preview:free", model_openai_compatible = "gpt-5.2", model_deepseek = "deepseek-flash", model_apollo = "claude_4_6_sonnet", model_azure = "gpt-5.2", model_aws = "anthropic.claude-sonnet-5", temperature = 1, llm_seed = 42, model_lang = c("mrgsolve", "nonmem", "rxode2"), prompts_path = system.file("shiny/prompts.R", package = "MVPapp"), show_debugging_msg = FALSE, brand_color = NULL, brand_text_color = NULL, brand_logo = NULL, brand_favicon = NULL, page_title = NULL, ... )mvp_app( appDir = system.file("shiny", package = "MVPapp"), insert_watermark = TRUE, max_dataset_size = 200, authentication_code = NA_character_, internal_version = TRUE, pw_models_path = NA_character_, llm_choices = c("Claude", "Gemini", "OpenAI", "OpenRouter", "OpenAI-Compatible", "DeepSeek", "Azure OpenAI", "AWS Bedrock"), api_upload = NA_character_, api_chat = NA_character_, user_id = "MVP_user", reuse_context = FALSE, model_gemini = "gemini-3.8-flash", model_openai = "gpt-6.1-sol", model_anthropic = "claude-sonnet-5-5", model_openrouter = "arcee-ai/trinity-large-preview:free", model_openai_compatible = "gpt-5.2", model_deepseek = "deepseek-flash", model_apollo = "claude_4_6_sonnet", model_azure = "gpt-5.2", model_aws = "anthropic.claude-sonnet-5", temperature = 1, llm_seed = 42, model_lang = c("mrgsolve", "nonmem", "rxode2"), prompts_path = system.file("shiny/prompts.R", package = "MVPapp"), show_debugging_msg = FALSE, brand_color = NULL, brand_text_color = NULL, brand_logo = NULL, brand_favicon = NULL, page_title = NULL, ... ) run_mvp( appDir = system.file("shiny", package = "MVPapp"), insert_watermark = TRUE, max_dataset_size = 200, authentication_code = NA_character_, internal_version = TRUE, pw_models_path = NA_character_, llm_choices = c("Claude", "Gemini", "OpenAI", "OpenRouter", "OpenAI-Compatible", "DeepSeek", "Azure OpenAI", "AWS Bedrock"), api_upload = NA_character_, api_chat = NA_character_, user_id = "MVP_user", reuse_context = FALSE, model_gemini = "gemini-3.8-flash", model_openai = "gpt-6.1-sol", model_anthropic = "claude-sonnet-5-5", model_openrouter = "arcee-ai/trinity-large-preview:free", model_openai_compatible = "gpt-5.2", model_deepseek = "deepseek-flash", model_apollo = "claude_4_6_sonnet", model_azure = "gpt-5.2", model_aws = "anthropic.claude-sonnet-5", temperature = 1, llm_seed = 42, model_lang = c("mrgsolve", "nonmem", "rxode2"), prompts_path = system.file("shiny/prompts.R", package = "MVPapp"), show_debugging_msg = FALSE, brand_color = NULL, brand_text_color = NULL, brand_logo = NULL, brand_favicon = NULL, page_title = NULL, ... )
appDir |
Character. Directory containing the app's |
insert_watermark |
Logical. Default TRUE. Set to FALSE to remove the "For Internal Use Only" watermark from simulation plots and NCA reports. |
max_dataset_size |
Numeric. Default 200. Maximum upload dataset size in MB. |
authentication_code |
Character. Default NA_character_. Provide a string (e.g., password) to password-lock the entire app. |
internal_version |
Logical. Default TRUE. Set to FALSE when hosting the app on a server (e.g. AWS) where the working directory is not writable: NCA reports are then written to the session's temporary directory, and the help text for locked models points to GitHub instead. For internal deployments, it also selects the external Apollo endpoint. |
pw_models_path |
Character. Default NA_character_. Path to an R file defining password-gated models
(see |
llm_choices |
Character vector of LLM providers offered in the app; the first one is selected by default. Defaults to all supported providers: "Claude", "Gemini", "OpenAI", "OpenRouter", "OpenAI-Compatible", "DeepSeek", "Azure OpenAI" and "AWS Bedrock". Internal-deployment providers (e.g. "PMx Co-Modeler", "Apollo") are also accepted. |
api_upload |
Character. Default NA_character_. API upload URL when using Dify-based workflows (internal deployment only) |
api_chat |
Character. Default NA_character_. Base URL required when using OpenAI-Compatible providers, e.g. "https://api.moonshot.ai/v1" ("/chat/completions" is appended automatically) |
user_id |
Character. Default MVP_user. User ID for LLMs |
reuse_context |
Logical. Default FALSE. Set to TRUE to re-use same conversation during retries. |
model_gemini |
Character. Default gemini-3.8-flash. Model for Gemini. |
model_openai |
Character. Default gpt-6.1-sol. Model for OpenAI / ChatGPT. |
model_anthropic |
Character. Default claude-sonnet-5-5. Model for Anthropic / Claude. |
model_openrouter |
Character. Default arcee-ai/trinity-large-preview:free. Model for OpenRouter. |
model_openai_compatible |
Character. Default gpt-5.2. Model for OpenAI-compatible providers. |
model_deepseek |
Character. Default deepseek-flash. Model for DeepSeek. |
model_apollo |
Character. Default claude_4_6_sonnet. Model for Apollo (internal deployment only). |
model_azure |
Character. Default gpt-5.2. Model for Azure OpenAI. |
model_aws |
Character. Default anthropic.claude-sonnet-5. Model for AWS Bedrock. |
temperature |
Numeric. Default 1. Between 0 (more deterministic) and 1 (more creative) (not all models support this). |
llm_seed |
Numeric. Default 42. Seed number for LLMs (not all models support this). |
model_lang |
Character. Default "mrgsolve" (the first element). Model translation language: "mrgsolve", "nonmem" (for testing only) or "rxode2" (for testing only). |
prompts_path |
Character. Path to an R file defining the LLM prompts. Defaults to the prompts installed with
MVPapp. See |
show_debugging_msg |
Logical. Default FALSE. Set to TRUE to output verbose working messages in the console, useful for debugging. AI translation responses are then also kept for review (see Details). |
brand_color |
Character. Default NULL (the default navy). A colour, e.g. |
brand_text_color |
Character. Default NULL. Colour of the text on |
brand_logo |
Character. Default NULL (no logo). Path to an image file (png, jpg, svg, ...) or a web URL, shown in the navbar in front of the page title. |
brand_favicon |
Character. Default NULL (the MVP icon shipped with the package). Path to an image file (png, ico, svg) or a web URL, used as the browser tab icon. |
page_title |
Character. Default NULL ("Model Visualization Platform (MVP)"). Title shown in the navbar. When set, it is also used as the browser tab title. |
... |
For |
Objects kept for debugging. MVPapp does not write to the global
environment. Objects useful for debugging are kept in an internal
environment, MVPapp:::.mvp_state, and remain available in the R session
after the app is closed. List them with ls(MVPapp:::.mvp_state):
last_ev_df$model_1, last_ev_df$model_2: the dosing event tables used
in each model's most recent simulation (also used for the reproducible
bundle download).
deps_env: an internal cache used to run the app; not useful for debugging.
With show_debugging_msg = TRUE, AI translation responses: llm_result
(initial translation), llm_refine (latest retry that still failed),
llm_success (Dify's reply when told the code compiled), branch_model / branch_refine (raw
answers before cleaning) and ellmer_chat_response /
dify_chat_response (raw chat responses).
Branding. For a company deployment, the title, colour, logo and favicon can be set when
launching, without editing any package files. Each is optional; with all of them left at
NULL the app looks as it always did.
run_mvp(brand_color = "#F36633",
brand_logo = "path/to/company_logo.png",
brand_favicon = "path/to/favicon.png",
page_title = "Company Model Visualization Platform")
Image files are read from where they are and served by the app, so they do not need to be
inside the package (a web URL also works). A logo with a transparent background and a
height of about 30 pixels or more works best. brand_color replaces the navy in the
navbar, the active tab, the headers and borders of the panels, the data table headers and the
loading spinners. The same arguments work with mvp_app() for hosted deployments.
Hosting and security. MVPapp evaluates R and C++ model code supplied
in the browser, so anyone who can open the app can run code on the server
under the server account. authentication_code and the model passwords
are a convenience to limit access to the interface and to hide models, not
a security boundary: host the app only for trusted users, in a sandboxed
account or container. The same applies to AI translation: its output is
compiled automatically, and compiling mrgsolve code can itself run
commands, so do not translate documents from untrusted sources on a
shared server.
Without installing MVPapp (e.g. where package installation is restricted),
the development version can also be launched from GitHub, provided its
dependencies are installed:
shiny::runGitHub("MVPapp", "stevechoy", subdir = "inst/shiny").
run_mvp() is called for its side effect of launching the app and
returns the value of shiny::runApp() invisibly once the app is closed.
mvp_app() returns a Shiny app object (class shiny.appobj).
https://stevechoy.github.io/MVPapp/articles/supply-passwords.html
https://stevechoy.github.io/MVPapp/articles/automatic-translation.html
chat for LLM chat interface.
if (interactive()) { run_mvp(insert_watermark = FALSE) # remove watermarks # Other examples: # run_mvp(launch.browser = FALSE) # do not open a browser (argument passed to runApp) # run_mvp(authentication_code = "some_password") # Password-lock the site, # # could be useful in deployment # run_mvp(pw_models_path = "path/to/your/private/models.R") # see # system.file("shiny/passworded_models_example.R", package = "MVPapp") # run_mvp(llm_choices = "Claude", model_anthropic = "claude-sonnet-5-5", # temperature = 0) # Uses Claude only with reproducible results } # App object, e.g. as the only line of an app.R file for deployment: app <- mvp_app(insert_watermark = FALSE)if (interactive()) { run_mvp(insert_watermark = FALSE) # remove watermarks # Other examples: # run_mvp(launch.browser = FALSE) # do not open a browser (argument passed to runApp) # run_mvp(authentication_code = "some_password") # Password-lock the site, # # could be useful in deployment # run_mvp(pw_models_path = "path/to/your/private/models.R") # see # system.file("shiny/passworded_models_example.R", package = "MVPapp") # run_mvp(llm_choices = "Claude", model_anthropic = "claude-sonnet-5-5", # temperature = 0) # Uses Claude only with reproducible results } # App object, e.g. as the only line of an app.R file for deployment: app <- mvp_app(insert_watermark = FALSE)
A virtual pediatric population (birth to 10 years) simulated from the World Health Organization (WHO) Child Growth Standards and Growth Reference. Used by the app to sample age, weight and height when the "WHO" database is selected for variability simulations.
who.expandwho.expand
A data frame with 77,744 rows and 6 columns:
Sex: 0 = male, 1 = female.
Age (months).
Age (years).
Body weight (kg).
Length/height (cm).
Body mass index (kg/m).
Body weight and height were simulated from the published LMS parameters
(Box-Cox power, median and coefficient of variation) for each sex and month
of age, by drawing standard normal Z-scores and applying
. Sources:
Weight-for-age, 0 to 10 years.
Length/height-for-age, 0 to 5 years (Child Growth Standards) and 5 to 10 years (Growth Reference 5-19 years).
Rows with implausible BMI (outside 10 to 50 kg/m) were removed. See
data-raw/databases.R in the
GitHub repository
for the code.
WHO Child Growth Standards: https://www.who.int/toolkits/child-growth-standards/standards/weight-for-age, https://www.who.int/toolkits/child-growth-standards/standards/length-height-for-age. WHO Growth Reference 5-19 years: https://www.who.int/toolkits/growth-reference-data-for-5to19-years/indicators/height-for-age.