-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocessmining.R
104 lines (74 loc) · 2.66 KB
/
processmining.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
library(bupaR)
library(openxlsx)
library(dplyr)
library(processanimateR)
library(heuristicsmineR)
library(petrinetR)
library(lubridate)
filename<-"besteladviezen.xlsx"
read_file<-TRUE
if (read_file) {
eventlog<-read.xlsx(filename,sheet=1,detectDates=TRUE,colNames=TRUE)
eventlog$TimeStamp<-as.POSIXct(eventlog$TimeStamp, tz = "", format="%d/%m/%y %H:%M:%OS" ,
tryFormats = c("%Y-%m-%d %H:%M:%OS",
"%Y/%m/%d %H:%M:%OS",
"%d/%m/%Y %H:%M:%OS",
"%Y-%m-%d %H:%M",
"%Y/%m/%d %H:%M",
"%Y-%m-%d",
"%Y/%m/%d"),
optional = FALSE)
}
evLog<-eventlog %>%
mutate(activity_instance = 1:nrow(.)) %>%
eventlog(
case_id = "CaseID",
activity_id = "Activity",
lifecycle_id = "status",
activity_instance_id = "activity_instance",
timestamp = "TimeStamp",
resource_id = "Approver"
)
# filter on year
evLog<-evLog[evLog$Datum==2014,]
# filter on begin and end activities
evLog <- evLog %>%
filter_endpoints(start_activities = c("BA maken","BA-regel maken"), end_activities = c("IO maken","IO-regel maken"))
# filter on timestamp for the starting activity
# evLog <- evLog %>%
# filter_time_period(interval = ymd(c(20140115, 20140120)), filter_method = "start")
evLog %>%
dotted_chart
# dependency matrix with threshold
dependency_matrix(evLog, threshold = .5) %>% render_dependency_matrix()
# causal net with threshold
causal_net(evLog, threshold = .7) %>% render_causal_net()
# Efficient precedence matrix
m <- precedence_matrix_absolute(evLog)
as.matrix(m)
evLog %>%
process_map(type = frequency("relative"))
evLog %>%
process_map(type = frequency("absolute"))
evLog %>%
process_map(type = frequency("relative_case", color_scale = "Purples"))
evLog %>%
process_map(performance(median, "days"))
evLog %>%
process_map(performance(mean, "hours"))
evLog %>%
process_map(type_nodes = frequency("relative_case"),
type_edges = performance(mean))
evLog %>%
trace_explorer()
evLog<-evLog %>%
# filter_activity(c("LacticAcid", "CRP", "Leucocytes", "Return ER", "IV Liquid", "IV Antibiotics"), reverse = T) %>%
filter_trace_frequency(percentage = 0.60)
# animate log on process map
# animate_process(evLog %>% filter_trace_frequency(percentage = 0.50),
# mode = "relative",
# legend = "CaseId",
# mapping = token_aes(color = token_scale("amount",
# scale = "linear",
# range = c("yellow","red"))))
citation("processmapR")