e-Campsis: a Shiny PK/PD model simulator based on Campsis
Nicolas Luyckx, Andreas Lindauer, Erno Van Schaick, Emilie Hénin-Devessiere, Stéphanie Blaizot-Besse, Pierre-Alexandre Noguine, Christian Laveille
Calvagone SAS, France
Introduction: e-Campsis (https://calvagone.github.io/ecampsis.html) is a free Shiny application developed by Calvagone [1] which allows an intuitive and user-friendly simulation of population PK/PD models. It is based on R package campsis [2], that provides a powerful backend to run model-based simulations with mrgsolve [3] or rxode2 [4].
Objectives:
- Create a generic web application that allows PK/PD model-based simulations to be run. This application can accept any Campsis model or dataset uploaded through the graphical interface. This makes it the ideal companion for showing interactive simulation results to third parties.
- Offer a model editor to further edit the model code and parameters online, and a dataset editor to generate simplified datasets on the fly.
- Embed a model library that comprises more than 100 models of all kinds (PK, PD, TMDD, etc.) for teaching purposes. Each model can be simulated straight away without any prerequired pharmacometrics programming knowledge.
- Automatically generate the corresponding R code of the simulation, for self-learning and reproducibility purpose. Consequently, the user can re-execute the simulation offline, using the open-source Campsis package.
Methods:
The e-Campsis simulator was built on top of Campsis. This package clearly defines, thanks to the S4 object system provided in R, what a pharmacometric model is and what a pharmacometric dataset is composed of. In addition, it provides many useful methods to manipulate these complex objects. Finally, Campsis offers a useful abstraction layer that delegates the simulation work to rxode2 or mrgsolve, at the user's choice.
The e-Campsis app currently comprises the 4 following tabs:
Model: in this tab, the user either selects a model from the library or uploads a model of his/her own. The respective model is shown in the model editor, that includes syntax highlighting and can be adapted further if required. Parameters appear in the form of dynamic JavaScript tables and can be modified as well.
Dataset: in this tab, the user has 2 possibilities: the dataset can be uploaded from the interface using an R snippet or can be automatically generated thanks to a simplified Shiny form. In this last case, the user can define the drug administrations (amounts, times, compartments, etc.) and the observation times. He/she can specify the covariates to be used and enter a dose adaptation formula if any.
Simulation: once the user has selected a model and configured the dataset, e-Campsis will run the simulation and plot the results, for any desired output(s) the user wants to see. This tab is divided into 3 graphical components. The first box allows the user to adapt any model parameter. The second box offers numerous settings to configure, among others: the variability components to include (IIV, RUV), the choice of a seed number, the choice of the simulation engine, the type of plot (spaghetti, shaded or scatter plot, etc.) and various stratification options. The third box displays the plot itself, either in its ggplot2 form or its interactive form using plotly.
Download: this tab allows the user to preview the generated R code and to download the entire project. Using this download, the user is able to reproduce the simulation results offline using Campsis (R code only).
Results:
Shiny application e-Campsis was released internally at Calvagone in 2022. This app will be made freely accessible for the pharmacometrics community in June 2023.
An advanced version is currently under development and will provide additional features like a persistence layer to save the state of the application (Shiny inputs, etc.), the integration of noncompartmental analysis (NCA), a model import feature from NONMEM, a custom analysis window. This advanced version will also benefit from the parallelization of Campsis for improved performance.
Conclusion:
The web-based application e-Campsis was developed to satisfy different needs: It allows the user to easily explore models available from the library, simulate simple design and learn Campsis thanks to the generated R code. Editing the models and simulating in real time facilitates the model building process. Eventually e-Campsis can greatly support the communication of modelling and simulation results with clinical teams by interactive simulations in meetings.
Designing such an application has been made simpler thanks to Campsis, which offers a framework to manipulate and simulate pharmacometric models and virtual datasets.
References:
[1] http://www.calvagone.com/
[2] https://github.com/Calvagone/campsis
[3] https://github.com/metrumresearchgroup/mrgsolve
[4] https://github.com/nlmixr2/rxode2