# Data-Driven Knowledge-Based System for Self-Measuring Activities of Daily Living in IoT-Based Test
## 3 Design Consideration of EAT
### Architecture for Data-Driven Knowledge-Based Inference  
The knowledge-based inference of the EAT is driven by the data that the IoT terminal devices produce. The mechanism of the data-driven knowledge-based inference is shown in Figure 4.  
The IoT devices produce data that describe the participant's behavior. All of the produced data imply the ADL information of the participant. They deliver the data to the EAT through the sensor gateways. The inference module of the EAT changes the data to a fact with a time stamp, under real-time constraints. If the data processing violates the real-time constraints, the inference module may understand the faulty context of the participant status and provide a wrong e-coaching action. The facts are stored in the real-time fact base. The rule base of the inference module has rules that decide the e-coaching actions. Experts in the ADL e-coaching domain define the rules. Rules whose antecedents match the specific facts are fired. The fired rules assert new facts and provide the e-coaching actions. The participant operates the IoT devices to perform the given e-coaching actions. The operations also produce data that imply the ADL information. The data are changed to a fact circularly. Figure 4: Mechanism of data-driven knowledge-based inference in real time. Figure 3: State machine of the e-coaching plan. The core of the EAT is the data-driven knowledge-based inference module. The supervisor device has the inference module inside. The software architecture of the supervisor is shown in Figure 5. The supervisor consists of modules, such as the e-coaching inference, external service, and CLIPS java native interface. The e-coaching inference module deduces the e-coaching actions by using the IoT data and the inference engine of CLIPS. The rule base defines the inference rules. CLIPS activates the rules that match the IoT facts. The fact base stores the facts related to the IoT data. The terminal-device instance stores the last status of the terminal devices. The target-user instance contains the current status of the participant. The timer invocation requires the timer service of the external service to generate an event of time expiration. The TTS invocation calls for the TTS service of the external service to turn text into lifelike speech. The fact injector external service injects facts into the fact base. The external service provides the e-coaching inference module with the timer and the TTS service. The sensor gateway manager contains the space information of the sensor gateway. This space information is used for the TTS service to send the synthesized speech to a specific sensor gateway that takes charge of the speech play. The inference instantiation initializes and starts the e-coaching inference. An ADL report is produced by the report generator. The personal health database stores the ADL reports. The inference update manager alters the rules of the rule base when the e-coaching application domain is changed. The CLIPS java native inference module is in charge of the message communication between the e-coaching inference and the external service. The submodules of the rule base shown in Figure 5 are described in terms of their relationship with rule activation, as shown in Figure 6. When the participant executes the e-coaching action, the fact injector infuses the facts of the IoT terminal data into the fact base in real time. The monitor module in the e-coaching inference updates the last status of the terminal device and the target user instance by using the instance update rules that match the facts in the fact base. The target user is the participant. Figure 5: Software architecture of the supervisor. The evaluation rules examine whether the expected fact is observed within a predefined time period on the current state of the e-coaching plan state machine. The expected fact is retrieved from the strategy. The observed fact refers to the terminal device and the target user instance.