Skip to content

Commit

Permalink
Merge pull request #58 from bupaverse/dev
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
gertjanssenswillen committed May 9, 2023
2 parents c82dd2d + 1f68705 commit 5b3a53f
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 24 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Package: processmapR
Type: Package
Title: Construct Process Maps Using Event Data
Version: 0.5.2
Date: 2022-10-03
Version: 0.5.3
Authors@R: c(person("Gert","Janssenswillen",email = "gert.janssenswillen@uhasselt.be", role = c("aut","cre")),
person("Gerard","van Hulzen", email = "gerard.vanhulzen@uhasselt.be", role = c("ctb")),
person("Benoît","Depaire",email = "benoit.depaire@uhasselt.be", role = c("ctb")),
person("Felix","Mannhardt",email = "Felix.Mannhardt@sintef.no", role = c("ctb")),
person("Thijs","Beuving", email = "thijs.beuving@kpn.com", role = c("ctb")),
person("urvikalia", role = c("ctb")))
person("urvikalia", role = c("ctb"),
person("Hasselt University", role = c("cph"))))
Description: Visualize event logs using directed graphs, i.e. process maps. Part of the 'bupaR' framework.
License: MIT + file LICENSE
LinkingTo: Rcpp, BH
SystemRequirements: C++11
SystemRequirements: C++
Depends:
R (>= 3.5.0)
Imports:
Expand All @@ -38,7 +38,7 @@ Imports:
Rcpp,
lifecycle
Encoding: UTF-8
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Suggests:
knitr,
rmarkdown,
Expand Down
4 changes: 3 additions & 1 deletion R/dotted_chart_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ dotted_chart_plot <- function(data, mapping, x, y, scale_color, col_label, units
}

data %>%
ggplot(aes_string(x = x_aes[[1L]], y = glue("reorder({case_id(mapping)}, desc({y_aes}))"))) +
mutate(x = !!sym(x_aes[[1L]]),
y = fct_reorder(!!sym(mapping$case_id), !!sym(y_aes))) %>%
ggplot(aes(x = x, y = fct_rev(y))) +
scale_y_discrete(breaks = NULL) +
labs(x = x_labs,y = "Cases") +
theme_light() -> p
Expand Down
6 changes: 3 additions & 3 deletions R/lined_chart.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ lined_chart.grouped_eventlog <- function(log,
theme_light() -> p

if (is.na(color)) {
p + geom_segment(lwd = line_width, color = "black") -> p
p + geom_segment(linewidth = line_width, color = "black") -> p
} else {
p + geom_segment(aes(color = factor(!!sym(color))), lwd = line_width) +
p + geom_segment(aes(color = factor(!!sym(color))), linewidth = line_width) +
scale_color(name = color) -> p
}

Expand Down Expand Up @@ -193,4 +193,4 @@ lined_chart_check_args <- function(log, x, sort, units, color, call = caller_env

# Just return something.
return(TRUE)
}
}
17 changes: 10 additions & 7 deletions R/lined_chart_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ configure_x_labs_lined <- function(x, units) {
lined_chart_plot <- function(data, mapping, x, y, scale_color, col_label, units, line_width) {

color <- NULL
xend <- NULL
yend <- NULL
x_aes <- configure_x_aes_lined(x)
y_aes <- configure_y_aes_lined(y)
x_labs <- configure_x_labs_lined(x, units)
Expand All @@ -74,20 +76,21 @@ lined_chart_plot <- function(data, mapping, x, y, scale_color, col_label, units,
if(length(unique(data$color)) > 26) {
scale_color <- ggplot2::scale_color_discrete
}

data %>%
ggplot(aes_string(x = x_aes[[1]],
xend = x_aes[[2]],
y = glue("reorder({case_id(mapping)}, desc({y_aes}))"),
yend = glue("reorder({case_id(mapping)}, desc({y_aes}))"))) +
mutate(x = !!sym(x_aes[[1]]),
xend = !!sym(x_aes[[2]]),
y = (!!sym(y_aes)),
yend = (!!sym(y_aes))) -> tmp
tmp %>%
ggplot(aes(x = x, y = (y), xend = xend, yend = (yend))) +
scale_y_discrete(breaks = NULL) +
labs(x = x_labs,y = "Cases") +
theme_light() -> p

if (is.na(col_label)) {
p + geom_segment(lwd = line_width, color = "black") -> p
p + geom_segment(linewidth = line_width, color = "black") -> p
} else {
p + geom_segment(aes(color = color), lwd = line_width) +
p + geom_segment(aes(color = color), linewidth = line_width) +
scale_color(name = col_label) -> p
}

Expand Down
6 changes: 3 additions & 3 deletions R/process_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ process_map.eventlog <- function(log,

graph %>% render_graph() -> graph

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

attr(graph, "base_precedence") <- base_precedence
attr(graph, "edges") <- edges
Expand Down
4 changes: 2 additions & 2 deletions R/trace_explorer.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ trace_explorer.eventlog <- function(log,
}

log %>%
rename("case_classifier" := !!case_id_(log),
as.data.frame %>%
rename("case_classifier" := !!case_id_(log),
"aid" := !!activity_instance_id_(log),
"event_classifier" := !!activity_id_(log),
"timestamp_classifier" := !!timestamp_(log)) %>%
as.data.frame %>%
arrange(timestamp_classifier, .order) %>%
# distinct keeps first entry (=minimum)
distinct(case_classifier, event_classifier, aid, .keep_all = TRUE) %>%
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ options(tibble.print_min = 5, tibble.print_max = 5)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->

**processmapR** is a [`R`](https://www.r-project.org/) package for creating process maps. Part of the [bupaR](https://www.bupar.net/) eco-system for business process analysis.
**processmapR** is a [`R`](https://www.r-project.org/) package for creating process maps. Part of the [bupaR](https://bupar.net/) eco-system for business process analysis.

## Installation

Expand All @@ -47,7 +47,7 @@ devtools::install_github("bupaverse/processmapR")

## Example

The [bupaR Documentation](https://bupar.net/processmaps.html) website contains more details on creating process maps using **processmapR**.
The [bupaR Documentation](https://bupaverse.github.io/docs/) website contains more details on creating process maps using **processmapR**.

```{r example1, results = "hide"}
library(processmapR)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ devtools::install_github("bupaverse/processmapR")

## Example

The [bupaR Documentation](https://bupar.net/processmaps.html) website
The [bupaR Documentation](https://bupaverse.github.io/docs/) website
contains more details on creating process maps using **processmapR**.

``` r
Expand All @@ -63,6 +63,7 @@ library(bupaR)
# Process map
patients %>%
process_map()
#> PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.
```

![process map](man/figures/README-example1-1.png)
Expand Down

0 comments on commit 5b3a53f

Please sign in to comment.