The view of an event log is defined by the different variables which are mapped onto the specific characteristics:
case_id
)activity_id
)activity_instance_id
)lifecycle_id
)timestamp
)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.
eventlog
functionThe 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")
## Log of 34724 events consisting of:
## 4 traces
## 4 cases
## 34724 instances of 11 activities
## 16 resources
## Events occurred from 2006-06-17 until 2012-03-26
##
## Variables were mapped as follows:
## Case identifier: vehicleclass
## Activity identifier: activity
## Resource identifier: resource
## Activity instance identifier: activity_instance_id
## Timestamp: timestamp
## Lifecycle transition: lifecycle
##
## # A tibble: 34,724 x 18
## case_id activity lifecycle resource timestamp amount article
## <chr> <fct> <fct> <fct> <dttm> <dbl> <int>
## 1 A1 Create ~ complete 561 2006-07-24 00:00:00 350 157
## 2 A1 Send Fi~ complete <NA> 2006-12-05 00:00:00 NA NA
## 3 A100 Create ~ complete 561 2006-08-02 00:00:00 350 157
## 4 A100 Send Fi~ complete <NA> 2006-12-12 00:00:00 NA NA
## 5 A100 Insert ~ complete <NA> 2007-01-15 00:00:00 NA NA
## 6 A100 Add pen~ complete <NA> 2007-03-16 00:00:00 715 NA
## 7 A100 Send fo~ complete <NA> 2009-03-30 00:00:00 NA NA
## 8 A10000 Create ~ complete 561 2007-03-09 00:00:00 360 157
## 9 A10000 Send Fi~ complete <NA> 2007-07-17 00:00:00 NA NA
## 10 A10000 Insert ~ 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>
set
functionsIf 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")
## Log of 34724 events consisting of:
## 4 traces
## 4 cases
## 34724 instances of 11 activities
## 16 resources
## Events occurred from 2006-06-17 until 2012-03-26
##
## Variables were mapped as follows:
## Case identifier: vehicleclass
## Activity identifier: activity
## Resource identifier: resource
## Activity instance identifier: activity_instance_id
## Timestamp: timestamp
## Lifecycle transition: lifecycle
##
## # A tibble: 34,724 x 18
## case_id activity lifecycle resource timestamp amount article
## <chr> <fct> <fct> <fct> <dttm> <dbl> <int>
## 1 A1 Create ~ complete 561 2006-07-24 00:00:00 350 157
## 2 A1 Send Fi~ complete <NA> 2006-12-05 00:00:00 NA NA
## 3 A100 Create ~ complete 561 2006-08-02 00:00:00 350 157
## 4 A100 Send Fi~ complete <NA> 2006-12-12 00:00:00 NA NA
## 5 A100 Insert ~ complete <NA> 2007-01-15 00:00:00 NA NA
## 6 A100 Add pen~ complete <NA> 2007-03-16 00:00:00 715 NA
## 7 A100 Send fo~ complete <NA> 2009-03-30 00:00:00 NA NA
## 8 A10000 Create ~ complete 561 2007-03-09 00:00:00 360 157
## 9 A10000 Send Fi~ complete <NA> 2007-07-17 00:00:00 NA NA
## 10 A10000 Insert ~ 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>
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)
## Log of 34724 events consisting of:
## 44 traces
## 10000 cases
## 34724 instances of 11 activities
## 16 resources
## Events occurred from 2006-06-17 until 2012-03-26
##
## Variables were mapped as follows:
## Case identifier: case_id
## Activity identifier: activity
## Resource identifier: resource
## Activity instance identifier: activity_instance_id
## Timestamp: timestamp
## Lifecycle transition: lifecycle
##
## # A tibble: 34,724 x 18
## case_id activity lifecycle resource timestamp amount article
## <chr> <fct> <fct> <fct> <dttm> <dbl> <int>
## 1 A1 Create ~ complete 561 2006-07-24 00:00:00 350 157
## 2 A1 Send Fi~ complete <NA> 2006-12-05 00:00:00 NA NA
## 3 A100 Create ~ complete 561 2006-08-02 00:00:00 350 157
## 4 A100 Send Fi~ complete <NA> 2006-12-12 00:00:00 NA NA
## 5 A100 Insert ~ complete <NA> 2007-01-15 00:00:00 NA NA
## 6 A100 Add pen~ complete <NA> 2007-03-16 00:00:00 715 NA
## 7 A100 Send fo~ complete <NA> 2009-03-30 00:00:00 NA NA
## 8 A10000 Create ~ complete 561 2007-03-09 00:00:00 360 157
## 9 A10000 Send Fi~ complete <NA> 2007-07-17 00:00:00 NA NA
## 10 A10000 Insert ~ 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>