Incremental calculation of Cycle and Lead Time
Important: unstable feature available only in the ‘develop’ branch
Two important KPI for a process executions are:
- The Lead Time: the overall time in which the instance was worked, from the start to the end, without considering if it was actively worked or not.
- The Cycle Time: the overall time in which the instance was worked, from the start to the end, considering only the times where it was actively worked.
For these concepts, it is important to consider only business hours (so, excluding nights and weekends). Indeed, in that period the machinery and the workforce is at home, so could not proceed in working the instance, so the time “wasted” there is not recoverable.
Within ‘interval’ event logs (that have a start and an end timestamp), it is possible to calculate incrementally the lead time and the cycle time (event per event). The lead time and the cycle time that are reported on the last event of the case are the ones related to the process execution. With this, it is easy to understand which activities of the process have caused a bottleneck (e.g. the lead time increases significantly more than the cycle time).
The algorithm implemented in PM4Py start sorting each case by the start timestamp (so, activities started earlier are reported earlier in the log), and is able to calculate the lead and cycle time in all the situations, also the complex ones reported in the following picture:
In the following, we aim to insert the following attributes to events inside a log:
- @@approx_bh_partial_cycle_time => incremental cycle time associated to the event (the cycle time of the last event is the cycle time of the instance)
- @@approx_bh_partial_lead_time => incremental lead time associated to the event
- @@approx_bh_overall_wasted_time => difference between the partial lead time and the partial cycle time values
- @@approx_bh_this_wasted_time => wasted time ONLY with regards to the activity described by the ‘interval’ event
- @@approx_bh_ratio_cycle_lead_time => measures the incremental Flow Rate (between 0 and 1).
The method that calculates the lead and the cycle time could accept the following optional parameters:
- worktiming: the work timing (e.g. [7, 17])
- weekends: the specification of the weekends (e.g. [6, 7])
And could be applied with the following line of code:
from pm4py.objects.log.util import interval_lifecycle enriched_log = interval_lifecycle.assign_lead_cycle_time(log)
With this, an enriched log that contains for each event the corresponding attributes for lead/cycle time is obtained.