# Process Automation in an IoT-Fog-Cloud Ecosystem: A Survey and Taxonomy
## 5 Fog Intelligence and Automation
### Automatic Context Management
[47] showed that the relationship between a store and a shopper could be analyzed to provide two services: recommended items for customers and Customers' shopping patterns for retailers. [PERSON] and [PERSON] [42] shows another example of medical context-aware systems, which assist nurses in visiting patients in their rooms at the right time. The context-aware system here complicates by increasing the number of patients and their medical services. Table 8 shows the context, service, and context-aware system of the reviewed papers. The context of time is used in routing and meeting scheduling systems. The context of the user's identity is used for I-centric systems and healthcare applications. It is evident that the location is used for all the context-aware systems and is the most critical context. In any automating system, the location, time, and user's identity are significant contexts and should be considered in the design and implementation of a context-aware system. In the ecosystem, IoT sensors generate data continuously, and each piece of data can be considered as an event. While receiving more events, the processing will be complex and is called Complex Event Processing (CEP). The CEP is the main component of the context-aware system and is responsible for processing events, providing the proper relationship among them, firing rules, and delivering services. The rules, events, actions, and services defined for a particular IoT application are called knowledge. By receiving an event, the related if-then rule triggers the output service. [PERSON] and [PERSON] [72] described that providing such connectivity among events, rules, and services can be extremely challenging. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**Context** & **Service** & **System** & **Paper** \\ \hline Location & Direction & Tour-Guiding system & [PERSON] et al. [71] \\ Location \& Identity & Care & Healthcare system & [PERSON] and [PERSON] [42] \\ Location \& Time & Route & Route Systems & [PERSON] et al. [44] \\ Location \& Identity \& Time & Housing functions & I-Centric system & [PERSON] et al. [45] \\ Location & Directions & Guidance system & [PERSON] et al. [71] \\ Location \& Identity \& Time & Meeting Management & Meetup System & [PERSON] et al. [70] \\ Location & Direction & Shopping Assistant & [PERSON] et al. [47] \\ \hline \hline \end{tabular}
\end{table} 
Table 8: The context-aware systems and their used context and provided services. [PERSON] et al. [73] describes that CEP is the combination of several simple events that reflect the state of a particular environment. The paper denotes the responsibility of CEP to deal with two types of events: events happening inside the ecosystem and external events introduced by IoT sensors into the ecosystem. The role of CEP is to determine how to deal with these two types of events.Bruns et al. [73] demonstrates the CEP in its three components: event model, which records all events for a specific domain, set of rules implemented by an expert known as event rules, and CEP engine, which is responsible for processing events. [PERSON] et al. [74] define the knowledge of the system as the unity of the mentioned three components. The architecture of CEP components is Event-Driven Architecture (EDA). In this architecture, an event processing agent (EPA) is an individual CEP entity that has its rule engine and rule base. The network containing all the EPA is called an Event Processing Network (EPN). [PERSON] et al. [14] describes how CEP could process mobile and cell phones' data streams in a collaborative deployment of telecommunication and IT networking. [PERSON] et al. [41] discusses the CEP concept in a healthcare domain, where patients having breathing problems have resided in two hospitals. [PERSON] et al. [40] has also used the CEP to provide real-time services for patients having heart attacks. Figure 8 illustrates an example of a healthcare ecosystem. We assume two IoT requests with their SLAs coming to the ecosystem.