In PM4Py, we provide support for various Social Network Analysis (SNA) metrics, as well as tools for the discovery of roles.
The Handover of Work metric measures how often one individual is followed by another individual in the execution of a business process. To calculate this metric, you can use the following code:
You can then visualize the result using NetworkX or Pyvis:
The Subcontracting metric calculates how often the work of one individual is interleaved with the work of another individual, only for it to eventually "return" to the original individual. To measure the subcontracting metric, you can use the following code:
Afterward, you can visualize the results using NetworkX or Pyvis:
The Working Together metric calculates how often two individuals collaborate to resolve a process instance. To measure the Working Together metric, you can use the following code:
You can then visualize the results using NetworkX or Pyvis:
The Similar Activities metric calculates how similar the work patterns are between two individuals. To measure the Similar Activities metric, you can use the following code:
You can then visualize the results using NetworkX or Pyvis:
A role is defined as a set of activities in the log that are executed by a similar (multi)set of resources. Essentially, it represents a specific function within an organization. Grouping activities into roles can help:
Initially, each activity is considered a separate role, and it is associated with the multiset of its originators. Roles are then merged according to their similarity until no further merges are possible. To begin, you need to import a log:
Next, apply the role detection algorithm:
You can print the sets of activities grouped into roles by using the following code:
print([x[0] for x in roles])
After applying an SNA metric, clustering allows you to group resources connected by meaningful relationships within the given metric. For example:
We provide a method to generate a list of groups (where each group consists of a list of resources) from the results of an SNA metric. This can be applied as follows to the running-example log and the results of the "Similar Activities" metric:
Resource profiling in event logs is also possible. We implement the approach described in: Pika, Anastasiia, et al. "Mining resource profiles from event logs." ACM Transactions on Management Information Systems (TMIS) 8.1 (2017): 1-30. Essentially, the behavior of a resource can be measured over a period of time with various metrics described in the paper:
The following example calculates these metrics starting from the running-example XES event log:
With event logs, we can identify groups of resources performing similar activities. As we have seen in previous sections, there are different ways to automatically detect these groups:
Alternatively, an attribute might be present in the events, specifying the group that performed the task.
"Organizational mining" refers to the discovery of behavior-related information specific to an organizational group, such as identifying which activities are performed by the group.
We provide an implementation of the approach described in: Yang, Jing, et al. "OrgMining 2.0: A Novel Framework for Organizational Model Mining from Event Logs." arXiv preprint arXiv:2011.12445 (2020).
The approach provides descriptions of group-related metrics (local diagnostics), such as:
The following example calculates these metrics using the receipt XES event log and shows how the information can be used, leveraging an attribute that specifies which group is performing the task:
Alternatively, you can use the apply_from_clustering_or_roles
method, which takes the log as the first argument and the results of the clustering as the second argument.