Objectives: Develop an Application Programming Interface (API) for pharmacometric simulations to enable model manipulation in R and read/write capabilities.
Create an API for structured pharmacometric datasets encapsulating data layers like treatment arms, dosing information, observations, inter-occasion variability, covariates, and interruption events, exportable to rxode2 [1], mrgsolve [2], or NONMEM.
Construct an abstraction layer over rxode2 and mrgsolve to simplify simulation setup, allowing configurations including scenarios, study replication, event interruptions, seed management, and post-processing.
Methods: Campsis [3] and campsismod [4] were programmed using the S4 object system in R. This system is relatively close to other object-oriented programming languages (e.g. Java, C++/C#, Python) and allows the definition of classes, inheritance and generic functions, which are the building blocks to design complex software.
Campsimod: Functions for loading, editing, and expanding models. Key functions like add(), replace(), and delete() manipulate model components scriptably, preserving reproducibility and automation. Multiple models can be combined into a single model code for PK/PD simulations or simulations for multiple compounds/formulations.
Campsis: Functions to define dosing regimens, observation schedules, and covariates. Specialized functions handle time-varying covariates, inter-occasion variability, bootstrapping, and dose adaptations. The Scenario() constructor facilitates the exploration of how changes to parameter values or other model components affect the results. The key function simulate() executes the actual simulation using rxode2 or mrgsolve.
Campsisnca: Handles simulation post-processing, deriving non-compartmental metrics like AUC, Cmax, Tmax from individual profiles. User-defined functions calculate metrics like the percentage of patients above/below a threshold, change from baseline, AUC ratios, etc. Summary statistics (geometric mean, CV%, etc.) are derived and shown in HTML tables using gtsummary [5].
Results: Campsismod and campsis were released on CRAN in early 2022 and are actively maintained and updated. These packages come with extensive documentation to facilitate self-learning. Both packages are extensively tested with around 90% code coverage. Most simulation tests are executed twice, with rxode2 and mrgsolve, ensuring identical results from both engines.
Conclusion: The Campsis suite is a robust collection of R-packages facilitating the generation, execution and post-processing of PK/PD simulations. The modular and object-oriented programming, with mostly self-explanatory names, support the writing of well-structured, understandable and consistent simulation code. An intuitive graphical user interface is freely available at www.e-campsis.com facilitating the simulation setup with the option to download the auto-generated R-code for further adaptation and self-learning.