Interactive Web Applications
The interactive Pumas web applications can be accessed via the PumasApps
module which can be loaded with
julia> using PumasApps
Once loaded we can access the default application by evaluating
julia> PumasApps.Workspace.default()
which will display a URL that links to the web app running the default workspace. This workspace is always available, but you can also create separate workspaces by evaluating
julia> ws1 = PumasApps.Workspace.new()
which will create a new workspace application that will be accessible from a different URL, which will have been printed to the REPL when evaluating the previous code. Always assign these workspaces to a variable, here we have used ws1
, since this allows us to easily close workspaces that we do not require anymore. Workspaces that you do not require anymore can be closed by calling
julia> close(ws1)
where ws1
is the variable name you provided when creating a particular workspace using PumasApps.Workspace.new()
.
It is not essential to make use of separate workspaces within a single Julia session and you can typically complete any tasks with just the default workspace.
Navigating the Web Application
When clicking on the printed URL for any of the web applications a browser tab will open onto the "Home" screen of the web app. From there you have several options.
We're presented with several elements on this page.
A collection of tile links in the main body of the screen that link to the individual single-purpose apps available from within the web interface, along with short descriptions of their purposes.
A left sidebar containing quick links to these same single-purpose apps.
A top appbar that contains a
?
link and, when the application is running tasks, a loading indicator.
The ?
link at the top right should be your first stop when initially exploring what the application has to offer. When you click it, it will open up an overlay navigation system that explains the different elements on the screen and their functionality.
Spend some time reading through the "tour" since it will explain in much more detail the individual parts of the application than we can within this standalone documentation.
Each screen within the application has access to this same tour system, tailored to the content of that specific screen. You can make use of the tour at any point during your usage of the app and you won't lose any work by activating it so long as you do not navigate to another page while doing so.
Screens Overview
We provide a brief overview of the individual screens available in the application and what they are used for, but note that the detailed information regarding how to use each single-purpose app is available from the ?
in the top right corner of each screen and should be your main reference for usage information.
Session Explorer
This screen provides a summary of the available Pumas "objects" that are currently defined within your Julia REPL, as well as those available for use in your workspace that the web app has access to.
Objects can be imported and exported between the REPL and the workspace. You can also "delete" objects from either to reclaim memory should you need to do so.
All the other single-purpose apps can also access objects that are available directly in your app's workspace, not the Julia REPL, so you must first import the objects that you need into the workspace before making use of them.
The Session Explorer
application can also be accessed via the list_models()
function.
julia> lm1 = list_models()
This will provide a URL direct to the Session Explorer
screen where you can then select a collection of objects from the "Session" table. After this you can use the selected_models
function to extract and pack those objects into a single NamedTuple
that can be passed on to other functions.
julia> selected_models(lm1)
PumasApps.Workspace.API.list_models
— Functionlist_models()
Opens up the default workspace app to the session explorer page which will list all available models and fits currently visible in the app and the REPL. Users can then import/export and delete specific objects from the app and REPL.
Data Loader
This app allows you to load a CSV data file from a folder called data
in your present working directory (pwd()
) into a DataFrame
object. This is the first step towards creating Pumas Population
objects for use in simulations.
You can also select data to load from the range of data files provided by the PharmaDatasets
package.
Model Builder
You can create Pumas models, usually creating via the @model
macro in the coding interface for Pumas, from this application screen. This app lets you select from a collection of dropdown menus the characteristics that you would like your model to have.
The automatically generated code for the model, or the mathematical representation of the model can be viewed below the model inputs.
Population Builder
This application can take the outputs from the Data Loader
application to create Pumas Population
objects for use in simulations. It also allows you to view some basic diagnostics plots of the generated populations.
Estimates
The estimates application lets you perform simobs
interactively while seeing the plotted results in real-time.
This Estimates
screen can also be accessed via the explore_estimates
function which will, given a model, population, and parameters, pre-import those objects into the workspace from the REPL and provide a URL that will pre-select those names when opened.
julia> ee1 = explore_estimates(model, population, parameters)
After adjusting the parameter values interactively inside the application you can then access those values programmatically via the coef
and DataFrame
functions:
julia> coef(ee1)
and
julia> DataFrame(ee1)
PumasApps.Workspace.API.explore_estimates
— Functionexplore_estimates(model, population | subject)
Load the given model
and population
or subject
into the default workspace app and provide a browser link that will open the estimates page with the requested objects pre-selected for use.
Diagnostics
This application allows for interactively viewing numerous diagnostics plots and tables of Pumas objects, as well as comparing the outputs between different objects side-by-side.
You can also make use of this interface to generate standardized PDF reports based on the compared objects as well as launch interactive notebooks that allow you to write and export your own documents based on the selected objects.
The evaluate_diagnostics
function can be used to help you programmatically import Pumas objects into the workspace from the REPL.
PumasApps.Workspace.API.evaluate_diagnostics
— Functionevaluate_diagnostics([app,] objects; inspect, infer)
Load analysis results from the REPL into the default workspace app to be viewed in the diagnostics page. The names visible in the application will be the same as those that are chosen as keywords when calling evaluate_diagnostics
.
If any of the names are already in use in the app then an error will be thrown and alternative names should be picked instead.
Interactive Pluto Notebooks
The PumasUtilities
package provides access to several functions for launching and interacting with Pluto notebooks which you can use to author content for reports.
julia> using PumasUtilities
Loading PumasUtilities
makes the following documented functions available.
AppServer.JuliaHubPlutoApp.notebook
— Functionnotebook(file::String)
Create or open a Pluto
notebook at the given file
path (which should end with the .jl
extension). When the file does not already exist it is created and then opened, otherwise it is just opened without overwriting it.
This function will return a link that can be opened in your web browser to view, edit, and run your code.
AppServer.JuliaHubPlutoApp.notebooks
— Functionnotebooks()
Get a link to view the list of all running notebooks. This allows you to stop any running notebooks.
AppServer.JuliaHubPlutoApp.send_to_notebook
— Functionsend_to_notebook(file; objects...)
Send the objects
to the running notebook file
. This function will throw an error if any of the objects
are not able to be sent to the notebook.
After sending objects
to file
you may access them from the Main
module variable defined in the notebook, i.e Main.model
if you send the variable model
to the notebook.
AppServer.JuliaHubPlutoApp.fetch_from_notebook
— Functionfetch_from_notebook(file, vars...)
Try to retrieve the values defined in the given variables vars
found in the running notebook file
. When any of the variables do not exist, or are unable to be returned, this function will throw an error.