Code Monkey home page Code Monkey logo

processanimater's Introduction

bupaverse

CRAN status GitHub version R-CMD-check Lifecycle: experimental

The bupaverse is an open-source, integrated suite of R-packages for handling and analysing business process data, developed by the Business Informatics research group at Hasselt University, Belgium. Profoundly inspired by the tidyverse package, the bupaverse package is designed to facilitate the installation and loading of multiple bupaverse packages in a single step. Learn more about bupaverse at the bupaR.net homepage.

Installation

You can install bupaverse from CRAN with:

install.packages("bupaverse")

Development Version

You can install the development version of bupaverse from GitHub with:

# install.packages("devtools")
devtools::install_github("bupaverse/bupaverse")

Usage

library(bupaverse) will load the core bupaverse packages:

  • bupaR: Core package for business process analysis.
  • edeaR: Exploratory and descriptive analysis of event-based data.
  • eventdataR: Repository of sample process data.
  • processcheckR: Rule-based conformance checking and filtering.
  • processmapR: Visualise event-based data using, i.a., process maps.

An overview of the loaded packages and conflicts with other packages is shown after loading bupaverse:

library(bupaverse)
#> 
#> .______    __    __  .______      ___   ____    ____  _______ .______          _______. _______
#> |   _  \  |  |  |  | |   _  \    /   \  \   \  /   / |   ____||   _  \        /       ||   ____|
#> |  |_)  | |  |  |  | |  |_)  |  /  ^  \  \   \/   /  |  |__   |  |_)  |      |   (----`|  |__
#> |   _  <  |  |  |  | |   ___/  /  /_\  \  \      /   |   __|  |      /        \   \    |   __|
#> |  |_)  | |  `--'  | |  |     /  _____  \  \    /    |  |____ |  |\  \----.----)   |   |  |____
#> |______/   \______/  | _|    /__/     \__\  \__/     |_______|| _| `._____|_______/    |_______|
#>                                                                                                 
#> ── Attaching packages ─────────────────────────────────────── bupaverse 0.1.0 ──
#> ✔ bupaR         0.5.2     ✔ processcheckR 0.2.0
#> ✔ edeaR         0.9.1     ✔ processmapR   0.5.2
#> ✔ eventdataR    0.3.1     
#> ── Conflicts ────────────────────────────────────────── bupaverse_conflicts() ──
#> ✖ bupaR::filter()          masks stats::filter()
#> ✖ processmapR::frequency() masks stats::frequency()
#> ✖ edeaR::setdiff()         masks base::setdiff()
#> ✖ bupaR::timestamp()       masks utils::timestamp()
#> ✖ processcheckR::xor()     masks base::xor()

processanimater's People

Contributors

fmannhardt avatar gertjanssenswillen avatar richardpilbery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

processanimater's Issues

Must call bupaR::to_eventlog() when using absolute or relative animation mode

Create activity log

activities <- df %>%
bupaR::activitylog(case_id = "order_id", activity_id = "activity_id", timestamps = c("start", "complete"), resource_id = "resource_id")

Works when mode = "off" but breaks when mode = "absolute" or "relative"

activities %>%
processanimateR::animate_process(rankdir = "TD", mode = "off", initial_state = "paused")

activities %>%
processanimateR::animate_process(rankdir = "TD", mode = "absolute", initial_state = "paused")

  • processanimateR::animate_process(rankdir = "TD", mode = "absolute", initial_state = "paused")
    Warning: Object is activity log. Timestamps are stored in 0 columns.Error in rlang::sym():
    ! Can't convert NULL to a symbol.
    Backtrace:
  1. activities %>% ...
  2. processanimateR:::timestamp_(eventlog)
  3. rlang::sym(bupaR::timestamp(eventlog))

The workaround is to convert to eventlog()

activities %>%
bupaR::to_eventlog() %>%
processanimateR::animate_process(rankdir = "TD", mode = "absolute", initial_state = "paused")

Repeating Activity/Node selection multiple times!

