# A Smart Framework for Managing Natural Disasters Based on the IoT and ML
## 3 Methodology
### Proposed Framework  
It is an integrated and effective framework for early warning of disasters related to weather factors, especially floods resulting from rain or problems resulting from strong winds.  
Figure 2 shows the general view of the proposed framework, including the main layers and objects. It shows the main four layers, which are the sensing layer, fog layer, cloud layer, and applications layer. In addition, Figure 2 includes icons that simulate objects of each layer. The first layer has many types of sensors, such as temperature, rainfall level, wind speed, etc. Moreover, the smart vehicle can be used as mobile sensors, and drones can be utilized also to collect information for locations that are difficult to use fixed sensors there. While Figure 3 depicts the detailed view and the functions of each layer. Weather disasters such as floods are related to many factors not limited to the amount of rain only. For example, the different topologies of area (low or high) have different degrees of threat, wind speed, humidity level, and temperature degree).  
Figure 2: Proposed framework—general view.  
Therefore, several types of sensors were used in our perception layer (First Layer). A large number of sensors were deployed to cover the whole city. Sensors have limited resources, so the second layer in the proposed framework was fog computing. Sensors and IoT objects send their captured values to the fog periodically (e.g., every 6 s). Fog manages the flow of data on behalf of the cloud especially the fog node manages a small area. Thus, fog nodes will collect data from the sensing layer and apply some important functions which are:  
* Caching data;
* Detecting abnormal data or sensor;
* Calculating the average of captured data from many sensors to enhance reliability and reduce the number of connections to the cloud;
* Normalizing values and creating inputs of ML model;
* Appling the ML model to classify the inputs data;
* Sending notifications in real time if there is any threat;
* Sending feedback and forwarding summarized data to the cloud every few minutes.  
The third layer is the cloud. This layer receives data from the fog and stores it permanently. After a period, important historical data is created. Thus, the cloud applies the proposed ML algorithm to the historical data to form a smart classifier, in addition to important knowledge about the weather in each area.  
Figure 3: Proposed framework—functional view.  
Finally, the fourth layer is the applications one. In this layer, we proposed eight services and applications. However, it is available to add more services to any service provider. The eight applications are:  
* Alerts application, which sends an immediate alert to citizens of a specific area in case of danger;
* News application, which sends the update of trusted information about the weather conditions or the status of the regions in the city;
* Routing application, which helps drivers to choose the best and safest route during the bad weather;
* Navigation application helps the civil defense to reach the affected or threatened places quickly;
* First aid application, which is useful for volunteers to know the procedures that must be in emergency cases and circumstances to help others and the civil defense groups;
* Crowdsourcing application allows people to evaluate the current situation and thus improve the accuracy of estimation cases in addition to results of the proposed algorithm;
* Health application, which enables users in bad situations to request ambulance or request online medical consultations if the movement is danger and forbidden;
* Monitoring application is useful to monitor the level of citizens' commitment to government instructions, especially in the cases of a high threat indicator.