# Monitoring Acute Heart Failure Patients Using Internet-of-Things-Based Smart Monitoring System
## 4 Materials and Methods  
### Smart Healthcare Framework  
An IoT-based healthcare platform for people with heart failure is presented in this section. The proposed framework is based on cloud services, AI and IoT. Figure 2 shows the suggested system's design for smart healthcare. With the help of IoT devices, this framework makes it easier for medical personnel to keep track of their patients' health. IoT and cloud-based technologies allow medical professionals to access the medical records of heart failure patients at any time and from any location. The complete flow of the proposed architecture is shown in Algorithm 1.  
In this IoT-based smart healthcare system, the security factor is added using Zigbee and Firebase IoT authentication. When medical officers send patients' data to cloud storage, 128 bits of security encryption are added to the JSON file as a token. The Firebase cloud function validates the officer's device token by generating a custom token with the officer's correct credentials details and custom token claims. The device-generated 128 bits token and Firebase custom token is considered proof of identity for all real-time exchange of data between the two users. After authentication, the authorization process is performed using Firebase's general Security rules. This three-step-based security mechanism of Firebase can be summarized as follows.  
* The device token proves that the request came from an authorized device, but it has no useful information. Firebase servers would not be able to easily determine who is the owner of a device token.
* A custom token contains the user identity but lacks their profile information. In addition, this token cannot be implicitly trusted by Firebase servers, since the service account used by our Cloud Function is not guaranteed to be authorized. For example, we might decide to revoke it or rotate its key.
* The claims from a custom token are validated by the signInWithCustomToken API. Then, the backend generates a Firebase id token. This token contains the user profile  
Figure 2: Workflow of the proposed monitoring framework.  
and is irrevocable proof that its bearer is authorized to do the operations on behalf of the user. Since it cannot be revoked, it is only valid for 1 h.  
Figure 2 illustrates how smart systems enable IoT to send and update patient data. The chosen equipment depends on the hospital and patient care facility. The suggested architecture examines patient data that are available in real time and enables patients to quickly obtain emergency medical care. Because these data are stored in the cloud, medical personnel may access them remotely and offer guidance based on the patient's condition.  
The major goals of the suggested smart healthcare framework are to increase the chances of survival for critically ill patients and provide heart patients with simple, affordable, and reliable monitoring. The suggested system gathers data and sends them to the cloud to be processed further using machine learning and deep learning models. Medical professionals are provided with organized data for in-depth investigation.