Giter Site home page Giter Site logo

process-analytics / bpmn-visualization-r Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 4.0 1.24 MB

A R package for visualizing process execution data on BPMN diagrams

Home Page: https://process-analytics.github.io/bpmn-visualization-R/

License: Apache License 2.0

R 93.31% JavaScript 6.69%
bpmn bpmn-visualization hacktoberfest process-analytics r visualization

bpmn-visualization-r's People

Contributors

alachambre avatar colinfay avatar csouchet avatar dependabot[bot] avatar oanesini avatar process-analytics-bot avatar tbouffard avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bpmn-visualization-r's Issues

[FEAT] Provide live environments for examples

We would like to link to a live environment that can showcase the usage of our package
The solution requires we can install our package and probably from CRAN (see #10)

To check

[FEAT] Ensure overlays are passed as a list

#27 (comment) shows that in the first implementation, if the parameter is not a list but a single overlay, the overlay is not displayed and we don't see any errors in the R console.

We could make the display function fails in that case or transform the parameter into a list.

[DOC] Deploy documentation preview on Surge

When a Pull Request changes the man/*.Rd files or any file that is used to build the documentation, deploy the documentation preview as we do in other repositories.

To be done when implementing #19 and #40

[FEAT] Allow to style BPMN Elements

bpmn-visualization already provides a CSS API but it requires the CSS styles are defined in the html page. Is this convenient for the R integration? the R package may not let R user to modify the underlying html page.

We may need bpmn-visualization to provide a new API that let style specific BPMN elements: process-analytics/bpmn-visualization-js#1030. This feature is available as of [email protected] which is bundled in bpmnVisualizationR 0.4.0.

[BUG] Some overlays may not be added when one in the list refers to an non existing bpmn element

Describe the bug
If we try to add an overlay to a non existing bpmn element, an error is displayed in the browser console and subsequent overlays are not added.

To Reproduce
Steps to reproduce the behavior:
Add several overlays, with one overlay relating to a non existing bpmn element id. The overlays in the list declared after the special one are not displayed.

bpmn_file <- system.file("examples/Email_Voting.bpmn", package = "bpmnVisualization")
# generate error in js binding file
overlays <- list(
  bpmnVisualization::create_overlay("does_not_exist_bpmn_element_id_1", "42"),
  bpmnVisualization::create_overlay("sub_process_1", "110") # id of an existing bpmn element, overlay not added
)
bpmnVisualization::display(bpmn_file, overlays)

console error

Uncaught TypeError: Cannot read property 'bpmnSemantic' of undefined
    at x.overlays.x.overlays.map.overlay (bpmnVisualization.js:33)
    at Array.map (<anonymous>)
    at Object.renderValue (bpmnVisualization.js:29)
    at Object.renderValue (htmlwidgets.js:886)
    at htmlwidgets.js:653
    at Array.forEach (<anonymous>)
    at forEach (htmlwidgets.js:55)
    at htmlwidgets.js:576
    at Array.forEach (<anonymous>)
    at forEach (htmlwidgets.js:55)

JS binding code

const elementsByIds = bpmnVisualization.bpmnElementsRegistry.getElementsByIds(overlay.elementId);
if (elementsByIds) {
  // this is line 33
  const overlayConfig = elementsByIds[0].bpmnSemantic.isShape ? {

Expected behavior
The overlay for existing bpmn elements should be added.
For non existing elements, we shouldn't have error. We may log a warning.

Additional context
commit: 600286d
bpmn-visualization: 0.19.0

It seems that in the elementsByIds array returned by bpmn-visualization, we have undefined elements.
Notice that the TS lib implementation is supposed to avoid undefined in the array: https://github.com/process-analytics/bpmn-visualization-js/blob/v0.19.0/src/component/registry/bpmn-elements-registry.ts#L75
We already have tests for this use case and more are added without showing any issue (process-analytics/bpmn-visualization-js#1507)

The getElementsByIds function is only needed here because we need to know if we have a shape or an edge to choose the arbitrary position of the overlay. This may not be needed anymore when implementing #15 if we let the user choose the overlay position or if we use the TS lib overlay default position.

[DOC] Document the release process

At least

  • how to update the bpmn-visualization js lib
  • git tag
  • update the version in DESCRIPTION
  • CRAN publishing: #10
  • R package release good practices

Tasks

  • Decide where to store this documentation: in the contributing guide
  • write the documentation #41

[INFRA] Automate bpmn-visualization-js update

We would like to update the js lib used by the R package when a new bpmn-visualization JS release is available.
If possible, automate the process. We do this for the examples repository with GitHub workflows.

Possible solutions

Note: not exhaustive, add new ideas

Getting the js file
We use the min IIFE bundle, that can be retrieved from unpkg or jsdelivr (what we use in bpmn-visualization-examples).
It is available for download usage once the npm package has been published.

Triggering the workflow
We can do as for the bpmn-visualization-examples: on new git tag in bpmn-visualization, the existing workflow could trigger a workflow in bpmn-visualization-R by sending a repository dispatch. We need to pass the new version to use in the R package
It should also be possible to trigger the workflow manually with workflow_dispatch

Knowing that the file is available on npm
To wait for npm package availability, we could use the npm info command as done by bpmn-js: https://github.com/bpmn-io/bpmn-js/blob/v8.7.3/.github/workflows/POST_RELEASE.yml#L21

The wait check could be done in the R package repository as this is where we know that we need it.
But technically, this can also be done in the bpmn-visualization repository

[DOC] Some overlays are missing in the hero image of the README

image

The activity rounded by a red circle and the following sequence flow don't have overlays

Important

Be aware of #251 and #252.

Notes

The image has been first created with the script described in #45.
Then, it was recreated in #72 with the same script but store as SVG. This involves manual work to make the label be displayed at the right position (manually migrate foreignObject to SVG text). The SVG was finally cleaned in #78 (no visual change).

The easiest way to fix the overlay is to try to update the SVG directly and also provide an updated version of the script that would also generate it. That way, next time we will regenerate it, no overlays will miss.

See also #157

[INFRA] Simplify the publishing process to CRAN

Prerequisites: #10

Currently (v0.2.0), the release process explains that the source archive that is submitted to CRAN has to be built locally. This is a pain and error prone. So this should be automated instead
We could

  • create a GH worfkow triggered on tag creation (see also #47) and workflow_dispatch (for manual rerun on issue)
  • or reuse the existing "build" workflow and allow to run it with workflow_dispatch (for manual run)

Tasks

  • Allow to run the existing build worfklow on workflow_dispatch and when a new tag is published
  • Update the release procedure to use the workflow instead of building locally

[DOC] Attach the HTML documentation to the GH releases

Is your feature request related to a problem? Please describe.
GitHub pages (#19) only host the documentation the development version. Web browsing of the package on CRAN only shows the documentation of the latest release.
This make hard to browse or check the documentation of past release

Describe the solution you'd like
When publishing a GH release or at least when the tag of a released version is pushed, attach the documentation as a release assets.

Additional context
The documentation generation and attachment to the release should be automated to avoid human errors.

[DOC] Decide if we bundle BPMN diagrams as examples in the package

This was done in the experimental package

Advantages: user can experiment the package out of the box, no need for external resources
Cons: larger package

If this is a common practice for R-package, let's do it. Otherwise, rethink about it.
And if we package examples

  • decide the examples we want to provide (miwg-test-suite, BPMN Spec example, other like simple one, ...)
  • document the list of the diagrams and from where they are coming from

Decision

  • keep the 4 BPMN Spec examples initially introduced with #26
  • document in the README where they are coming from (link to downloads)

[DOC] Host documentation on GitHub Pages

see

Generate and deploy the site with GitHub actions

Tasks

  • Configure the repository: we are going to use GH Actions to publish (no branch) like done in
  • Configure the GH workflow
  • Add the url to the repo settings on GH
  • Display the environment in the repository home
  • Once deployed, promote the site in the package DESCRIPTION file. See https://pkgdown.r-lib.org/articles/pkgdown.html#promoting

image

[INFRA] Simplify the way we publish release announces on twitter and discord

Currently (in v0.2.1), the announce to twitter and discord must be done manually.
The maintainers documentation provides a template, but this is painful and error prone

We could setup a workflow to publish on our name. It will be run on demand (workflow_dispatch) with some inputs:

  • the version that has been released
  • the "short description" to display in the announce

Notes: we have the same needs for the bpmn-visualization TypeScript library, see process-analytics/bpmn-visualization-js#2341

[DOC] Improve project description and README

Current baseline: A R package which embeds BPMN Visualization

It doesn't describe the purpose of the package. See also #1 (comment).
We will keep the ref to the bpmn-visualization-js integration.

Sources of inspiration

Tasks

  • repository description: A R package for visualizing process execution data on BPMN diagrams
  • R DESCRIPTION file. Remove ref to R package, for sure, this is this a R package ๐Ÿ˜™ #39
  • readme #39

[DOC] Generate HTML documentation

For a more user friendly documentation, we should provide HTML documentation and publish it (#19)

This could include

Also include the following feedback from #128

  • โœ”๏ธ index page: readme of the repo cannot be used. It contains HTML code that is not correctly rendered and too much information. Create a README.Rmd like in https://github.com/r-lib/pkgdown/blob/main/README.Rmd?
  • โœ”๏ธ package file:
    • review the file name and drop alias to use bpmnVisualization instead
    • some content is empty. See what we have in the RStudio preview and what CRAN generates as HTML page
    • do we really need the information it provides? if not, not need to implement #123

See also #30

Notes: next improvements will start with #161

[DOC] Choose the package/namepace and functions naming conventions

package name

Initial proposal is bpmnVisualization in #21 --> we will keep this name (lowerCamelCase)

Resources

functions

we decide to use

  • name: underscore_separated
  • parameters: lowerCamelCase
  • private function: prefixed by a dot i.e . (like Google R style)

Ressources

[INFRA] Simplify the way we update the versions manually in various files

Currently (in v0.2.1), the version must be updated prior and after releasing (by creating a PR). This is painful and error prone
The git tag is created only when the GitHub release is published.

I suggest we do something like for the bpmn-visualization TypeScript library.
We provide a GitHub workflow that will do everything for us:

  • It takes as an input the version to release.
  • it updates the files with the new version and commit
  • then it creates the related tag
  • then it updates the files with the development version and commit
  • finally, it push the changes and the tag

If possible, the development version should be automatically computed by the workflow to avoid human error

[INFRA] Add a R/JS formater

For now, we have to manage formatting manually. In RStudio, select the file content and then do Ctrl + Shift + A

See this article for general guidelines: https://blog.r-hub.io/2022/03/21/code-style/

For formatting rules

tooling candidates

IDE extension supporting autoformating

Contributing as part of Hacktoberfest 2022!

hacktoberfest 2022 hero image

You're one step away of starting your contribution and becoming our HacktoberHero ๐Ÿ˜

Before you start, check out our article and please follow these rules:

  1. Choose any issue labeled with hacktoberfest Can be done during the Hacktoberfest .
  2. Add a comment โœ๏ธ on the chosen issue to express your desire to work on it. In principle, the issue should not be assigned to someone else. We will try to respond to you as quickly as possible, to give you any required information and to assign you the issue.
  3. Please commit ๐Ÿ“Œ to the assigned issue, and in case of unavoidable change, let us know as early as possible.
  4. Read carefully ๐Ÿ“œ the issue description and follow the general contribution guidelines, in addition to any specific guideline mentioned in the issue. In any doubt, contact us directly via Github or on our discord channel.
  5. Once done, create your PR request ๐Ÿ”ฅ and ๐Ÿคž

[INFRA] The release workflow fails to disable the branch protection rules

Seen while attempting to release version 0.2.2.
Workaround: follow the manual procedure

Workflow runs: https://github.com/process-analytics/bpmn-visualization-R/actions/runs/3533388259
3 attempts, all failed. The last one was run in debug mode, no additional information

Action configuration

Run benjefferies/[email protected]
  with:
    access_token: ***
    enforce_admins: true
    branch: main
    retries: 5

Error stack

Getting branch protection settings for process-analytics/bpmn-visualization-R
Traceback (most recent call last):
  File "/bin/run.py", line 83, in <module>
    toggle_enforce_admin(p.parse_args())
  File "/bin/run.py", line 22, in toggle_enforce_admin
    protection = get_protection(access_token, branch_name, owner, repo_name)
  File "/bin/run.py", line 61, in get_protection
    protection = branch.protection()
  File "/pyroot/lib/python3.7/site-packages/github3/decorators.py", line 31, in auth_wrapper
    return func(self, *args, **kwargs)
  File "/pyroot/lib/python3.7/site-packages/github3/repos/branch.py", line 73, in protection
    json = self._json(resp, 200)
  File "/pyroot/lib/python3.7/site-packages/github3/models.py", line 157, in _json
    raise exceptions.error_for(response)
github3.exceptions.NotFoundError: 404 Not Found

[REFACTOR] Evaluate if we can remove the `man` folder from the repository

See #26 (comment)

The man folder contains only generated files except bpmnVisualization-package.Rd
This file could be generated as done in https://github.com/bergant/bpmn/blob/9768cccc551831846a6d404271e330d710c8ef3b/R/bpmn.R#L1 (add roxygen comments on a NULL statement)

We will probably use Roxygen2 that generates the Rmd files from documentation as R comments located in the source code (see https://kbroman.org/pkg_primer/pages/docs.html and https://r-pkgs.org/man.html)
Once roxygen2 is installed, documentation can be generated by calling devtools::document()
See also https://github.com/r-lib/roxygen2

The NAMESPACE file is also generated

To avoid roxygen2 warning roxygen2 requires Encoding: UTF-8
Add Encoding: UTF-8 to the DESCRIPTION file --> done in #49

For contributors, document RStudio configuration to be setup to avoid running doc generation when changing the code
The following in the default configuration. Some files aren't generated if the config is left unchanged.
image

[INFRA] Automate the build

Note for GitHub Workflows

The GH_TOKEN available in this repository as readonly permissions by default. If more permissions are required, they need to be configured in the workflow definition.

image

Rationale
This is something we want to put in place for all repositories of the organization

As a good security practice, you should always make sure that actions only have the minimum access they require by limiting the permissions granted to the GITHUB_TOKEN

Source: GitHub documentation

[FEAT] Set the overlays default colors using the hexa form

Is your feature request related to a problem? Please describe.
The default overlays colors in v0.1.1 are defined in the rgba form. Please use hexa color form.

Describe the solution you'd like
We generally use the hexa forms in the lib examples.
The rgba currently used in the js bridge code is not well supported in Inkscape: this was an issue when we exported the SVG generated in the R View and edit it in this software. See #72.

Additional context
See https://github.com/process-analytics/bpmn-visualization-R/blob/v0.1.1/inst/htmlwidgets/bpmnVisualization.js#L42.

[INFRA] Automate tag and files update

Currently (in v0.2.1), the version must be updated prior and after releasing (by creating a PR). This is painful and error prone
The git tag is created only when the GitHub release is published.

I suggest we do something like for the bpmn-visualization TypeScript library.
We provide a GitHub workflow that will do everything for us:

  • It takes as an input the version to release.
  • it updates the files with the new version and commit
  • then it creates the related tag
  • then it updates the files with the development version and commit
  • finally, it push the changes and the tag

If possible, the development version should be automatically computed by the workflow to avoid human error

Tasks to do

Add a Github workflow triggered by workflow_dispatch (manual run)

  • pass the new version
  • update the files containing the version accordingly (see MAINTAINERS.md)
  • create the git tag
  • set the development version accordingly (see MAINTAINERS.md)
  • push all commits and the tag

Documentation

  • update MAINTAINERS.md to explain the new release process

Notes

  • remember that the GH_TOKEN has readonly permissions by default
  • check how we proceed in the bpmn-visualization-js repo
  • don't forget to use the playground repository for testing

[DOC] Don't add development dependencies to release notes

Currently, in the Dependencies update section of the release notes, we display the changes that apply to all types of dependencies. They include bump of development dependencies and GitHub Actions.
Most of the time, we only have updates for this kind of dependencies and we have plenty of them.

Thus, it is difficult to see that a runtime dependency has changed and, in its current form, the Update Dependencies section is not useful to library users.
It is the same issue as process-analytics/bpmn-visualization-js#2208.

Version Current list Useful list for users
pending v0.1.3 bpmn-visualization-R_01_current_all_dependencies bpmn-visualization-R_02_only_prod_dependencies

Proposal

It is the same as process-analytics/bpmn-visualization-js#2208 but here the process is simpler.
Dependabot only updates GitHub Actions: it can set the skip-changelog label and we won't have to do post-processing.
The bpm-visualization JS lib is updated by a PR created by a workflow we own, and other dependencies are updated with PR created by contributors.

Recently, we introduced a shared configuration for release-drafter: see process-analytics/.github#14 and process-analytics/github-actions-playground#132.
It can be used in this repository as the release-notes layout will be exactly the same as the one defined in the shared configuration.

[DOC] Publish coverage report on Codecov

Make the coverage results public. Codecov supports the R language and it widely used.
According to #117, coverage is 100% ๐Ÿ’ช๐Ÿฟ

Resources

Why not using SonarCloud?

We use SonarCloud for the bpmn-visualization TypeScript library, so why using a new tool/services?
Today (2022-10-26), SonarQube doesn't support the R language. See https://docs.sonarqube.org/latest/analysis/languages/overview/

image

[FEAT] Submit the package to CRAN

https://cran.r-project.org/
This let users consume our package easily

Release how-to: see https://r-pkgs.org/release.html and https://www.r-bloggers.com/2020/07/how-to-write-your-own-r-package-and-publish-it-on-cran

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.