142 lines
4.7 KiB
R
142 lines
4.7 KiB
R
# setwd("C:/Users/nwickelmaier/Nextcloud/Documents/MDS/2023ss/60100_master_thesis/code")
|
|
|
|
# Read data
|
|
|
|
dat0 <- read.table("../data/haum/event_logfiles_2023-10-25_17-29-52.csv",
|
|
sep = ";", header = TRUE)
|
|
dat0$date.start <- as.POSIXct(dat0$date.start)
|
|
dat0$date.stop <- as.POSIXct(dat0$date.stop)
|
|
dat0$artwork <- sprintf("%03d", dat0$artwork)
|
|
|
|
table(dat0[!duplicated(dat0$trace), "event"])
|
|
|
|
proportions(table(dat0[!duplicated(dat0$trace), "event"]))
|
|
|
|
tmp <- dat0[!duplicated(dat0$trace) & dat0$event %in% c("openTopic",
|
|
"openPopup"), ]
|
|
|
|
dat <- dat0
|
|
i <- 1
|
|
stop <- 1
|
|
|
|
while (stop > 0) {
|
|
stop <- sum(!duplicated(dat$trace) & dat$event %in% c("openTopic", "openPopup"))
|
|
dat <- dat[!(!duplicated(dat$trace) &
|
|
dat$event %in% c("openTopic", "openPopup")), ]
|
|
print(i)
|
|
i <- i + 1
|
|
print(table(dat[!duplicated(dat$trace), "event"]))
|
|
}
|
|
|
|
# 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))
|
|
|
|
# TODO: Find trace that has flipCard --> openPopup --> openTopic
|
|
dato <- dat[dat$event != "move", ]
|
|
dato_split <- split(dato, ~ trace)
|
|
tmp <- lapply(dato_split, function(x) unique(x$event))
|
|
#tmp <- lapply(unique(dato$trace), function(x) unique(dato[dato$trace == x, "event"]))
|
|
|
|
ids <- sapply(tmp, length) == 3
|
|
tmp2 <- as.data.frame(do.call(rbind, tmp[ids]))
|
|
names(tmp2) <- c("flipCard", "openTopic", "openPopup")
|
|
|
|
table(tmp2$flipCard)
|
|
table(tmp2$openTopic)
|
|
table(tmp2$openPopup)
|
|
|
|
frag_ids <- which(tmp2$openTopic == "openPopup")
|
|
|
|
tmp3 <- dat[dat$trace %in% rownames(tmp2)[frag_ids], ]
|
|
|
|
tmp4 <- tmp3[!tmp3$glossar == 1, ]
|
|
|
|
dat6 <- rbind(dat[!dat$trace %in% rownames(tmp2)[frag_ids], ], tmp4)
|
|
|
|
|
|
alog <- activitylog(dat,
|
|
case_id = "trace",
|
|
activity_id = "event",
|
|
#resource_id = "case",
|
|
resource_id = "artwork",
|
|
timestamps = c("start", "complete"))
|
|
|
|
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"))
|
|
|
|
|
|
|
|
|