# Semi-Automated Approach for Building Event Logs for Process Mining from Relational Database
## 4 Results
### Construction of the Event Log
#### 4.2.3 Event Log Generated  
The event log is built automatically by a software application developed for this purpose. The application implements the rules defined in the previous stage of the framework, displaying per participant the columns and tables linked to it (the application only requires read permissions on the database), as well as the attributes that were mapped to these columns. In addition, it allows you to add tables and columns available in the database to create new mappings between the columns and the attributes of the event log, following the different mappings of the previous task. The application user can confirm the predefined mappings and, where appropriate, the mappings added by the user. The queries required to extract the data and transfer these values to the corresponding attributes within the \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Field** & **Data Type** & **Event Log Attribute** & **Key** \\ \hline IdProcess & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \\ Id\_Iaqma & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \\ Status & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \\ \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \\ Date & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \\ Data & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Mapping between the columns associated with the IoT_AirQuality_Monitor_Access table and the event log attributes. event log are generated automatically (based on the SQL language) from the mappings accepted by the application user, according to the event log structure shown in Listing 1. The _IoT Air Quality Monitor_ participant event log is generated from obtaining all case identifiers from the _data_infosensors_ table \(IdCases\leftarrow unique(rows\in data\_infosensors\mid schema.columns(IdProcess)\). To build each trace \(T\), for each \(IdCases_{i}\) the following rules are applied. * For each \(IdCases_{i}\), in the IoT_AirQuality_Monitor_Access (IAQMA) and IoT_AirQuality_Monitor_Collector (IAQMC) tables, all the records \(R\) that meet the following criteria are selected:\(R=rows\in IAQMA\mid schema.columns(IAQMA)=IdProcess\) and rows:\((j,IdProcess)=IdCases_{i})\cup rows\in IAQMC\mid schema.columns(IAQMC)=IdProcess1\) and \(rows(j,IdProcess)=IdCases_{i})\). * Since \(R(j,ColumnName)\) is a record, where \(j\) indicates the position of the row and \(ColumnName\) indicates the column's name. Then, we can extract the value of record \(j\) from column \(ColumnName\). * The records in \(R\) represent the set of events \(E\) within the trace \(E\in T_{i}\), with \(IdCase=IdCases_{i}\). Then, each event \(e\in E\) is given the following attributes: \(et\gets IdCase=IdCases_{i}\), \(et\gets IdEvent=R(j,id\_Iqma)\), \(et\gets concept:name=R(j,Status)\), \(et\gets time:stamp=R(j,Date)\), \(et\gets resource\) = \"Web service A\", and \(et\gets dataIO=R(j,Data)\). A similar procedure is performed for the Repository Management Service participant using the Repository_Management_Service Table and for the System Access Service participant using the System_Access_Service table, mapping the values contained in _IdProcess2_ and _IdProcess3_ to the _IdCase_ attribute, respectively. It is essential to mention that the tables of these participants have the same fields in common, which allowed using the same data correlation shown in Table 1, modifying the event identifier. Listing 2 shows the elements generated for \(IdCase=\) \"62576 aab70c34\", and the events built from the execution data of the business process of the _Repository Management Service_ participant. This code has been generated under the XES standard and represents an extract from the event log of the _Repository Management Service_ participant. In the first <event> element, an event corresponding to \(IdEvent=\) \"11009\" is shown, which has the \"Insert Data Package\" activity executed on 13 April 2022 at 7:28:27 p.m. as part of the properties of this event.