Skip to content

Token replay animation for process maps created with processmapR by using SVG animations (SMIL) and the htmlwidget package.

License

Notifications You must be signed in to change notification settings

gertjanssenswillen/processanimateR

 
 

Repository files navigation

processanimateR

Flexible token replay animation for process maps

CRAN_Status_Badge lifecycle

Flexible token replay animation for process maps created through the processmapR package from the bupaR suite. This package uses htmlwidgets and SVG animations (SMIL) to create the animation. Sizes, colors, and the image used for tokens are customizable based on trace, event attributes, or a secondary data frame if an attribute does not change according to the original event log.

Getting Started

Installing

ProcessanimateR is not yet available on CRAN. Please use the remotes package or similar means to install it directly from source.

# install the remotes package
source("https://install-github.me/r-lib/remotes")

# use remotes to install the latest version of processanimateR
remotes::install_github("fmannhardt/processanimateR")

# or install a specific tag
remotes::install_github("fmannhardt/[email protected]")

Usage

There are two main functions: animate_process and ianimate_process (interactive version).

We use the patients event log provided by the eventdataR package.

library(processanimateR)
library(eventdataR)
data(patients)

A basic animation with static color and token size:

animate_process(patients)

Default token color or size can be changed as follows:

animate_process(patients, token_size = 2)
animate_process(patients, token_color = "red")

Dynamic token color or size can be achieved as follows:

animate_process(add_token_color(patients, "time", "color"), token_color = "color")
animate_process(add_token_color(patients, "employee", "color", color_mapping = scales::col_factor("Paired", patients$employee)),
                token_color = "color")

There is also an interactive variant that starts a Shiny web-application. It expects that attributes are of an apropriate data type to choose a good color scale.

library(edeaR)
library(dplyr)
ianimate_process(sepsis %>%
 filter_trace_frequency(percentage = 0.3) %>%
 # we fix the datatype of some of the attributes to allow proper rendering of the token color
 # the token size option currently only support numeric attributes
 mutate_at(c("lacticacid", "leucocytes", "crp", "age"), as.numeric) %>%
 mutate_at(c("disfuncorg", "sirscriteria2ormore", "infectionsuspected"), as.logical))

Libraries Used

This package makes use of the following libraries:

  • d3, to dynamically changing the SVG;
  • fakesmil, to provide SMIL support in most browsers;
  • svg-pan-zoom, for the panning/zooming option;
  • viz, to compile the DOT generated by processmapR in JavaScript;
  • bupaR, for the base Process Mining functions in R.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Felix Mannhardt (SINTEF Læring og beslutningsstøtte)

License

This software is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

This software was developed in the HUMAN project, which has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 723737 (HUMAN)

About

Token replay animation for process maps created with processmapR by using SVG animations (SMIL) and the htmlwidget package.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 85.2%
  • R 14.8%