# Design and Validation of Rule-Based Expert System by Using Kinect V2 for Real-Time Athlete Support
## Materials and Methods
### Rule-Based Expert System Design  
The Expert System is a decision support software created by copying one or more individual judgement capabilities and decision-making processes encountered in specific areas [71]. The information and logical inference mechanism used by this program is modeled according to the information and logical inference mechanism of the person or persons who are experts in the field [72]. In addition, the decision structures that will be used in the modeling process must have unquestionably accuracy. Thus, users can be guided by Expert System in accordance with their needs and wishes. One of the most important parts of expert systems, the information database, is created and updated as decision rules according to the knowledge of the person or persons who are experts in the field [73]. By creating these rules, an \"If-Then\" structure is used. These structures are expressed as follows:  
_If (one or more condition = True) then (outcome/result)_  
Multiple conditions can be used when creating this structure. These conditions are linked using the terms \"And\" and \"Or\" depending on the situation. As an example, if two conditions are checked, both conditions are verified using the expression \"And\". However, if only one of the two conditions is sufficient, the expression used is \"Or\". An example algorithm of a sports area can be expressed as follows (Algorithm 1). \begin{table}
\begin{tabular}{c c} \hline \hline
**Warning No.** & **Warnings** \\ \hline
1 & _Please stand upright_ \\
2 & _Feet should be slightly narrower than the shoulder_ \\
3 & _The angle of the arm with the elbow is small_ \\
4 & _The elbows should not be below the shoulder line, please choose lighter weights_ \\
5 & _The wrist should not be below the elbow line_ \\
6 & _The elbows should be positioned at right angles_ \\
7 & _The elbows and shoulders are not aligned, please push up the weights or choose lighter weights_ \\
8 & _Raise your elbows_ \\
9 & _Good Posture_ \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Simultaneous Warnings Given to User. ```
Input: Joint Angles J = (Elbow angle1, Elbow angle2, Shoulder angle1, Shoulder angle2, Spine angle) Output: Accuracy of Movement  If (Elbow Angle Difference \(\leq\) 10\({}^{\circ}\)) and (Shoulder Angle Difference \(\leq\) 15\({}^{\circ}\)) and (Spine Angle \(\geq\) 170\({}^{\circ}\))  Then \(\text{Else ``Correct Movement''}\) \(\text{``Wrong Movement''}\) End If
```  
**Algorithm 1**Example algorithm of a sports area  
The combined movement models developed for this purpose are shown in Table 3 with an accuracy table consisting of 8 rules (R1-R8) and 256 conditions according to the change in the angle of movement for use in Expert System in the study. In this table, Y is defined as output values, \"1\" as correct LR movement, \"2\" as correct DSP movements, and \"0\" as incorrect movements. This process has been realized by determining the other rules that can be used jointly according to the execution of the movement and combining the main rules of the movement. In Table 3, to create a rule base that can be used for both movements, the cases where the rule is provided are marked with \"1\", the cases where the relevant rule is not provided are marked with \"0\", and the cases where the relevant rule is unimportant according to the action made are marked with \"X\". In order to provide movement correction information depending on the movement flow, the warnings given in Table 2 according to the correct movement and the incorrect movements that can be corrected are assigned as output states. Hence, a table of accuracy that can work according to the flow of movement is obtained and presented in Table 4.  
Shown in Table 5 are the two example rules together with the warnings (Y), exit states, and rule states (Q1-Q8) given by the system through determining the 12 main rules that can be used for both training in this table.