-
Notifications
You must be signed in to change notification settings - Fork 11
/
adjust_logs.Rmd
92 lines (64 loc) · 2.63 KB
/
adjust_logs.Rmd
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
---
title: "bupaR Docs | Adjust Logs"
---
```{r echo = F, out.width="25%", fig.align = "right"}
knitr::include_graphics("images/icons/create.PNG")
```
***
# Adjusting logs
The _mapping_ of a log is defined by the different variables which are mapped onto the specific characteristics.
For an `eventlog`:
* case identifier (`case_id`)
* activity type (`activity_id`)
* activity instance (`activity_instance_id`)
* transaction status (`lifecycle_id`)
* timestamp (`timestamp`)
* resource (`resource`)
For an `activitylog`:
* case identifier (`case_id`)
* activity type (`activity_id`)
* timestamps (`timestamps`)
* resource (`resource`)
More information on these characteristics can be found [here](http://bupar.net/creating_eventlogs.html). Each of these can be modified to approach event logs from a different angle. This can be done using the `eventlog()` or `activitylog()`, auxiliary `set_`-functions, or by using an existing mapping.
```{r message = F, warning = F}
library(bupaR)
```
## Using `eventlog()`/`activitylog()`
The `eventlog()` and `activitylog()` functions are not only used to instantiate a `log` object, but can also be used to modify it, by using a `log` object as input and setting only the identifiers one wants to change.
For example, consider the `traffic_fines` data. We could change `case_id` argument to the vehicleclass column as follows (This is a purely hypothetical example). You will see that the number of cases has changed after this modification.
```{r}
traffic_fines %>%
eventlog(case_id = "vehicleclass")
```
## Using `set_`-functions
If we only want to change one of the elements, as in the example above, `set()` provides a very convenient way to do so. The same change as before can be done as follows:
```{r}
traffic_fines %>%
set_case_id("vehicleclass")
```
## Using existing mapping
It is also possible to extract the `log` mapping at a certain point of time using `mapping()`.
```{r}
mapping_fines <- mapping(traffic_fines)
mapping_fines
```
We can adjust the mapping incrementally by using the described approaches above.
```{r}
traffic_fines %>%
set_case_id("vehicleclass") %>%
set_activity_id("notificationtype") -> traffic_fines
```
Later, we can always undo these changes and "reset" the original mapping using `re_map()`.
```{r}
traffic_fines %>%
re_map(mapping_fines)
```
```{r include = F}
traffic_fines <- eventdataR::traffic_fines
```
```{r footer, results = "asis", echo = F}
CURRENT_PAGE <- stringr::str_replace(knitr::current_input(), ".Rmd",".html")
res <- knitr::knit_expand("_button_footer.Rmd", quiet = TRUE)
res <- knitr::knit_child(text = unlist(res), quiet = TRUE)
cat(res, sep = '\n')
```