# Smartwatch-Based Monitoring and Alert System for Factory Operators Using Public Cloud Services
## 3 Materials and Methods
### The Implementation of the Proposed Solution
#### 3.2.2 Creating Tables in AWS DynamoDB
\begin{table}
\begin{tabular}{p{142.3 pt} p{142.3 pt}} \hline \hline
**Table** & **Description** \\ \hline _EmployeesInfo_ & This table contains the following information about employees: employee ID (employed: N), email address (email: S), full name (name: S), department (department: S), and role (role: S). The table has the number-type attribute employed set as the partition key, but also has a GSI (email-index), where the partition key is represented by the email address, which allows queries on the table based on the employee’s email \\ \hline _EmployeesSupervisors_ & This table defines the employee-supervisor relationship, so the partition key is given by the employee ID (employed: N), and the sort key is defined by the employee ID of the supervisor (supervisorId: N). The table also has a GSI called supervisorid-index where the partition key is given by the supervisorId attribute. \\ \hline _EmployeesTasks_ & This table contains information about the tasks that employees have to perform. Thus, the table attributes are as follows: the partition key by employee ID (employed: N), the sort key by task ID (taskId: S), the task description (description: S), the due date (ducDate: S), the status (status: S), and its urgency (urgent: B), as well as a variable attribute that contains the time when the record will be automatically deleted (expiresAt: N). To avoid keeping unnecessary data in the task table, we activated the Time To Live (TTI) option for the expiresAt attribute, so that it retains the expiration timestamp of the record which will be deleted by an automatic process provided by the AWS DynamoDB service. This attribute is added to a current record only when the task status becomes “Done” and is subsequently removed if the status changes to “Not Done” until the expiration period. \\ \hline _EmployeesTintCheet_ & The table is used to record and track employee working hours, storing information about the actual duration of each employee’s working hours per day. The table contains the following constant attributes: the partition key by employee ID (employed: N), the sort key by the date of the workday (shiftDate: S), the start time of the shift (startTime: S), the employee status (status: S), and if the status changes to “Completed” to suggest the end of the shift, the following attributes are added: the end time of the shift (endTime: S) and the total number of hours worked (totalHours: N). There is also a GSI (shiftDate-index) to allow for quick queries based on the workday set as the partition key (shiftDate). \\ \hline _EmployeeTokens_ & This table stores the Firebase tokens of employee devices, specifically smartwatches. Thus, it uses the token value (token: S) as the partition key, and as an additional attribute, the employee ID connected to the respective device can be added (employed: N). We have also established an employed-index GSI for querying based on the employee ID. \\ \hline _WebSocketConnections_ & This table is responsible for keeping the connection IDs to the WebSocket used in the system for communication between applications. They contain the partition key, the connection ID (connectionId: S) and, optionally, the attribute that shows the employee ID associated with the connection (employed: N). Similarly to the previous table, we have also established an employed-index GSI for querying based on the employee ID. \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The created and used tables.