The view of an event log is defined by the different variables which are mapped onto the specific characteristics:

  • case identifier (case_id)
  • activity information
    • activity type (activity_id)
    • activity instance (activity_instance_id)
    • transaction status (lifecycle_id)
  • timestamp (timestamp)
  • resource (resource)

More information on these characteristics can be found here. Each of these can be modified to approach the event log from a different view. This can be done using the eventlog-function, auxiliary set-functions or using an existing mapping.

Using eventlog function

The eventlog function is not only used to instantiate and event log object, but can also be used to modify it, by using an event log object as input and setting just the identifiers one wants to change.

For example, consider the traffic_fines data. We could change to case_id 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.

traffic_fines %>%
    eventlog(case_id = "vehicleclass")
## Event log consisting of:
## 34724 events
## 4 traces
## 4 cases
## 11 activities
## 34724 activity instances
## 
## # A tibble: 34,724 x 18
##    case_id activity  lifecycle resource timestamp           amount article
##    <chr>   <fct>     <fct>     <fct>    <dttm>               <dbl>   <int>
##  1 A1      Create F~ complete  561      2006-07-24 00:00:00   350.     157
##  2 A1      Send Fine complete  <NA>     2006-12-05 00:00:00    NA       NA
##  3 A100    Create F~ complete  561      2006-08-02 00:00:00   350.     157
##  4 A100    Send Fine complete  <NA>     2006-12-12 00:00:00    NA       NA
##  5 A100    Insert F~ complete  <NA>     2007-01-15 00:00:00    NA       NA
##  6 A100    Add pena~ complete  <NA>     2007-03-16 00:00:00   715.      NA
##  7 A100    Send for~ complete  <NA>     2009-03-30 00:00:00    NA       NA
##  8 A10000  Create F~ complete  561      2007-03-09 00:00:00   360.     157
##  9 A10000  Send Fine complete  <NA>     2007-07-17 00:00:00    NA       NA
## 10 A10000  Insert F~ complete  <NA>     2007-08-02 00:00:00    NA       NA
## # ... with 34,714 more rows, and 11 more variables: dismissal <chr>,
## #   expense <dbl>, lastsent <chr>, matricola <chr>,
## #   notificationtype <chr>, paymentamount <dbl>, points <int>,
## #   totalpaymentamount <chr>, vehicleclass <chr>,
## #   activity_instance_id <chr>, .order <int>

Using set functions

If we only want to change one of the elements, as in the example above, the set function provide a very convenient way to do so. The same change as before can be done as follows.

traffic_fines %>%
    set_case_id("vehicleclass")
## Event log consisting of:
## 34724 events
## 4 traces
## 4 cases
## 11 activities
## 34724 activity instances
## 
## # A tibble: 34,724 x 18
##    case_id activity  lifecycle resource timestamp           amount article
##    <chr>   <fct>     <fct>     <fct>    <dttm>               <dbl>   <int>
##  1 A1      Create F~ complete  561      2006-07-24 00:00:00   350.     157
##  2 A1      Send Fine complete  <NA>     2006-12-05 00:00:00    NA       NA
##  3 A100    Create F~ complete  561      2006-08-02 00:00:00   350.     157
##  4 A100    Send Fine complete  <NA>     2006-12-12 00:00:00    NA       NA
##  5 A100    Insert F~ complete  <NA>     2007-01-15 00:00:00    NA       NA
##  6 A100    Add pena~ complete  <NA>     2007-03-16 00:00:00   715.      NA
##  7 A100    Send for~ complete  <NA>     2009-03-30 00:00:00    NA       NA
##  8 A10000  Create F~ complete  561      2007-03-09 00:00:00   360.     157
##  9 A10000  Send Fine complete  <NA>     2007-07-17 00:00:00    NA       NA
## 10 A10000  Insert F~ complete  <NA>     2007-08-02 00:00:00    NA       NA
## # ... with 34,714 more rows, and 11 more variables: dismissal <chr>,
## #   expense <dbl>, lastsent <chr>, matricola <chr>,
## #   notificationtype <chr>, paymentamount <dbl>, points <int>,
## #   totalpaymentamount <chr>, vehicleclass <chr>,
## #   activity_instance_id <chr>, .order <int>

Using existing mapping

It is also poosible to take a snapshot of the eventlog mapping at a certain point in time, and reuse this later. A mapping can be extracted using the mapping function.

mapping_fines <- mapping(traffic_fines)
mapping_fines
## Case identifier:     case_id 
## Activity identifier:     activity 
## Resource identifier:     resource 
## Activity instance identifier:    activity_instance_id 
## Timestamp:           timestamp 
## Lifecycle transition:        lifecycle

We can than adjust the mapping incrementally by using the approaches above.

traffic_fines %>%
    set_case_id("vehicleclass") %>%
    set_activity_id("notificationtype") -> traffic_fines

Later, we can undo these changes and “reset” the original mapping using the re_map function.

traffic_fines %>%
    re_map(mapping_fines)
## Event log consisting of:
## 34724 events
## 44 traces
## 10000 cases
## 11 activities
## 34724 activity instances
## 
## # A tibble: 34,724 x 18
##    case_id activity  lifecycle resource timestamp           amount article
##    <chr>   <fct>     <fct>     <fct>    <dttm>               <dbl>   <int>
##  1 A1      Create F~ complete  561      2006-07-24 00:00:00   350.     157
##  2 A1      Send Fine complete  <NA>     2006-12-05 00:00:00    NA       NA
##  3 A100    Create F~ complete  561      2006-08-02 00:00:00   350.     157
##  4 A100    Send Fine complete  <NA>     2006-12-12 00:00:00    NA       NA
##  5 A100    Insert F~ complete  <NA>     2007-01-15 00:00:00    NA       NA
##  6 A100    Add pena~ complete  <NA>     2007-03-16 00:00:00   715.      NA
##  7 A100    Send for~ complete  <NA>     2009-03-30 00:00:00    NA       NA
##  8 A10000  Create F~ complete  561      2007-03-09 00:00:00   360.     157
##  9 A10000  Send Fine complete  <NA>     2007-07-17 00:00:00    NA       NA
## 10 A10000  Insert F~ complete  <NA>     2007-08-02 00:00:00    NA       NA
## # ... with 34,714 more rows, and 11 more variables: dismissal <chr>,
## #   expense <dbl>, lastsent <chr>, matricola <chr>,
## #   notificationtype <fct>, paymentamount <dbl>, points <int>,
## #   totalpaymentamount <chr>, vehicleclass <chr>,
## #   activity_instance_id <chr>, .order <int>