Skip to content

process-analytics/bpmn-visualization-R

Repository files navigation

bpmnVisualizationR


bpmnVisualizationR is an R package for visualizing process execution data on BPMN diagrams, using overlays, style customization and interactions.

It is made possible by htmlwidgets, which provides an easy-to-use framework for bringing together R and the bpmn-visualization TypeScript library.

♻️ Usage

Installation

Install devtools

Devtools is an R package used to ease the installation and the development of other R packages.
It can be installed from the R console:

install.packages('devtools')

Install bpmnVisualizationR from GitHub

To install a dedicated version (available versions can be found in the GitHub releases page), run:

devtools::install_github("process-analytics/bpmn-visualization-R@v0.3.2")

Or install the development version:

devtools::install_github("process-analytics/bpmn-visualization-R")

Then, make the library available to the current R project:

library(bpmnVisualizationR)

Load the BPMN file

bpmnVisualizationR accepts a BPMN file (or an XML document):

# File from the package
bpmn_file <- system.file("examples/Email_Voting.bpmn", package = "bpmnVisualizationR")

Or

bpmn_file <- file.choose()

Or

bpmn_file <- "path_to_bpmn_file"

Or

bpmn_file <- "<?xml version="1.0" encoding="UTF-8"?> ...xml_content"

💡 The package provides some BPMN examples.
They are taken from the BPMN 2.0 examples non-normative machine readable files.

  • Email_Voting.bpmn
  • Nobel_Prize_Process.bpmn
  • Order_Management.bpmn
  • Order_Process_for_Pizza_V4.bpmn
  • Travel_Booking.bpmn

Display the BPMN diagram

bpmnVisualizationR::display(bpmn_file)

Display the BPMN diagram with overlays

overlays <- list(bpmnVisualizationR::create_overlay("bpmn_element_id_1", "42"), 
                 bpmnVisualizationR::create_overlay("bpmn_element_id_2", "9"))
bpmnVisualizationR::display(bpmn_file, overlays)

Integrate in Shiny Applications

The following displays a BPMN diagram provided as an example by the package with an overlay on top of a BPMN element.

# Install and load the shiny package
install.packages("shiny")
library(shiny)


displayBpmn <- function() {
    bpmn_file <- system.file("examples/Travel_Booking.bpmn", package = "bpmnVisualizationR")
    overlays <- list(bpmnVisualizationR::create_overlay("_6-203", "9"))
    bpmnVisualizationR::display(bpmn_file, overlays)
}

ui <- shinyUI(fluidPage(
    titlePanel("Display bpmn diagrams with execution data"),
    bpmnVisualizationR::bpmnVisualizationROutput('bpmnContainer')
  )
)

server = function(input, output) {
    # renderBpmnVisualization is the R bridge function to the html widgets
    output$bpmnContainer <- bpmnVisualizationR::renderBpmnVisualizationR({ displayBpmn() })
}

shinyApp(ui, server)

🔧 Contributing

To contribute to bpmnVisualizationR, fork and clone this repository locally and commit your code on a separate branch.
Please write tests for your code before opening a pull-request.

You can find more detail in our Contributing guide. Participation in this open source project is subject to a Code of Conduct.

✨ A BIG thanks to all our contributors 🙂

📃 License

bpmnVisualizationR is released under the Apache 2.0 license.
Copyright © from 2021, Bonitasoft S.A.

Contributors 7