Hello Felix,
I am using the activity selection functionality in my app multiple times.
For the moment, when an activity is selected (clicked), it generates a reactive message through JS callback function (input$process_activities) which I can use this in my shiny app. However if the user click on the same activity again for the second time this (input$process_activities) is not generated. Probably it is because this activity is already selected.
However I need to use this (input$process_activities) in my app even if the node is already selected.
I can modify the JS function to fulfill this purpose, if I know where to look for it. Can you please help directing me to the correct JS file which generates (input$process_activities), so that I can tailor it for my app?
Thanks in advance,

Cannot integrate process animation into flexdashboard and combine with process_map

This is similar to this issue: #5

I cannot integrate a process animation into a flexdashboard and combine it with a process map. When knitting the following code, I get this error message under the Process map tab:

"TypeError: Cannot call a class as a function"

In the Animation tab the slider is shown moving, but the animation is not visible:

---
title: "Title"
output:
  flexdashboard::flex_dashboard
---

```{r setup, include=FALSE}
library(tidyverse)
library(bupaR)
library(flexdashboard)
library(processanimateR)
```

**Process map**
===============
```{r}
patients %>% process_map()
```

**Animation**
===========
```{r}
patients %>% animate_process()
```

When I reverse the order of the two tabs, the animation is shown and the same error message appears under the Process map tab.

When just using either the process_map or the animation alone, everything works.

I'm using the latest package versions from CRAN and the Chrome browser.

Animate queue length on activities

I would like to show queue lengths during playback and perhaps change the text of the activities or edges accordingly. For example, in the animate_process(patients, mode = "relative") example, it can be hard to see how many patients are actually started on an activity or between any two activities at a given time. I can think of two approaches to this:

  • Specific: support something like animate_process(patients, activity_queue = TRUE, edge_queue = FALSE).
  • Generic: support something like animate_process(patients, activity_show_latest_event_attribute = "queue_length") where queue_length is then an event attribute in the eventlog. The user can then code the queues into event attributes themselves - or any other attribute they may want to display.

We visualize an assembly lines where there are physical constraints on the number of tokens that can reside at a given edge. This feature would be great at visualizing bottlenecks and their causes.

Migrate from SMIL animations to WebGL or Canvas

SMIL animation was a nice idea to have not to care about the details of how to animate and has hardware support at least in Chrome, but it has its limits is not developed further and prevents from animating a really large number of tokens.

There are some alternatives with WebGL and/or Canvas. Should be explored how a library like PixieJS could be used.

Time out of sync in animate_process?

I am trying to create an animated process map that gives us insight on if ER episodes that begin at a certain time of the day tend to pile up based on staffing patterns. In other words, we want to see if overnight episodes pile up in the morning.

To do this, we thought, in our data, to create a flag for when the episode starts and color-code the bubble in animate_process accordingly.

Unfortunately, it seems like the process map might go out-of-sync over time (it's also entirely possible there is a detail of using animate_process that I've missed). I think the time-of-day labels are correct, but the timeline might become inaccurate over time? Or timezones could be at play?

Can you take a look at the code below that I wrote based on the patients dataset?

That patient ids that stuck out to me in this test dataset were 243 and 244. Are we missing something?

library(tidyverse)
library(lubridate)
library(processanimateR)
library(bupaR)

patients_df <- patients %>% as_tibble()

time_of_day_labels <- patients %>%
  as_tibble() %>%
  filter(handling == "Registration" &
           registration_type == "start") %>%
  select(patient, time) %>% 
  mutate(time_of_day_registration = 
           cut(
             x = hour(time),
             breaks = c(0, 5, 11, 17, 23),
             labels = c("0-6", "6-12", "12-18", "18-24"),
             include.lowest = TRUE
           )) %>% 
  select(-time) %>%
  unique()

patients_rev <- patients %>% 
  left_join(time_of_day_labels, "patient") %>%
  as_tibble() %>%
  eventlog(
    case_id = "patient",
    activity_id = "handling",
    activity_instance_id = "handling_id",
    lifecycle_id = "registration_type",
    timestamp = "time",
    resource_id = "employee")

animate_process(
  patients_rev,
  duration = 2500,
  legend = "color",
  mapping = token_aes(
    color = token_scale(
      "time_of_day_registration",
      scale = "ordinal",
      range = RColorBrewer::brewer.pal(4, "Paired")
    )
  )
)

