117 lines
3.8 KiB
R
117 lines
3.8 KiB
R
#' ---
|
|
#' title: "Modelling log files with Process Mining"
|
|
#' author: "Nora Wickelmaier"
|
|
#' date: "`r Sys.Date()`"
|
|
#' output:
|
|
#' html_document:
|
|
#' toc: true
|
|
#' toc_float: true
|
|
#' pdf_document:
|
|
#' toc: true
|
|
#' number_sections: true
|
|
#' geometry: margin = 2.5cm
|
|
#' ---
|
|
|
|
# setwd("C:/Users/nwickelmaier/Nextcloud/Documents/MDS/2023ss/60100_master_thesis/code")
|
|
|
|
#' # Read data
|
|
|
|
dat <- read.table("../data/haum/event_logfiles_small.csv", sep = ";", header = TRUE)
|
|
dat$date.start <- as.POSIXct(dat$date.start)
|
|
dat$date.stop <- as.POSIXct(dat$date.stop)
|
|
|
|
#' # Creating event logs
|
|
|
|
library(bupaverse)
|
|
|
|
names(dat)[names(dat) %in% c("date.start", "date.stop")] <- c("start",
|
|
"complete")
|
|
|
|
table(table(dat$start))
|
|
# --> hmm...
|
|
|
|
summary(aggregate(duration ~ trace, dat, mean))
|
|
|
|
|
|
alog <- activitylog(dat,
|
|
case_id = "trace",
|
|
activity_id = "event",
|
|
#resource_id = "case",
|
|
resource_id = "artwork",
|
|
timestamps = c("start", "complete"))
|
|
|
|
# --> have not understood, yet, which ist what...
|
|
|
|
process_map(alog)
|
|
|
|
process_map(alog, frequency("relative"))
|
|
process_map(alog, frequency("relative_consequent"))
|
|
|
|
library(processanimateR)
|
|
|
|
animate_process(to_eventlog(alog))
|
|
|
|
col_vector <- c("#7FC97F", "#BEAED4", "#FDC086", "#FFFF99", "#386CB0",
|
|
"#F0027F", "#BF5B17", "#666666", "#1B9E77", "#D95F02",
|
|
"#7570B3", "#E7298A", "#66A61E", "#E6AB02", "#A6761D",
|
|
"#666666", "#A6CEE3", "#1F78B4", "#B2DF8A", "#33A02C",
|
|
"#FB9A99", "#E31A1C", "#FDBF6F", "#FF7F00", "#CAB2D6",
|
|
"#6A3D9A", "#FFFF99", "#B15928", "#FBB4AE", "#B3CDE3",
|
|
"#CCEBC5", "#DECBE4", "#FED9A6", "#FFFFCC", "#E5D8BD",
|
|
"#FDDAEC", "#F2F2F2", "#B3E2CD", "#FDCDAC", "#CBD5E8",
|
|
"#F4CAE4", "#E6F5C9", "#FFF2AE", "#F1E2CC", "#CCCCCC",
|
|
"#E41A1C", "#377EB8", "#4DAF4A", "#984EA3", "#FF7F00",
|
|
"#FFFF33", "#A65628", "#F781BF", "#999999", "#66C2A5",
|
|
"#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F",
|
|
"#E5C494", "#B3B3B3", "#8DD3C7", "#FFFFB3", "#BEBADA",
|
|
"#FB8072", "#80B1D3", "#FDB462", "#B3DE69", "#FCCDE5",
|
|
"#D9D9D9")
|
|
|
|
animate_process(to_eventlog(alog), mode = "relative", jitter = 10, legend = "color",
|
|
mapping = token_aes(color = token_scale("artwork",
|
|
scale = "ordinal",
|
|
range = col_vector)))
|
|
|
|
elog <- to_eventlog(alog)
|
|
animate_process(elog[elog$artwork == "054", ])
|
|
animate_process(elog[elog$artwork == "080", ])
|
|
animate_process(elog[elog$artwork == "501", ])
|
|
|
|
process_map(alog[alog$artwork == "054", ])
|
|
|
|
animate_process(elog[elog$artwork %in% c("080", "054"), ],
|
|
mode = "relative", jitter = 10, legend = "color",
|
|
mapping = token_aes(color = token_scale("artwork",
|
|
scale = "ordinal",
|
|
range = c("black", "gray"))))
|
|
# --> not sure, yet, how to interpret this...
|
|
|
|
|
|
|
|
|
|
alog080 <- activitylog(dat[dat$artwork %in% "080", ],
|
|
#case_id = "case",
|
|
case_id = "trace",
|
|
activity_id = "event",
|
|
#resource_id = "trace",
|
|
resource_id = "case",
|
|
timestamps = c("start", "complete"))
|
|
|
|
process_map(alog080, frequency("relative"))
|
|
|
|
|
|
|
|
alog054 <- activitylog(dat[dat$artwork %in% "054", ],
|
|
#case_id = "case",
|
|
case_id = "trace",
|
|
activity_id = "event",
|
|
#resource_id = "trace",
|
|
resource_id = "case",
|
|
timestamps = c("start", "complete"))
|
|
|
|
process_map(alog054, frequency("relative"))
|
|
|
|
|
|
|
|
|