Skip to content

Commit e31eed0

Browse files
Merge branch 'dev'
2 parents 3da9b09 + 8ff0d95 commit e31eed0

14 files changed

Lines changed: 56 additions & 44 deletions

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: processmapR
22
Type: Package
33
Title: Construct Process Maps Using Event Data
4-
Version: 0.5.5
4+
Version: 0.5.7
55
Authors@R: c(person("Gert","Janssenswillen",email = "gert.janssenswillen@uhasselt.be", role = c("aut","cre")),
66
person("Gerard","van Hulzen", email = "gerard.vanhulzen@uhasselt.be", role = c("ctb")),
77
person("Benoît","Depaire",email = "benoit.depaire@uhasselt.be", role = c("ctb")),
@@ -39,7 +39,7 @@ Imports:
3939
lifecycle,
4040
htmlwidgets
4141
Encoding: UTF-8
42-
RoxygenNote: 7.2.3
42+
RoxygenNote: 7.3.2
4343
Suggests:
4444
knitr,
4545
rmarkdown,

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ importFrom(data.table,data.table)
6969
importFrom(data.table,dcast.data.table)
7070
importFrom(data.table,setnames)
7171
importFrom(data.table,setorder)
72+
importFrom(dplyr,"%>%")
7273
importFrom(glue,glue)
7374
importFrom(hms,as_hms)
7475
importFrom(lifecycle,deprecated)

R/precedence_matrix.plot.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ plot.process_matrix <- function(x, ...) {
2626

2727
x %>%
2828
ggplot(aes(antecedent, consequent)) +
29-
geom_raster(aes(fill = n)) +
29+
geom_tile(aes(fill = n)) +
3030
geom_text(aes(label = n), color = "white", fontface = "bold") +
3131
scale_fill_continuous_bupaR(name = "Absolute Frequency") +
3232
coord_flip() +
@@ -39,7 +39,7 @@ plot.process_matrix <- function(x, ...) {
3939
} else if(type == "relative") {
4040
x %>%
4141
ggplot(aes(antecedent, consequent)) +
42-
geom_raster(aes(fill = rel_n)) +
42+
geom_tile(aes(fill = rel_n)) +
4343
geom_text(aes(label = round(rel_n*100, 2)), color = "white", fontface = "bold") +
4444
scale_fill_continuous_bupaR(name = "Relative Frequency") +
4545
theme_light() +
@@ -107,7 +107,7 @@ plot.process_matrix <- function(x, ...) {
107107
x %>%
108108
filter(antecedent != "Start", consequent != "End") %>%
109109
ggplot(aes(antecedent, consequent)) +
110-
geom_raster(aes(fill = flow_time)) +
110+
geom_tile(aes(fill = flow_time)) +
111111
geom_text(aes(label =round(flow_time, 2)), color = "white", fontface = "bold") +
112112
scale_fill_continuous_bupaR(name = paste0("Flow time in ", attr(type, "units")), palette = "orange") +
113113
theme_light() +

R/process_map.R

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,29 +162,37 @@ process_map.eventlog <- function(log,
162162
as.data.frame() -> base_log
163163
}
164164

165-
#create end points for graph
166-
167-
base_log %>%
168-
group_by(CASE_CLASSIFIER_) %>%
169-
arrange(start_time, min_order) -> points_temp
170-
171-
points_temp %>%
172-
slice(1) %>%
173-
mutate(ACTIVITY_CLASSIFIER_ = "ARTIFICIAL_START",
174-
end_time = start_time,
175-
min_order = -Inf) -> end_points_start
176-
points_temp %>%
177-
slice(n()) %>%
178-
mutate(ACTIVITY_CLASSIFIER_ = "ARTIFICIAL_END",
179-
start_time = end_time,
180-
min_order = Inf) -> end_points_end
165+
#create end points for graph using data.table slicing
166+
dt <- as.data.table(base_log)
167+
#set correct ordering within groups
168+
data.table::setorder(dt, CASE_CLASSIFIER_, start_time, min_order, na.last=TRUE)
169+
#specifying order of columns to reorder end_points_start and end_points_end
170+
colorder <- c('ACTIVITY_CLASSIFIER_', 'ACTIVITY_INSTANCE_CLASSIFIER_', 'CASE_CLASSIFIER_', 'start_time', 'end_time', 'min_order')
171+
172+
end_points_start <- dt[, .SD[1], by = CASE_CLASSIFIER_]
173+
end_points_start[, min_order := as.numeric(min_order)] #prevents warning when setting value to -Inf
174+
end_points_start[, `:=`(ACTIVITY_CLASSIFIER_ = "ARTIFICIAL_START",
175+
end_time = start_time,
176+
min_order = -Inf)]
177+
data.table::setcolorder(end_points_start, colorder)
178+
179+
end_points_end <- dt[, .SD[.N], by = CASE_CLASSIFIER_]
180+
end_points_end[, min_order := as.numeric(min_order)] #prevents warning when setting value to Inf
181+
end_points_end[, `:=`(ACTIVITY_CLASSIFIER_ = "ARTIFICIAL_END",
182+
start_time = end_time,
183+
min_order = Inf)]
184+
data.table::setcolorder(end_points_end, colorder)
181185

182186
#add endpoints to base log
183187

184188
suppressWarnings(
185189
bind_rows(end_points_start, end_points_end, base_log) %>%
186190
ungroup() -> base_log
187191
)
192+
193+
#converting ACTIVITY_CLASSIFIER_ to character to keep `base_log` identical to the previous dplyr method
194+
base_log <- base_log %>%
195+
mutate(ACTIVITY_CLASSIFIER_ = as.character(ACTIVITY_CLASSIFIER_))
188196

189197
#create base nodes list
190198

R/processmapR.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#'
33
#' @description This package provides several useful techniques process visualization.
44
#'
5-
#' @docType package
5+
# @docType package
66
#' @name processmapR
77
#'
88
#' @import dplyr

R/trace_explorer.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#'
33
#' @description
44
#' Different activity sequences in the `log` can be visualized with [`trace_explorer()`]. With the `type` argument,
5-
#' it can be used to explore frequent as well as infrequent traces. The `coverage` argument specificies how much of the
6-
#' `log` you want to explore. By default it is set at `0.2`, meaning that it will show the most (in)frequency traces
5+
#' it can be used to explore frequent as well as infrequent traces. The `coverage` argument specifies how much of the
6+
#' `log` you want to explore. By default it is set at `0.2`, meaning that it will show the most (in)frequent traces
77
#' covering 20% of the `log`.
88
#'
99
#' @param log [`log`][`bupaR::log`]: Object of class [`log`][`bupaR::log`] or derivatives ([`eventlog`][`bupaR::eventlog`]
@@ -89,7 +89,7 @@ trace_explorer.eventlog <- function(log,
8989
"x" = "You supplied a {.cls {class(coverage)}}: {.val {coverage}}"))
9090
} else if(is.null(coverage)) {
9191
if(n_traces <= 0 || !is_integerish(n_traces, n = 1))
92-
cli_abort(c("{.arg n_traces} must be an interger-like {.cls numeric} larger than {.val {0}}.",
92+
cli_abort(c("{.arg n_traces} must be an integer-like {.cls numeric} larger than {.val {0}}.",
9393
"x" = "You supplied a {.cls {class(n_traces)}}: {.val {n_traces}}"))
9494
}
9595

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ options(tibble.print_min = 5, tibble.print_max = 5)
1919

2020
<!-- badges: start -->
2121
[![CRAN status](https://www.r-pkg.org/badges/version/processmapR)](https://CRAN.R-project.org/package=processmapR)
22-
[![GitHub version](https://img.shields.io/badge/GitHub-0.5.4-blue)](https://github.com/bupaverse/processmapR)
22+
[![GitHub version](https://img.shields.io/badge/GitHub-0.5.7-blue)](https://github.com/bupaverse/processmapR)
2323
[![R-CMD-check](https://github.com/bupaverse/processmapR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bupaverse/processmapR/actions/workflows/R-CMD-check.yaml)
2424
[![codecov](https://codecov.io/gh/bupaverse/processmapR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/bupaverse/processmapR?branch=master)
2525
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![CRAN
99
status](https://www.r-pkg.org/badges/version/processmapR)](https://CRAN.R-project.org/package=processmapR)
1010
[![GitHub
11-
version](https://img.shields.io/badge/GitHub-0.5.4-blue)](https://github.com/bupaverse/processmapR)
11+
version](https://img.shields.io/badge/GitHub-0.5.7-blue)](https://github.com/bupaverse/processmapR)
1212
[![R-CMD-check](https://github.com/bupaverse/processmapR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bupaverse/processmapR/actions/workflows/R-CMD-check.yaml)
1313
[![codecov](https://codecov.io/gh/bupaverse/processmapR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/bupaverse/processmapR?branch=master)
1414
[![Lifecycle:
@@ -63,7 +63,6 @@ library(bupaR)
6363
# Process map
6464
patients %>%
6565
process_map()
66-
#> 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.
6766
```
6867

6968
<figure>

man/export_graph.Rd

Lines changed: 12 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/figures/README-example2-1.png

5 Bytes
Loading

0 commit comments

Comments
 (0)