## 3 Proposed Pipeline
### Process
For the data analysis and insight extraction, we tested two machine learning methods, KDE and hierarchical clustering. Nevertheless, the toolkit is preconfigured to be extended to a range of different machine learning methods. Figure 2C,D show the KDE pdf estimation for the 3D trajectories and 2D trajectories, respectively. These representations show the focal points that correspond to the more common positions of the users. Figure 2E shows an example of an agglomerative clustering dendrogram. Gaussian KDE generates an estimation of the probability density function (pdf). Given a sample \((X_{0},X_{1},\dots,X_{n})\), the pdf \(f\) estimation is obtained with the expression  
\[\hat{f}_{h(X)}=\frac{1}{nh}\sum_{i=0}^{n}K(\frac{X-X_{i}}{h}) \tag{1}\]  
where \(K(X)\) is a normal kernel, and \(h\) is the bandwidth. We used the Python Scipy (version 1.2.2, see [29] and [[https://github.com/scikit-learn/scikit-learn](https://github.com/scikit-learn/scikit-learn)]([https://github.com/scikit-learn/scikit-learn](https://github.com/scikit-learn/scikit-learn)), accessed on 23 April 2024, for details on the software development team and location) implementation of Gaussian KDE [44]. For hierarchical clustering, we considered agglomerative clustering [45; 46], in which the data entries start in a single item cluster, and the clusters are merged at each step in an iterative cycle. Each time two clusters are merged, a level in the hierarchy is added. Hierarchical clustering generates a dendrogram that is the graphical representation of a binary tree whose leaves are the initial single-entry clusters, and the successive nodes correspond to the cluster obtained by merging couples of clusters. Clusters are merged in order following a linkage clustering criterion. The linkage condition is determined by  
Figure 2: Processing and analysis step. (**A**) Screenshot of the raw data inspection web application developed with Voila and Jupyter. (**B**) Gating graph, showing the generated scatter plot and the marginal histograms, with the threshold values used to gate the outliers. (**C,D**) The 3D and 2D density functions, respectively, estimated with KDE. (**E**) Dendrogram produced with an agglomeration clustering model. selecting the smallest distance measure among the current cluster, merging the clusters and updating the cluster list after the merge. For instance, a common distance measure among entries is the Cartesian distance. Given the distance measure, we can define a clustering linkage criterion, or within-cluster distance (WCD), which may be, for example, the _complete_ criterion  
\[d(U,V)=\max_{u\in U,v\in V}d(u,v) \tag{2}\]  
where \(U\) and \(V\) are two clusters and \(u\) and \(v\) are two data entries from each cluster, respectively [34]. Thus, the clusters are merged in order according to a greedy algorithm, starting from the clusters with lower linkage values. In particular, we used the Python Scikit-learn implementation of agglomerative clustering [29]. We set the file system to take into account the asynchronicity of the service requests. For this reason, we set a 'raw/' folder that could be written only by the capture service (see previous section); in this way, the capture block service can write only in this folder, while the process block can only read from this folder. This guarantees that the raw data are not changed by the processing block. Then, the processed data are saved in a separate folder called 'proc/'. Sufixes are used to indicate different versions and intermediate steps of the processed data (see Figure 3). In order to allow collaboration among different analysts, we have to keep track of the different versions that branch out, as different analysts implement different decisions. Tracking the different processed data versions, the analysts can collaborate and set up evaluation metrics that allow a comparison among different branches (see Figure 3).