Token/Activity input selection inconsistent ordering

I've noticed that when selecting the input tokens or activities in a shiny app there seems to be inconsistencies with the ordering they are applied in when multiple elements are selected.

token_order

I was expecting the order they get added would be in sequence that the user clicks them so either appended to the end of the vector or inserted at beginning.

I was attempting to dynamically display additional information based on the token/activity selected, but allow user to continue clicking through different elements and see the relative sections be updated based on the selected value. I did try various things to try capture the list before it changes and after, but I couldn't handle all the scenarios.

Below is a modification to your vignette or example available on https://jessevent.shinyapps.io/loan-process/ where when clicking on the elements you can see the drill-through sections doesn't update after randomly selecting a few sequences of inputs.

Thanks

library(shiny)
library(processanimateR)
library(eventdataR)
library(jsonlite)
library(timevis)
library(tidyverse)
library(bupaR)

shinyAnimation <- function(eventlog, min.time = 30, max.time = 600, default.time = 60) {
  animationUI <- function(id, title) {
    ns <- NS(id)
    tagList(
      h2(title),
      processanimaterOutput(ns("process")),
      h4("Selected cases"),
      textOutput(ns("token_selection")),
      h4("Selected activities"),
      textOutput(ns("activity_selection")),
      fluidRow(
        h2(textOutput(ns("activity_title"))),
        column(4, h3("Resources"), verbatimTextOutput(ns("activity_count"))),
        column(4, h3("Processing Time"), verbatimTextOutput(ns("activity_pro_time"))),
        column(4, h3("Throughput Time"), verbatimTextOutput(ns("activity_thr_time"))),
        timevisOutput(ns("activity_timeline"))),
      fluidRow(
        h2(textOutput(ns("patient_selection"))),
        timevisOutput(ns("timeline")))
    )
  }

  animation <- function(input, output, session, ...) {

    output$token_selection <- renderText({
      if (is.null(input$process_tokens)) {
        "None"
      } else {
        paste0(input$process_tokens, collapse = ",")
      }
    })

    time_log <- reactive({
      tokens <- tail(input$process_tokens, 1)
      log <- eventlog %>% as.data.frame() %>%
        subset(patient == as.character(tokens)) %>%
        select(handling_id, handling, registration_type, time) %>%
        group_by(handling_id, handling) %>%
        spread(registration_type, time) %>%
        ungroup(handling_id, handling) %>%
        mutate(handling=as.character(handling))
      if(length(log) == 4) {
        names(log) <- c("id","content","end","start")
      }
      return(log)
    })

    output$activity_selection <- renderText({
      if (is.null(input$process_activities)) {
        "None"
      } else {
        activities <- jsonlite::fromJSON(input$process_activities)
        paste0("(", activities$id, ",", activities$activity, ")", collapse = ",")
      }
    })

    activity_log <- reactive({
      activities <- jsonlite::fromJSON(input$process_activities)
      log <-  patients %>% filter_activity(head(activities$activity, 1))
    })

    activity_time_log <- reactive({
      log <- activity_log() %>% as.data.frame() %>%
        select(handling_id, handling, registration_type, time) %>%
        group_by(handling_id, handling) %>%
        spread(registration_type, time) %>%
        ungroup(handling_id, handling) %>%
        mutate(handling=as.character(handling))
      if(length(log) == 4) {
        names(log) <- c("id","content","end","start")
      }
      return(log)
    })

    output$activity_title <- renderText({
      if (is.null(input$process_activities)) {
        "No Activity Selected"
      } else {
        act <- unique(activity_log()$handling)
        title <- paste("Summary details for", act)}
    })

    output$activity_pro_time <- renderText({
      req(input$process_activities)
      processing_time(activity_log())
    })
    output$activity_thr_time <- renderText({
      req(input$process_activities)
      throughput_time(activity_log())
    })
    output$activity_count <- renderText({
      req(input$process_activities)
      counts <- activity_presence(activity_log())
      counts <- paste("Absolute:",counts$absolute, "Relative:", counts$relative)
    })
    output$process <- renderProcessanimater(expr = {
      animate_process(eventlog, ...)
    })
    output$timeline <- renderTimevis({
      req(input$process_tokens)
      time_log() %>% timevis(fit = TRUE)
    })
    output$activity_timeline <- renderTimevis({
      req(input$process_activities)
      max_date <- activity_time_log() %>%  summarise(max = max(end))
      max_date <- as.Date(max_date$max)
      activity_time_log() %>% timevis(fit = TRUE) %>% setWindow(max_date - 8, max_date)
    })

    output$patient_selection <- renderText({
      if (is.null(input$process_tokens)) {
        "No Patient Selected"
      } else {
        paste("Patient",tail(input$process_tokens, 1), "Timeline")}
    })
  }

  ui <- fluidPage(
    animationUI("module", "Select Inputs")
  )

  server <- function(input, output, session) {
    callModule(animation, "module")
  }
  shinyApp(ui, server, options = list(height = 500))
}

