# Rural Healthcare IoT Architecture Based on Low-Energy LoRa
## 4 System Architecture
### Fog Computing and E-Healthcare Gateway  
With the evolution of healthcare, Fog Computing is one of the possible solutions for the improvement of healthcare treatments in rural environments for the performance of all treatments remotely [30]. Fog computing is a paradigm that addresses connectivity constraints. Our architecture focuses on moving computation closer to the edge. All IoT devices have sensors and microcontrollers to conduct data processing and only transmit the minimal amount of data needed to reach the cloud. The primary constraint in the proposed fog topology is the limited bandwidth of the LoRa network. The gateway has bi-directional communication with the IoT devices and the communication hub for the area, typically a village. Communication with nearby devices located in the same house can be established with other protocols such as ZigBee [31], or Bluetooth 5, which can have up to 200 m range [32]. In the proposed architecture, the healthcare gateway collects raw medical signals from sensors, conducts data pre-processing, and feature extraction [33]. Depending on the type of data, the system could utilize different Machine Learning (ML) models to extract meaningful information from the raw data. When ML is used for decision-making, the gatewaydetermines actions based on the most recent ML model. Such decisions considering the identified user stories and include determining alarm activation for a missing person or abnormal changes in daily activities, environmental controls, and health monitoring. The main constraints for applying ML in the edge nodes are related to the limited computing and battery power. Therefore, the ML model training is conducted in the cloud, and the model is deployed on the e-healthcare gateway. The fog network is used to transmit up-to-date models from the cloud to the e-healthcare gateways [34]. When selecting the algorithm, considerations should be made that updates are done via low bandwidth links and that the data has a low sample rate due to energy constraints. In addition, the pre-trained ML models that would be used on the edge nodes should be as lightweight as possible, for example, by using data structures with lower precision and, consequently, lower memory footprint. The specific selection of the ML algorithm and implementation details would depend on the use case, the sensor types, and the data quantity. However, the proposed architecture would apply to any algorithm that could meet the said constraints. In Figure 3, we present the workflow for data transmission and data processing in the proposed architecture. The IoT nodes pass the data to the e-healthcare gateway, shown in the blue/left block, where the local model is run. If a significant event is detected, a communication channel is established with the communication hub, which can communicate to the cloud or care providers if the alert is triggered. Additionally, in cases of low confidence classification or when ambiguous classification occurs, the data is sent for further processing and labeling in the cloud. This means that all outliers and classifications made by the lightweight ML models on the edge nodes would eventually be validated by more performant ML models on the cloud side. On the communication hub, shown in green/middle block, the results are validated, and if a significant discrepancy is found, the hub will set a flag to download the latest cloud model and update edge ML models. All data received by the communication hub is stored and transmitted to the cloud either by network link, such as LEO satellite, or via offline data collection during the service period. The cloud, shown in red/right block, is responsible for generating the ML model and providing an interface for labeling data. In addition, the cloud gathers data from external sources such as medical databases and patient records. Therefore, all services offered to care providers are centralized in the cloud. Figure 3: Machine learning workflow using Fog based architecture.