Inspect logs

Getting metadata

The mapping function can be used to retrieve all the meta data from a log object, i.e. the relation between log identifiers and the corresponding data fields.

patients %>% mapping
## Case identifier:     patient 
## Activity identifier:     handling 
## Resource identifier:     employee 
## Activity instance identifier:    handling_id 
## Timestamp:           time 
## Lifecycle transition:        registration_type

In this case, we see that the handling field is the activity identifier in the event log, while the patient field is used as case identifier. We can also obtain each of these identifiers individually.

patients %>% activity_id
patients %>% case_id
patients %>% resource_id
## [1] "handling"
## [1] "patient"
## [1] "employee"

Getting basic information

We can look at a general summary of the event log with summary().

patients %>% summary
## Number of events:  5442
## Number of cases:  500
## Number of traces:  7
## Number of distinct activities:  7
## Average trace length:  10.884
## 
## Start eventlog:  2017-01-02 11:41:53
## End eventlog:  2018-05-05 07:16:02
##                   handling      patient          employee  handling_id       
##  Blood test           : 474   Length:5442        r1:1000   Length:5442       
##  Check-out            : 984   Class :character   r2:1000   Class :character  
##  Discuss Results      : 990   Mode  :character   r3: 474   Mode  :character  
##  MRI SCAN             : 472                      r4: 472                     
##  Registration         :1000                      r5: 522                     
##  Triage and Assessment:1000                      r6: 990                     
##  X-Ray                : 522                      r7: 984                     
##  registration_type      time                            .order    
##  complete:2721     Min.   :2017-01-02 11:41:53.00   Min.   :   1  
##  start   :2721     1st Qu.:2017-05-06 17:15:18.00   1st Qu.:1361  
##                    Median :2017-09-08 04:16:50.00   Median :2722  
##                    Mean   :2017-09-02 20:52:34.40   Mean   :2722  
##                    3rd Qu.:2017-12-22 15:44:11.25   3rd Qu.:4082  
##                    Max.   :2018-05-05 07:16:02.00   Max.   :5442  
## 

The basic counts which show up in the summary can also be retrieved individual as a numeric vector of length one.

patients %>% n_activities
patients %>% n_activity_instances
patients %>% n_cases
patients %>% n_events
patients %>% n_traces
patients %>% n_resources
## [1] 7
## [1] 2721
## [1] 500
## [1] 5442
## [1] 7
## [1] 7

More detailed information about activities , cases, resources and traces can be obtained using the functions named accordingly, as in the examples below for the patients event log.

Activities

patients %>% activities()
## # A tibble: 7 × 3
##   handling              absolute_frequency relative_frequency
##   <fct>                              <int>              <dbl>
## 1 Registration                         500             0.184 
## 2 Triage and Assessment                500             0.184 
## 3 Discuss Results                      495             0.182 
## 4 Check-out                            492             0.181 
## 5 X-Ray                                261             0.0959
## 6 Blood test                           237             0.0871
## 7 MRI SCAN                             236             0.0867

Cases

patients %>% cases()
## # A tibble: 500 × 10
##    patient trace_length number_of_activities start_timestamp    
##    <chr>          <int>                <int> <dttm>             
##  1 1                  6                    6 2017-01-02 11:41:53
##  2 10                 5                    5 2017-01-06 05:58:54
##  3 100                5                    5 2017-04-11 16:34:31
##  4 101                5                    5 2017-04-16 06:38:58
##  5 102                5                    5 2017-04-16 06:38:58
##  6 103                6                    6 2017-04-19 20:22:01
##  7 104                6                    6 2017-04-19 20:22:01
##  8 105                6                    6 2017-04-21 02:19:09
##  9 106                6                    6 2017-04-21 02:19:09
## 10 107                5                    5 2017-04-22 18:32:16
## # ℹ 490 more rows
## # ℹ 6 more variables: complete_timestamp <dttm>, trace <chr>, trace_id <dbl>,
## #   duration <drtn>, first_activity <fct>, last_activity <fct>

Resources

patients %>% resources()
## # A tibble: 7 × 3
##   employee absolute_frequency relative_frequency
##   <fct>                 <int>              <dbl>
## 1 r1                      500             0.184 
## 2 r2                      500             0.184 
## 3 r6                      495             0.182 
## 4 r7                      492             0.181 
## 5 r5                      261             0.0959
## 6 r3                      237             0.0871
## 7 r4                      236             0.0867

Traces

patients %>% traces()
## # A tibble: 7 × 3
##   trace                                    absolute_frequency relative_frequency
##   <chr>                                                 <int>              <dbl>
## 1 Registration,Triage and Assessment,X-Ra…                258              0.516
## 2 Registration,Triage and Assessment,Bloo…                234              0.468
## 3 Registration,Triage and Assessment,Bloo…                  2              0.004
## 4 Registration,Triage and Assessment,X-Ray                  2              0.004
## 5 Registration,Triage and Assessment                        2              0.004
## 6 Registration,Triage and Assessment,X-Ra…                  1              0.002
## 7 Registration,Triage and Assessment,Bloo…                  1              0.002

Copyright © 2023 bupaR - Hasselt University