shinyAnimation(patients)

Better visualisation of token going out of start and going to end node

Hello,
firstly thank you for this package, it's very helpfull !

I was wondering is there is any way to change the way token appear and disapear when coming out of start node and going into end node:
For example, in the traffic fine demo, I had a hard time seing any token on the bottom edge even if it said 185 because they just spawned at the end while I was looking on the other part off the edge :
image

Handling of Parallel activities

Hi

I've created a test eventlog with two activities that start at the exact same time but end at different times.
and another event log with two activities that start at the exact same time and end at the exact same time.

I find that processanimateR v1.0.4 doesn't show these activities as parallel, rather sequential.

Is there any way to force processanimateR to show a true parallel path please and have a token also move along both parallel paths at the same time?

We are running R v4.0.2

Thanks.

Show movement of separate tokens along the arrows to make bottlenecks visible?

Thank you for this package! It's a great addition to the excellent bupaR package. I took a purchasing example dataset from Fluxicon to compare the two animations:

In the Disco animation the bottleneck at the activity “Analyze Request for Quotation” is more obvious. Perhaps there might be a way to show the movement of the tokens along the arrows and keep the different tokens separate from each other in processanimateR? This could make congestions visible as in the Disco animation. What do you think?

Code and dataset of my comparison: https://github.com/frkbr/Purchasing-Example.git

Adding legends to process map animations

Hi,

Firstly, supermegacool package!

