Repository navigation
Animation slider time mismatch in animate_process #28
Description
Activity
To expand here's the animate_process settings I have listed below. the timestamp is listed a datetime column.
my_flags <- data.frame(value = c(0,1,2,3,4,5)) %>% mutate(day = days(value)) processEventLog <- workflow.DF %>% eventlog( case_id = "sample", activity_id = "activity", activity_instance_id = "activity_instance", lifecycle_id = "status", timestamp = "timestamp", resource_id = "resource" ) my_timeflags <- processEventLog %>% cases %>% crossing(my_flags) %>% ##similar to a SQL outer join mutate(time = start_timestamp + day) %>% filter(time <= complete_timestamp) %>% select("case" = sample,time,value) ##must be case, time, value processEventLog %>% animate_process( mode ="absolute", type_nodes = frequency(value = "absolute_case"), type_edges = performance(FUN = mean, units = "hours"), jitter=20, legend = "color", initial_state = 'paused', duration = 100, mapping = token_aes( color = token_scale(my_timeflags, scale = "ordinal", domain = my_flags$value, range = rev(RColorBrewer::brewer.pal(6,"Spectral")) )))I am not entirely sure what you mean. I just checked the rendering of the timeline slider and that should be exact (in local timezone).
Are you displaying the current time on the token? If you could share (or send me) a little excerpt of the data then that would be really helpful to debug.
However, what I can think of is that there is a little hack in the way the token timings are generated to prevent tokens from moving to quickly. The parameter
epsilon_timespecifies how much "minimum time" each token movement takes. This brings in a small error between the time in which the token moves and the actual time. The default isduration / 1000to make this adapt to shorter durations in which the effect may be more severe. But I realise that if you have an event log spanning a long time then already a small addedepsiloncan make several hours difference.Try to call the animate_process method with
epsilon_time = 0as parameter.I think I've discovered the issue. It appears that the animate_process slider wants to display the timezone to UTC even though earlier in the program I've set my timezone to "America/Chicago"
ie. (Sys.setenv(TZ = "America/Chicago")). All the timepoints are listed in my table as the desired timezone but they're converted to UTC time in the plot. I'm not sure how to coerce them into displaying the desired timezone.Here's some example of data I'm using
workflow.DF <- tibble( Accession = c("461","484","494","502","559","461","484","494","502","559","461","484","494","502","559","461","484","494","502","559","461","484","494","502","559"), activity = c("Accessioned","Accessioned","Accessioned","Accessioned","Accessioned","Manifest Created","Manifest Created","Manifest Created","Manifest Created","Manifest Created", "Procedure","Procedure","Procedure","Procedure","Procedure","Report generated","Report generated","Report generated","Report generated", "Report generated","Results","Results","Results","Results","Results"), timestamp = c("2020-04-20T16:00:57Z","2020-04-20T16:03:43Z","2020-04-20T16:04:37Z","2020-04-20T16:05:04Z","2020-04-20T16:09:57Z","2020-04-20T16:26:18Z","2020-04-20T16:26:17Z", "2020-04-20T16:26:18Z","2020-04-20T16:26:18Z","2020-04-20T16:26:17Z","2020-04-20T00:00:00Z","2020-04-19T00:00:00Z","2020-04-20T00:00:00Z","2020-04-20T00:00:00Z", "2020-04-19T00:00:00Z","2020-04-20T21:13:31Z","2020-04-20T21:13:32Z","2020-04-20T21:13:21Z","2020-04-20T21:13:41Z","2020-04-20T21:13:30Z","2020-04-20T21:08:00Z", "2020-04-20T21:08:00Z","2020-04-20T21:08:00Z","2020-04-20T21:08:00Z","2020-04-20T21:09:00Z"), status = c("complete","complete","complete","complete","complete","complete","complete","complete","complete","complete","complete", "complete","complete","complete","complete","complete","complete","complete","complete","complete","complete","complete","complete","complete","complete"), activity_instance=c("27733","27734","27735","27736","27740","41929","41930","41931","41932","41936","13537","13538","13539","13540","13544","70078","70079","70080","70081","70085","56106","56107","56108","56109","56113"), resource = c("","","","","","","","","","","","","","","","","","","","","","","","",""), .order=c("27733","27734","27735","27736","27740","41929","41930","41931","41932","41936","13537","13538","13539","13540","13544","70078","70079","70080","70081","70085","56106","56107","56108","56109","56113") )Reacted by FelixOn my computer in UTC+1 it also shows UTC. I think it has something to do with the Javascript library I use. Will check if it is possible to show it in the local timezone of the Browser (not R since that may be running on a server).
I've noticed that when trying to animate the process map of items with lubridate formatted timestamps (ie. 2020-04-14T08:43:00Z), that there's a discrepancy with the time displayed on the animation time slider ~4-5 hrs earlier (2020-04-14T04:10:00Z). I didn't know if this was an artificial manipulation as a result of the slider wanting and initial timepoint to lock in on (since the default is 0) or if this was a bug issue. It does appear that the durations are the same though.