Selections made in the processanimateR animation be used as input by Shiny applications. Here a simple example in which a Shiny module is created that renders the case identifiers of selected tokens and the identifiers and names of selected activities:
library(shiny)
library(processanimateR)
library(eventdataR)
library(jsonlite)
<- function(eventlog, min.time = 30, max.time = 600, default.time = 60) {
shinyAnimation
# Define Shiny Module
<- function(id, title) {
animationUI <- NS(id)
ns tagList(
h2(title),
processanimaterOutput(ns("process")),
h4("Selected cases"),
textOutput(ns("token_selection")),
h4("Selected activities"),
textOutput(ns("activity_selection")),
h4("Current time"),
textOutput(ns("activity_time"))
)
}
<- function(input, output, session, ...) {
animation
$token_selection <- renderText({
outputif (is.null(input$process_tokens)) {
"None"
else {
} paste0(input$process_tokens, collapse = ",")
}
})
$activity_selection <- renderText({
outputif (is.null(input$process_activities)) {
"None"
else {
} <- jsonlite::fromJSON(input$process_activities)
activities paste0("(", activities$id, ",", activities$activity, ")", collapse = ",")
}
})
$activity_time <- renderText({
outputif (is.null(input$process_time)) {
"0"
else {
} $process_time
input
}
})
$process <- renderProcessanimater(expr = {
outputanimate_process(eventlog, ...)
})
}
<- fluidPage(
ui animationUI("module1", "Relative"),
animationUI("module2", "Absolute")
)
# Two animations
<- function(input, output, session) {
server callModule(animation, "module1", mode = "relative")
callModule(animation, "module2")
}
shinyApp(ui, server, options = list(height = 500))
}
shinyAnimation(patients)