Is there the ability to add a legend when colors are added(haven't been able to find anything so far)?

For instance, the following gives me different colors for each respective employee, but is there a way to show which color each employee has been assigned to within the animation?

animate_process(add_token_color(patients, "employee", "color",
color_mapping = scales::col_factor("Set3", patients$employee)),
animation_mode = "relative",
token_color = "color")

Thanks!!

Eventlog does not accept 'order' input or generate a default value on macOS

Thank you for making this package, it's great! I've been able to make animations of process maps on Windows OS, but am getting an error trying to run the same code on my MacBook.

When I go to create an eventlog, I can't manually set the 'order' parameter (unused argument (order = "auto")). However, when I create an eventlog without the 'order' parameter, the animation is not generated due to the absence of this parameter (Error: .order must resolve to integer column positions, not NULL).

This occurs even when running the simplest example using the patients data:
data(patients)
animate_process(patients)

Error: .order must resolve to integer column positions, not NULL

And when I try to set it manually:
patientLog <- eventlog(
eventlog = patientsDF,
case_id = "patient",
activity_id = "events",
activity_instance_id = "handling_id",
lifecycle_id = "registration_type",
timestamp = "time",
resource_id = "employee"
)

Error in eventlog(eventlog = patientsDF, case_id = "patient", activity_id = "events", :
unused argument (order = "auto")

Performance regression in Chrome pre-80

The performance of the token animation is very slow in the current Chrome build. For example, the following code wrong the vignette is painfully slow:

library(processanimateR)
library(dplyr)
library(bupaR)
animate_process(sample_n(traffic_fines, 1000) %>% filter_trace_frequency(percentage = 0.95),
                mode = "relative",
                legend = "color", 
                mapping = token_aes(color = token_scale("amount", 
                                                        scale = "linear", 
                                                        range = c("yellow","red"))))

Support heuristicsmineR Causal nets

processanimateR already supports interpreting the DiagrammeR object returned by heuristicsmineR::render_causal_net; however, no animation is rendered.

To support causal nets we would need to change the lifecycle of tokens from being case-based to being based on individual edges, as multiple tokens may travel for the same case.

Leaflet Rendering is not working in R 3.6.3

Hi.

After the most recent R studio upgrade the leaflet rendering is not working correctly.

Running the example from the documentation the produced new 1 warning:

animate_process(example_log, renderer = renderer_leaflet( node_coordinates = data.frame( act = c("A", "B", "C", "D", "Start", "End"), lat = c(63.443680, 63.426925, 63.409207, 63.422336, 63.450950, 63.419706), lng = c(10.383625, 10.396972, 10.406418, 10.432119, 10.383368, 10.252347), stringsAsFactors = FALSE), edge_coordinates = data.frame( act_from = c("B"), act_to = c("C"), lat = c(63.419207), lng = c(10.386418), stringsAsFactors = FALSE), options = list(center = c(63.412273, 10.399590), zoom = 12)), duration = 5, repeat_count = Inf)

2: In stri_replace_all_regex(string, pattern, fix_replacement(replacement), : argument is not an atomic vector; coercing

Running the same example on R version 3.6.1 (2019-07-05) -- "Action of the Toes" with processanimateR v1.01 works flawlessly.

Technical specs of the newest combination that's not working:
Rstudio: R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
processanimateR v1.0.2

Pause parameter to not auto play the animation

Hi,

I'm creating a Shiny Dashboard around a process map and would like to not automatically play the animation on render, is there curently any way to achieve that or a posibility to add a parameter otherwise ?

Thanks again for your awesome library !

Don't see infrequent edges. Is it possible?

Hi!

I'd like to simplify the process map.

I can reduce the number of activities displayed: to do this I use the edeaR :: filter_activity_frequency function.

I'd like to reduce the number of edges displayed. I tried using the "layout" argument of the process_map function, specifically the "edge_cutoff" parameter; but unfortunately I don't get any results, as if the parameter has no effect.

Is it possible to use "edge_cutoff" parameter to display only the edges that have a frequency higher than a certain limit?
Can you give me an example of use?

Thanks so much!
You did a great job!

Cannot display French properly

Hi,

In my project, I need to display French, but I always get the following error

Failed to render the graph. It is probably too large. Original error: Error: syntax error in line 27 near 'à' at render 
(http://localhost:15966/session/viewhtml64ca72d45c09/lib/viz.js-2.1.2/full.render.js:50:11) at 
http://localhost:15966/session/viewhtml64ca72d45c09/lib/viz.js-2.1.2/viz.js:122:19 at new Promise (<anonymous>) at 
ModuleWrapper.render (http://localhost:15966/session/viewhtml64ca72d45c09/lib/viz.js-2.1.2/viz.js:120:14) at 
PAViz.renderString (http://localhost:15966/session/viewhtml64ca72d45c09/lib/viz.js-2.1.2/viz.js:283:29) at 
PAViz.renderSVGElement (http://localhost:15966/session/viewhtml64ca72d45c09/lib/viz.js-2.1.2/viz.js:290:21) at 
PARendererGraphviz.render (http://localhost:15966/session/viewhtml64ca72d45c09/lib/processanimater-libs-1.0.3/animation_renderer_graphviz.js:89:9) at Object.renderValue (http://localhost:15966/session/viewhtml64ca72d45c09/lib/processanimateR-binding-1.0.4/processanimateR.js:47:18) at 
Object.renderValue (http://localhost:15966/session/viewhtml64ca72d45c09/lib/htmlwidgets-1.5.4/htmlwidgets.js:886:25) at 
http://localhost:15966/session/viewhtml64ca72d45c09/lib/htmlwidgets-1.5.4/htmlwidgets.js:653:19

Sample Data
patient.csv

#install.packages(c("bupaR","processanimateR"))
library(bupaR)
library(processanimateR)

data <- read.csv('Downloads/patient.csv',  stringsAsFactors = FALSE)

data$timestamp <- as.POSIXct(data$timestamp, tz="UTC", format="%Y-%m-%dT%H:%M:%SZ")

data$activity <-as.character(data$activity)
Encoding(data$activity) <- 'UTF-8'

data <- eventlog(data, 
  case_id = "patient",
  activity_id = "activity",
  activity_instance_id = "activity_instance",
  lifecycle_id = "status",
  timestamp = "timestamp",
  resource_id = "resource"
)

graph <- processmapR::process_map(data, render = F, type = frequency("absolute", color_scale = "Blues"))
model <- DiagrammeR::add_global_graph_attrs(graph, attr = "rankdir", value = "TB", attr_type = "graph")
animate_process(data, model,  initial_state="paused")

I have found that it is caused by the single quote "'" in this word "D'arrivée à la porte".
If I replace this word with "D\'arrivée à la porte", it will display a double quotes, which is not what we want

image

Any suggestions for this case? Many Thanks.

Animate Process Using Milliseconds

Is it possible to animate a process when using milliseconds accuracy?
Is there a unit for milliseconds?
Can we use an Epoch timestamp column?

Thank you!

Animation slider time mismatch in animate_process

I've noticed that when trying to animate the process map of items with lubridate formatted timestamps (ie. 2020-04-14T08:43:00Z), that there's a discrepancy with the time displayed on the animation time slider ~4-5 hrs earlier (2020-04-14T04:10:00Z). I didn't know if this was an artificial manipulation as a result of the slider wanting and initial timepoint to lock in on (since the default is 0) or if this was a bug issue. It does appear that the durations are the same though.

Plan for python/pm4py support

Hi,

I see that you work with other process mining project like pm4py and interfacing it to bupar.
Do you have any plan on making this package compatible with pm4py/python ?

Thanks

Animate Process - R Studio - Viewer

When I try to animate_process(anyevent), I expect it to run in R Studio Viewer also as it was running earlier. After my update to R 4.0 / or otherwise (which I cannot remember correctly), viewer is not displaying animated process... However when I run the command without R Studio (Simple R interface), process can be seen in URL. I am able to save the video, but unable to see inside the Viewer.
I think some firewall or block by R Studio app or other issue ?
Can someone guide please. Unable to diagnose.

`sec` argument errors in branch activity-animate

When using the branch activity-animate and sec is not NULL, it fails with lengthy error on the process map.

repex:

animate_process(
  eventdataR::patients,
  type = processmapR::frequency(),
  sec = processmapR::performance()
)

Error:

Failed to render the graph. It is probably too large. Original error: TypeError: Cannot read property 'value' of undefined at SVGGElement.<anonymous> 
(http://localhost:27995/session/viewhtml3a343e184b2d/lib/processanimater-libs-1.0.3/animation_activities.js:166:43) at I.each 
(http://localhost:27995/session/viewhtml3a343e184b2d/lib/d3-5.7.0/d3-custom.min.js:1:8574) at PAActivities.insertActivityAnimation 
(http://localhost:27995/session/viewhtml3a343e184b2d/lib/processanimater-libs-1.0.3/animation_activities.js:88:18) at 
http://localhost:27995/session/viewhtml3a343e184b2d/lib/processanimateR-binding-1.1.0.9000/processanimateR.js:55:24 at 
http://localhost:27995/session/viewhtml3a343e184b2d/lib/processanimater-libs-1.0.3/animation_renderer_graphviz.js:105:9

Refactor animation library into stand-alone JS project

The processanimateR package is SVG+JS written mainly in D3 together with a JS version of GraphViz. The interface is relatively standalone as the data is provided in JSON format.
So, it would be useful to refactor this part out in a stand-alone JS project that takes a SVG (e.g. created by viz.js) and the matching JSON format describing the tokens and creates the HTML necessary for the animation.

Maybe this could be a D3 plug-in or something like this.

process maps seem to be rendering strangely with latest diagrammeR

When using process_map and rendering a graph with the latest version of everything (see sessionInfo() below), the process maps seem to be rendering with text fonts which are too large and activity boxes which are too large (problem_rendering.png):

library(DiagrammeR)
library(bupaR)

process_map(patients)

problem_rendering

However, you can render correctly using the following (at least it looks correct):

library(DiagrammeR)
library(bupaR)

test1 <- process_map(patients, render = FALSE)
render_graph(test1)

correct_render

I believe the problem is in process_map.R file, starting at line 324:

		# Since DiagrammeR does not support the necessary GraphViz attributes,
		# we use a workaround to add them tot the DOT code. See the issue logged here:
		# https://github.com/rich-iannone/DiagrammeR/issues/360

	  	# hack to add 'weight' attribute to the graph
		graph$edges_df %>%
			mutate(len = weight, decorate = constraint) -> graph$edges_df

		graph %>% render_graph() -> graph

		graph$x$diagram %>%
			stringr::str_replace_all("len", "weight") %>%
			stringr::str_replace_all("decorate", "constraint") -> graph$x$diagram

		attr(graph, "base_precedence") <- base_precedence

		graph %>% return()

I am not sure this code works correctly with the latest version of DiagrammeR (or maybe some other packages that DiagrammeR depends on).

Unfortunately, the workaround fix doesn't help me because I use processanimateR to render the graphs in order to get the token animation.

My sessionInfo is below:

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] processanimateR_1.0.1  DiagrammeR_1.0.0       petrinetR_0.2.1.9000   processmonitR_0.1.0    xesreadR_0.2.3.9000    processmapR_0.3.3.9000 eventdataR_0.2.0.9000  edeaR_0.8.3           
[9] bupaR_0.4.2           

loaded via a namespace (and not attached):
 [1] zoo_1.8-6           tidyselect_0.2.5    purrr_0.3.3         ggthemes_4.2.0      lattice_0.20-38     V8_2.3              colorspace_1.4-1    vctrs_0.2.0.9007    miniUI_0.1.1.1     
[10] htmltools_0.4.0     viridisLite_0.3.0   yaml_2.2.0          XML_3.98-1.20       plotly_4.9.1        rlang_0.4.2         later_1.0.0         pillar_1.4.2.9001   glue_1.3.1         
[19] DiagrammeRsvg_0.1   RColorBrewer_1.1-2  lifecycle_0.1.0     stringr_1.4.0       munsell_0.5.0       gtable_0.3.0        visNetwork_2.0.8    htmlwidgets_1.5.1   forcats_0.4.0      
[28] fastmap_1.0.1       httpuv_1.5.2        curl_4.2            Rcpp_1.0.3          xtable_1.8-4        promises_1.1.0      scales_1.1.0        jsonlite_1.6        lobstr_1.1.1       
[37] mime_0.7            ggplot2_3.2.1       hms_0.5.2           digest_0.6.23       stringi_1.4.3       dplyr_0.8.99.9000   shiny_1.4.0         grid_3.5.1          tools_3.5.1        
[46] magrittr_1.5        lazyeval_0.2.2      tibble_2.99.99.9010 crayon_1.3.4        tidyr_1.0.0         pkgconfig_2.0.3     zeallot_0.1.0       xml2_1.2.2          data.table_1.12.6  
[55] lubridate_1.7.4     assertthat_0.2.1    httr_1.4.1          rstudioapi_0.10     R6_2.4.1            igraph_1.2.4.1      shinyTime_1.0.1     compiler_3.5.1     

Animate Process Map Can Not Be Insert Into Shiny Dashboard

Hi Felix, I tried to use renderProcessanimater and processanimaterOutput to build a shiny dashboard, while the animate process map just not display.

I have tested your ianimate_process function, to make the simplest from, I define a function:
my_ianimate_process <- function (eventlog) { ui <- function(request) { fluidPage(tags$head(tags$style("#process{height:90vh !important;}")), mainPanel(width = 10, shinycssloaders::withSpinner(processanimaterOutput("process")))) } server <- function(session, input, output) { output$process <- renderProcessanimater(expr = { animate_process(eventlog) }) } shinyApp(ui, server) }

This function works, but when I remove tags$head(tags$style("#process{height:90vh !important;}")), the animate process map will not display.

I did a lot of test and find that this function must work with fluidPage and processanimaterOutput("process")) function must be in the mainPanel, otherwise it will not work.

Error in UseMethod("tbl_vars")

Following the getting started instructions results in the error:

Steps

source("https://install-github.me/r-lib/remotes")
remotes::install_github("fmannhardt/processanimateR")
library(processanimateR)
library(eventdataR)
data(patients)
animate_process(patients)

Error in UseMethod("tbl_vars") :
no applicable method for 'tbl_vars' applied to an object of class "NULL"

New Feature Request: Ability to reduce volume of animated elements

Hi Felix,

This package is a lifesaver, I have been looking for something to provide this kind of functionality in R for a long while now!

I'm using it to visualise a process that has over 20,000 cases and a large amount of activities, and just wondering if there is a way to reduce the on-screen animations rendered but at the same scale that the full event log would contain?

For an example if I run traffic_fines %>% animate_process() rendering the 10,000 different flows is very resource intensive on my machine and takes about 50 seconds to load, and I think that the same story could be told rendering a fraction of the cases as on screen elements.

I am using development ‘processanimateR’ version 1.0.0.9000

Just an idea for a new feature, unsure of complexity or feasibility

Thanks for your work!

Error using animate_process with mode = "off"

When using animate_process to render a static process map with mode = "off", i get the error Failed to render the graph. It is probably too large. Original error: TypeError: Cannot read property 'reduce' of undefined in the browser (no error in console)
Using mode = "relative/absolute" dont produce the error

I have the last version of processanimateR/bupaR/DiagrammeR ...

Code to replicate:

processanimateR::animate_process(patients, mode = "off")

Modifying the timeline length

Hello Felix,
I have an animate process app with shinyDashboard. The tabs need to be maximized for better presentation (as you can see in the following code).
This works perfectly. However, when I maximize the tab and try to render the graph by changing the animation speed in the dropdown menu, the length of the timeline will shrink to 6 and not 12 (full screen). Is there anyway to modify or specify the size of timeline?
Thanks in advance,

## app.R ##
library(shiny)
library(shinyWidgets)
library(bs4Dash)
library(shinycssloaders)
library(processmapR)
library(processanimateR)
library(eventdataR)
library(tidyverse)



ui <- dashboardPage(
  dashboardHeader(
  ),
  dashboardSidebar(
    width = 0
  ),
  dashboardBody(
    tags$head(
      tags$script(
        "$(function() {
              $('[data-card-widget=\"maximize\"]').on('click', function() {
                setTimeout(function() {
                  var isMaximized = $('html').hasClass('maximized-card');
                  if (isMaximized) {
                    $('#process').css('height', '100%');
                  } else {
                    $('#process').css('height', '100%');
                  }
                }, 300);
                $('#process').trigger('resize');
              });
            });
            "
      )
    ),

    fluidRow(
      tabBox(
        id = "Box one",
        height = "79.0vh",
        maximizable = T,
        title = p("", div(style = "position: absolute; right: 35px; top: 3px;",
                          dropdownButton(
                            icon = icon("cog"),
                            size = "default",
                            circle = F,
                            tooltip = F,
                            label = "",
                            right = T,
                            width = "250px",
                            radioButtons("duration",
                                         "Animation Speed",
                                         c("Slow" = 600,
                                           "Medium" = 300,
                                           "Fast" = 90
                                         ),
                                         selected = 300)))),
        tabPanel(
          title = "Tab one",
          align  = "center",
          withSpinner(
            processanimaterOutput("process", height = "76.5vh"), type=6)
        ),
        tabPanel(
          title = "Tab two",
        )
      ),
      tabBox(
        id = "Box two",
        height = "79.0vh",
        maximizable = T,
        tabPanel(
          title = "Tab three",
        )
      )
    )
  )
)

myMap <- process_map(patients, render = F)
server <- function(input, output) {
    output$process <- renderProcessanimater({
      animate_process(patients, myMap, duration = as.numeric(input$duration), initial_state = "paused")
  })
}

shinyApp(ui, server)

giphy11
image

Animating incomplete processes

I've got a process with 22 case_ids (cases) and 7 activity_ids (stages). All 22 cases have gone through the first 3 stages, but only 7 cases have moved on to stages 4-7. The other 15 are still stuck at stage 3. On the animation I would like to see that they are still stuck there, but instead they move straight to the End node as soon as they hit stage 3.

Is there a way to get my desired behaviour?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.