## 4 Phases of the Proposed Approach
### Phase 1  
The first phase of our proposed system occurs within the Mist broker, where data categorization takes place using a fuzzy system (FS). This process aims to effectively handle patient data across various health conditions and determine the appropriate server resource from the Mist, Fog, and Cloud layers. The Edge layer focuses on three medical sensors, namely the body temperature (BT) sensor, glucose level (GL) sensor, and heart rate (HR) sensor, which record the patients' health data. These recorded data are initially transmitted to the Mist layer, specifically the Mist broker, where they undergo categorization using the FS. The Mist broker classifies the patients' health data into three priority levels: high priority (critical cases), medium priority (susceptible to disease), and low priority (healthy), based on the patients' health conditions.  
The FS can accomplish that by converting the actual data (crisp inputs) into linguistic values (fuzzy input set) using the fuzzification method to determine and estimate patients' health conditions based on fuzzy rules to generate fuzzy output sets. Then these outputs are defuzzified to convert linguistic values to crisp values and count them as the results of the FS. The results of this defuzzification could be of one of the three priorities: high  
Figure 2: Fuzzy logic system structure.  
priority, medium priority, and low priority. Table 1 represents how we estimate the health condition of patients.  
The membership function for inputs BT, HR, and GL is designed using the MATLAB Fuzzy Toolbox in Figures 3-5, respectively.  
In Phase 1, the number of rules in the fuzzy logic system depends on the number of sensors in the experiment and how many readings each sensor can sense, as follows.  
The number of rules = (number of readings BT) \(\times\) (Number of readings HR) \(\times\) (number of readings GL).  
Here, the number of rules = 3 \(\times\) 3 \(\times\)  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**BT (Body Temperature)** & **HR (Heart Rate)** & \
\begin{tabular}{c} **GL (Glucose** \\ **Level)** \\ \end{tabular} & **Health Score** &
\begin{tabular}{c} **Patient Health** \\ **Condition** \\ \end{tabular} & **Data Priority** \\ \hline Low & Slow & Less & Poor & Critical & High \\ \hline Low & Slow & Normal & Medium & Exposed to diseases & Medium \\ \hline Low & Slow & High & Poor & Critical & High \\ \hline Low & Average & Less & Medium & Exposed to diseases & Medium \\ \hline Low & Average & Normal & Good & Healthy & Low \\ \hline Low & Average & High & Medium & Exposed to diseases & Medium \\ \hline Low & Fast & Less & Poor & Critical & High \\ \hline Low & Fast & Normal & Medium & Exposed to diseases & Medium \\ \hline Low & Fast & High & Poor & Critical & High \\ \hline Normal & Slow & Less & Medium & Exposed to diseases & Medium \\ \hline Normal & Slow & Normal & Good & Healthy & Low \\ \hline Normal & Slow & High & Medium & Exposed to diseases & Medium \\ \hline Normal & Average & Less & Good & Healthy & Low \\ \hline Normal & Average & Normal & Good & Healthy & Low \\ \hline Normal & Average & High & Good & Healthy & Low \\ \hline Normal & Fast & Less & Medium & Exposed to diseases & Medium \\ \hline Normal & Fast & Normal & Good & Healthy & Low \\ \hline Normal & Fast & High & Medium & Exposed to diseases & Medium \\ \hline High & Slow & Less & Poor & Critical & High \\ \hline High & Slow & Normal & Medium & Exposed to diseases & Medium \\ \hline High & Slow & High & Poor & Critical & High \\ \hline High & Average & Less & Medium & Exposed to diseases & Medium \\ \hline High & Average & Normal & Good & Healthy & Low \\ \hline High & Average & High & Medium & Exposed to diseases & Medium \\ \hline High & Fast & Less & Poor & Critical & High \\ \hline High & Fast & Normal & Medium & Exposed to diseases & Medium \\ \hline High & Fast & High & Poor & Critical & High \\ \hline \hline \end{tabular}
\end{table}
Table 2: The fuzzy rules for data categorization.  
Figure 5: Membership function of GL.