2024-03-06 17:59:22 +01:00
|
|
|
# 05_check-traces.R
|
|
|
|
#
|
|
|
|
# content: (1) Look at broken trace
|
|
|
|
# (2) Function to find broken traces
|
2024-03-09 17:22:46 +01:00
|
|
|
# (3) DFG for complete data
|
|
|
|
# (4) Export data frame for analyses
|
2024-03-06 17:59:22 +01:00
|
|
|
#
|
2024-03-22 12:07:45 +01:00
|
|
|
# input: results/event_logfiles_2024-02-21_16-07-33.csv
|
|
|
|
# results/raw_logfiles_2024-02-21_16-07-33.csv
|
|
|
|
# output: results/eventlogs_pre-corona_cleaned.RData
|
|
|
|
# results/eventlogs_pre-corona_cleaned.csv
|
|
|
|
# ../../thesis/figures/dfg_complete_WFnet_R.pdf
|
2024-03-06 17:59:22 +01:00
|
|
|
#
|
2024-03-22 12:07:45 +01:00
|
|
|
# last mod: 2024-03-23
|
2024-03-06 17:59:22 +01:00
|
|
|
|
2024-01-25 17:21:18 +01:00
|
|
|
# setwd("C:/Users/nwickelmaier/Nextcloud/Documents/MDS/2023ss/60100_master_thesis/analysis/code")
|
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
#--------------- (1) Look at broken trace ---------------
|
2024-01-16 09:59:23 +01:00
|
|
|
|
2024-03-22 12:07:45 +01:00
|
|
|
datraw <- read.table("results/raw_logfiles_2024-02-21_16-07-33.csv",
|
|
|
|
header = TRUE, sep = ";")
|
2024-01-16 09:59:23 +01:00
|
|
|
|
|
|
|
|
2024-03-22 12:07:45 +01:00
|
|
|
datlogs <- read.table("results/event_logfiles_2024-02-21_16-07-33.csv",
|
2024-01-30 11:48:48 +01:00
|
|
|
colClasses = c("character", "character", "POSIXct",
|
|
|
|
"POSIXct", "character", "integer",
|
|
|
|
"numeric", "character", "character",
|
|
|
|
rep("numeric", 3), "character",
|
|
|
|
"character", rep("numeric", 11),
|
|
|
|
"character", "character"),
|
|
|
|
sep = ";", header = TRUE)
|
2024-01-25 17:21:18 +01:00
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
artwork <- "176"
|
|
|
|
fileId <- c('2017_06_16-13_49_00.log', '2017_06_16-13_59_00.log')
|
|
|
|
path <- 106098
|
2024-01-16 09:59:23 +01:00
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
datraw[datraw$item == artwork & datraw$fileId %in% fileId, ]
|
2024-01-16 09:59:23 +01:00
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
datlogs[datlogs$path == path, ]
|
2023-09-28 15:04:59 +02:00
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
#--------------- (2) Function to find broken traces ---------------
|
2023-08-14 16:57:03 +02:00
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
tmp <- datlogs[datlogs$event != "move", ]
|
2023-08-14 16:57:03 +02:00
|
|
|
|
2024-01-25 17:21:18 +01:00
|
|
|
check_traces <- function(data) {
|
2023-09-28 15:04:59 +02:00
|
|
|
|
2024-01-25 17:21:18 +01:00
|
|
|
datagg <- aggregate(event ~ path, data,
|
|
|
|
function(x) ifelse("openPopup" %in% x, T, F))
|
|
|
|
paths <- datagg$path[datagg$event]
|
|
|
|
datcheck <- data[data$path %in% paths, c("path", "event")]
|
|
|
|
datcheck <- datcheck[!duplicated(datcheck), ]
|
|
|
|
datcheck <- datcheck[order(datcheck$path), ]
|
|
|
|
|
|
|
|
retval <- NULL
|
|
|
|
for (path in unique(datcheck$path)) {
|
|
|
|
check <- !all(as.character(datcheck$event[datcheck$path == path]) ==
|
|
|
|
c("flipCard", "openTopic", "openPopup"))
|
|
|
|
retval <- rbind(retval, data.frame(path, check))
|
|
|
|
}
|
|
|
|
retval
|
|
|
|
}
|
|
|
|
|
|
|
|
check <- check_traces(tmp)
|
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
check[check$check, ]
|
2024-01-30 09:46:40 +01:00
|
|
|
|
2024-03-09 17:22:46 +01:00
|
|
|
#--------------- (3) DFG for complete data ---------------
|
|
|
|
|
|
|
|
tmp <- datlogs[datlogs$path != 106098, ]
|
|
|
|
tmp$start <- tmp$date.start
|
|
|
|
tmp$complete <- tmp$date.stop
|
|
|
|
|
|
|
|
alog <- bupaR::activitylog(tmp,
|
|
|
|
case_id = "path",
|
|
|
|
activity_id = "event",
|
|
|
|
resource_id = "item",
|
|
|
|
timestamps = c("start", "complete"))
|
|
|
|
|
|
|
|
dfg <- processmapR::process_map(alog,
|
|
|
|
type_nodes = processmapR::frequency("relative", color_scale = "Greys"),
|
|
|
|
sec_nodes = processmapR::frequency("absolute"),
|
|
|
|
type_edges = processmapR::frequency("relative", color_edges = "#FF6900"),
|
|
|
|
sec_edges = processmapR::frequency("absolute"),
|
|
|
|
rankdir = "LR",
|
|
|
|
render = FALSE)
|
|
|
|
|
|
|
|
processmapR::export_map(dfg,
|
2024-03-22 12:07:45 +01:00
|
|
|
file_name = paste0("../../thesis/figures/dfg_complete_WFnet_R.pdf"),
|
2024-03-09 17:22:46 +01:00
|
|
|
file_type = "pdf")
|
|
|
|
|
|
|
|
rm(tmp)
|
|
|
|
|
|
|
|
#--------------- (4) Export data frame for analyses ---------------
|
2024-03-06 17:59:22 +01:00
|
|
|
|
|
|
|
datlogs$event <- factor(datlogs$event, levels = c("move", "flipCard",
|
|
|
|
"openTopic",
|
|
|
|
"openPopup"))
|
|
|
|
datlogs$topic <- factor(datlogs$topic)
|
|
|
|
|
|
|
|
datlogs$weekdays <- factor(weekdays(datlogs$date.start),
|
|
|
|
levels = c("Montag", "Dienstag", "Mittwoch",
|
|
|
|
"Donnerstag", "Freitag", "Samstag",
|
|
|
|
"Sonntag"),
|
|
|
|
labels = c("Monday", "Tuesday", "Wednesday",
|
|
|
|
"Thursday", "Friday", "Saturday",
|
|
|
|
"Sunday"))
|
|
|
|
|
|
|
|
# Select data pre Corona
|
|
|
|
dat <- datlogs[as.Date(datlogs$date.start) < "2020-03-13", ]
|
|
|
|
# Remove corrupt trace
|
|
|
|
dat <- dat[dat$path != 106098, ]
|
|
|
|
|
2024-03-22 12:07:45 +01:00
|
|
|
save(dat, file = "results/eventlogs_pre-corona_cleaned.RData")
|
2024-03-06 17:59:22 +01:00
|
|
|
|
|
|
|
write.table(dat,
|
2024-03-22 12:07:45 +01:00
|
|
|
file = "results/eventlogs_pre-corona_cleaned.csv",
|
2024-03-06 17:59:22 +01:00
|
|
|
sep = ";",
|
|
|
|
quote = FALSE,
|
|
|
|
row.names = FALSE)
|
|
|
|
|