processmining-bupaR icon indicating copy to clipboard operation
processmining-bupaR copied to clipboard

Error

Open adamkk opened this issue 2 years ago • 1 comments

Dear Scheithauer,

pls update your R code. I see three errors:

1.The variable data$Start Timestamp does not exist. Only data$Start_Timestamp is present within data. Same with Complete Timestamp, which must be updated to Complete_Timestamp : data$starttimestamp = as.POSIXct(data$Start_Timestamp,format = "%Y/%m/%d %H:%M:%S")

data$endtimestamp = as.POSIXct(data$Complete_Timestamp,

  1. Lifecycles endtimestamp are not allowed in:

events <- bupaR::activities_to_eventlog(

  • head(data, n = 10000),
  • case_id = 'Case_ID',
  • activity_id = 'Activity',
  • resource_id = 'Resource',
  • timestamps = c('starttimestamp', 'endtimestamp'))

Error in activitylog.data.frame(activity_log, case_id = case_id, activity_id = activity_id, : Lifecycles endtimestamp are not allowed. Allowed lifecycles: schedule, assign, reassign, start, suspend, resume, abort_activity, abort_case, complete, manualskip, autoskip

  1. Same with: events <- bupaR::activities_to_eventlog( data, case_id = 'Case_ID', activity_id = 'Activity', resource_id = 'Resource', timestamps = c('starttimestamp', 'endtimestamp') )

Error in activitylog.data.frame(activity_log, case_id = case_id, activity_id = activity_id, : Lifecycles endtimestamp are not allowed. Allowed lifecycles: schedule, assign, reassign, start, suspend, resume, abort_activity, abort_case, complete, manualskip, autoskip

Please update the code. Now even after clearing problems in point no. 1, the code stops at point 2 and 3.

adamkk avatar Dec 30 '22 14:12 adamkk

Hi @adamkk, I am not the original author, but I found a way to bypass the error through some trial and error and checking the documentation. I will share what I found.

First, to make this happen, you will need to change the variable names in issue 1 into 'start' and 'complete' respectively. This solves the following error that you get in issues 2 and 3:

Error in activitylog.data.frame(activity_log, case_id = case_id, activity_id = activity_id, : Lifecycles endtimestamp are not allowed. Allowed lifecycles: schedule, assign, reassign, start, suspend, resume, abort_activity, abort_case, complete, manualskip, autoskip

data$start <- as.POSIXct(data$`Start_Timestamp`,
                        format = "%Y/%m/%d %H:%M:%S")

data$complete <- as.POSIXct(data$`Complete_Timestamp`,
                           format = "%Y/%m/%d %H:%M:%S")

From there you can just change the variable names in issues 2 and 3 for timestamps to the variables you just created. However, it seems that the function in the original script has become depreciated and has a new version in the documentation. You can create an event log by using the following code as well, per the updated documentation.

activities <- bupaR::activitylog(
  data,
  case_id = 'Case_ID',
  activity_id = 'Activity',
  resource_id = 'Resource',
  timestamps = c('start', 'complete'),
  order = 'auto'
)

events <- bupaR::to_eventlog(activities)

This new code will also give you the results the original author intended.

dsgrammer avatar Apr 26 '23 08:04 dsgrammer