# Semi-Automated Approach for Building Event Logs for Process Mining from Relational Database
## 4 Results
### Construction of the Event Log
#### 4.2.2 Attribute Extraction  
**Case correlation. **: According to the analysis of the entity-relationship diagram and the values contained in the columns of the database tables, the following columns were selected to generate the _IdCase_ for each participant. The _data_infosensors_ table (see Figure 2) has the foreign-key _IdProcess_ specified, which links to the referenced tables _IoT_AirQuality_Monitor_Access_ and _IoT_AirQuality_Monitor_Collector_. Furthermore, the _data_infosensors_ reference table is related to the _System_Access_Service_ reference table via the _IdProcess2_ foreign key. Moreover, the referenced table _Repository_Management_Service_ contains is associated with the _data_infosensors_ table through the foreign key _IdProcess3_. The value contained in each record of these foreign keys can be transferred to the _IdCase_ attribute of the event log, allowing the creation of traces of the different business process instances for each of the three participants identified in the previous stage. The _IdCase_ for the participant _IoT Air Quality Monitor_ can be defined as _IdCase_\(\in row(data\_infosensors)\mid TbNCase=IdProcess\). For the _Repository Management Service_ participant its _IdCase_ is specified as _IdCase_\(\in row(data\_infosensors)\mid TbNCase=IdProcess3\), and for the participant _System Access Service_ its _IdCase_ is defined as _IdCase_\(\in row(data\_infosensors)\mid TbNCase=IdProcess2\). **Event correlation. **: In the database, it was identified that there is a table associated with each of the business process participants. The primary key of each table can be used as a unique event identifier (_IdEvent_), allowing access to all database records related to the participant. Furthermore, linking the activities executed by the participant through the relationship inside the table through the primary key and the relationship with other tables through foreign keys. The above will allow maintaining an alignment between the events that correspond to a case since an event can only be linked to one case. For example, in the table _IoT_AirQuality_Monitor_Access_ there is the primary key _Id_Iaqma_. Then, the event mapping can be defined as (_IdEvent_\(\in rows\in TableName\mid schema\_columns(TableName)=type(PK)\)). Activity correlationThe selection of the activity name and its mapping to the _concept:name_ attribute of the event log is derived from the event constructor proposal presented in [14]. In this way, a column \(X\) is selected from a table \(Y\) (\(X\subset schema.columns(Y)\)), and its unique values are assigned as activity name (\(concept:name\gets rows\in Y\mid schema.columns(Y)=X\)). In the database, there is a _Status_ column in each table linked to a participant that stores the task executed within the flow of the participant's business process. Unique values are extracted from these columns using the following rule (\(concept:name\gets unique(rows\in TableName\mid schema.columns(TableName)=\"Status\")\)). **Time: Stamp correlation. **: A timestamp is stored in various database columns when a transaction is performed. In this case, the column that has a relationship with the _IdEvent_ and the executed activity was chosen, since this timestamp determines the time in which an event occurred. These columns named _Date_ (timestamp datatype) were mapped to the _timestamp_ attribute in the event log, following the rule (\(time:stamp\gets rows\in TableName\mid schema.columns(TableName)=Date \ and\ type(Date)=timestamp\)). **Resource correlation. **: The air quality information system was developed using an IoT paradigm, whereby the system operates independently with the ability to transfer data over the network without requiring human-to-human or human-to-computer interaction. Therefore, the resources that execute the business process tasks are web services, embedded systems in the monitoring stations, or the message delivery system contained in the communication protocol (invoked by a web service or by an embedded system).