46 lines
1.3 KiB
R
46 lines
1.3 KiB
R
######################################################################
|
|
time_minmax_ms <- function(subdata) {
|
|
subdata$min_time <- min(subdata$timeMs.start)
|
|
if (all(is.na(subdata$timeMs.stop))) {
|
|
subdata$max_time <- NA
|
|
} else {
|
|
subdata$max_time <- max(subdata$timeMs.stop, na.rm = TRUE)
|
|
}
|
|
subdata
|
|
}
|
|
|
|
######################################################################
|
|
check_infocards <- function(subdata, artworks) {
|
|
infocard_only <- NULL
|
|
if(any(unique(subdata$item) %in% artworks)) {
|
|
infocard_only <- FALSE
|
|
} else {
|
|
infocard_only <- TRUE
|
|
}
|
|
as.numeric(infocard_only)
|
|
}
|
|
|
|
######################################################################
|
|
normalize <- function(x) {
|
|
(x - min(x)) / (max(x) - min(x))
|
|
}
|
|
|
|
######################################################################
|
|
get_centrality <- function(case, data) {
|
|
|
|
data$start <- data$date.start
|
|
data$complete <- data$date.stop
|
|
|
|
alog <- bupaR::activitylog(data[data$case == case, ],
|
|
case_id = "case",
|
|
activity_id = "item",
|
|
resource_id = "path",
|
|
timestamps = c("start", "complete"))
|
|
|
|
net <- processmapR::process_map(alog, render = FALSE)
|
|
inet <- DiagrammeR::to_igraph(net)
|
|
|
|
igraph::centr_betw(inet)$centralization
|
|
}
|
|
|