gertjanssenswillen / xesreadR

!! repository moved to https://github.com/bupaverse/xesreadR !! This repo is read-only from now one.
Other
1 stars 2 forks source link

write_xes error: Function only applicable for class eventlog #4

Closed jphillips-bp3 closed 5 years ago

jphillips-bp3 commented 5 years ago

Hi,

I am trying to write out an event log to an XES file, but get the error:

Function only applicable for class eventlog

My event log appears to be of the correct class as show below:

Classes ‘eventlog’, ‘tbl_df’, ‘tbl’ and 'data.frame':   40200 obs. of  15 variables:
 $ Reference            : chr  "181201-000148" "181201-000148" "181201-000148" "181201-000148" ...
 $ Timestamp            : POSIXct, format: "2018-12-01 12:03:00" "2018-12-01 12:03:00" ...
 $ Who                  : chr  "System" "Administrator" "Unknown" "Matthew McPherson" ...
 $ What                 : Factor w/ 8 levels "Assigned","Changed Queue",..: 4 2 5 5 2 5 3 5 4 2 ...
 $ Description          : chr  "From Techmail - Service Mailbox" "Undefined" "From Customised Process" "From Incident Editor" ...
 $ Case.Channel         : chr  "Email" "Email" "Email" "Email" ...
 $ Assigned.Account     : chr  "No Value" "No Value" "No Value" "No Value" ...
 $ HR.Team              : chr  "Onboarding" "Onboarding" "Onboarding" "Onboarding" ...
 $ Case.Category        : chr  "08. Onboarding" "08. Onboarding" "08. Onboarding" "08. Onboarding" ...
 $ Case.Category.Level.2: chr  "Disclosure & Safeguarding Policy" "Disclosure & Safeguarding Policy" "Disclosure & Safeguarding Policy" "Disclosure & Safeguarding Policy" ...
 $ Outcome              : chr  "Untransactionable" "Untransactionable" "Untransactionable" "Untransactionable" ...
 $ activity_instance_id : chr  "1" "2" "3" "4" ...
 $ resource_id          : Factor w/ 1 level "undefined": 1 1 1 1 1 1 1 1 1 1 ...
 $ lifecycle_id         : Factor w/ 1 level "undefined": 1 1 1 1 1 1 1 1 1 1 ...
 $ .order               : int  1 2 3 4 5 6 7 8 9 10 ...
 - attr(*, "case_id")= chr "Reference"
 - attr(*, "activity_id")= chr "What"
 - attr(*, "activity_instance_id")= chr "activity_instance_id"
 - attr(*, "lifecycle_id")= chr "lifecycle_id"
 - attr(*, "resource_id")= chr "resource_id"
 - attr(*, "timestamp")= chr "Timestamp"

The code itself is as follows:

eventLog = simple_eventlog(eventlog = csv,
                           case_id = "Reference",
                           activity_id = "What",
                           timestamp = "Timestamp")
str(eventLog)

write_xes(eventlog = eventlog, xesfile = "case_audit_log.xes")

Any ideas as to what I am doing wrong?

jphillips-bp3 commented 5 years ago

And if it helps this is my session info:

R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lubridate_1.7.4     processmonitR_0.1.0 xesreadR_0.2.3     
[4] processmapR_0.3.3   eventdataR_0.2.0    edeaR_0.8.2        
[7] bupaR_0.4.2        

loaded via a namespace (and not attached):
 [1] zoo_1.8-5          tidyselect_0.2.5   Rook_1.1-1         purrr_0.3.2       
 [5] ggthemes_4.2.0     lattice_0.20-38    colorspace_1.4-1   viridisLite_0.3.0 
 [9] miniUI_0.1.1.1     htmltools_0.3.6    plotly_4.9.0       XML_3.98-1.19     
[13] rlang_0.3.4        later_0.8.0        pillar_1.4.0       glue_1.3.1        
[17] RColorBrewer_1.1-2 plyr_1.8.4         stringr_1.4.0      munsell_0.5.0     
[21] gtable_0.3.0       visNetwork_2.0.6   htmlwidgets_1.3    forcats_0.4.0     
[25] httpuv_1.5.1       DiagrammeR_1.0.1   Rcpp_1.0.1         xtable_1.8-4      
[29] readr_1.3.1        promises_1.0.1     scales_1.0.0       jsonlite_1.6      
[33] rgexf_0.15.3       mime_0.6           gridExtra_2.3      brew_1.0-6        
[37] ggplot2_3.1.1      hms_0.4.2          digest_0.6.19      stringi_1.4.3     
[41] dplyr_0.8.1        shiny_1.3.2        grid_3.6.0         influenceR_0.1.0  
[45] tools_3.6.0        magrittr_1.5       lazyeval_0.2.2     tibble_2.1.1      
[49] crayon_1.3.4       tidyr_0.8.3        pkgconfig_2.0.2    xml2_1.2.0        
[53] data.table_1.12.2  downloader_0.4     httr_1.4.0         assertthat_0.2.1  
[57] rstudioapi_0.10    viridis_0.5.1      R6_2.4.0           igraph_1.2.4.1    
[61] shinyTime_0.2.1    compiler_3.6.0    
jphillips-bp3 commented 5 years ago

Found the problem, had a case error in my event log variable name I was passing in (eventlog instead of eventLog)!