MODEL AND STRUCTURE OF IoT NETWORK FOR ALZHEIMER’S DISEASE DIAGNOSTICS

. The article presents the structure and model of an Internet of Things network that can be used for remote rapid detection of Alzheimer’s disease. A local server model of the Internet of Things network has been created for personalized medical care on the client side. The model corresponds to the characteristics of the Internet of Things network: interconnection between devices, real-time communication, data processing and analysis, the use of various protocols for data transfer and exchange. When building the model, the Flask framework was used to create an application instance with a trigger condition for sending data from a smartphone to a local server via an HTTP request. The local server receives the HTTP request sent by the smartphone and processes the data. The result of the procedure is transmitted through the MQTT protocol to the MQTT client that has been subscribed to certain topics, i


Introduction
Internet of things (IoT) technology primarily relies on information collection devices to establish connections between objects and the network.It interacts on the basis of predefined protocols to perform functions such as tracking and managing information [1].The monograph [2] provides information on the design of the Internet for the analysis of product quality and environmental sound processing.The construction of an intelligent medical system supported by the IoT technology contributes to the informatization of medical resources and personalized medical decision-making.This allows you to analyze, calculate and exchange huge amounts of data.Traditional hospital models rely heavily on complex processes of multiple analyses, which leads to a loss of time, the necessity of patient presence, and a dec rease in efficiency.In addition, due to regional differences, the distribution of medical resources is uneven.The IoT model helps to solve these problems.
The authors presented the technology of recognition of Alzheimer's disease based on the analysis of voice data, machine learning and a neural network in [3].In this article, the authors presented a model and proposed the structure of the IoT network for remote recognition of Alzheimer's disease.This helps in early diagnosis and surgical treatment, provides real-time monitoring, expands the voice database and can help improve the quality of medical services for patients with Alzheimer's disease.

Flask framework
Flask is a Python based development that relies on Jinja2 template rendering engine and Werkzeug WSGI routing service component as core of the micro-framework, with good scalability and compatibility, can help users to quickly realize a website or web service [4], its work process diagram is shown in Fig. 1.Routing, debugging and WSGI subsystem, are three core components of Flask framework, provided by Werkzeug.Among them, routing refers to mapping URI requests to the corresponding processing function, generally a view function, Werkzeug provides Flask framework internal routing system, which is responsible for route matching distribution and HTTP service response, support for URL routing request integration and can respond to multiple users access requests at a time.Debugging means that Werkzeug provides a complete debugging tool, including stack tracing and error alerts, able to pinpoint the error or exception code during the development process, and perform debugging.WSGI is known as the Web Server Gateway Interface, is a general interface specification between Python Web servers and Web applications, Werkzeug implements the WSGI protocol, so that Flask applications can run on WSGI-compliant Web servers.
The template system is provided by Jinja2, a technology used for building dynamic web pages that allows for the separation of the page's structure and content.Jinja2 enables developers to embed dynamic Python code within HTML files, generating dynamic content.Flask is currently a very popular web framework [5].It not only allows developers to combine MVC (Model-View-Controller) pattern for development but also supports small teams in quickly building medium to small-sized websites or web services.Additionally, Flask offers strong customization capabilities and a powerful plugin library, enabling users to achieve personalized website customization while maintaining a concise, easily maintainable, highly secure, stable, and efficient core functiona lity.For instance, Flask can be extended with Flask-SQLAlchemy to implement database functionality, Flask-Login for user authentication, Flask-Mail for email functionality, and also supports ad ding ORM (Object-Relational Mapping), form validation tools, file uploads, and more.The basic pattern of Flask is to assign a view function to a URL in the program, whenever a user accesses the URL, the system will execute the view function assigned to the URL, get the return value of the function and display it to the browser.
The server in Fig. 1 is the WSGI server responsible for listening to network ports, receiving HTTP requests and invoking the WSGI application to process the requests.Werkzeug provides an implementation of the WSGI interface.When a client initiates an HTTP request, the request is sent to the listening interface of the WSGI server, based on the received HTTP request data, the server creates a dictionary of environment variables (environ), which will be used as parameters along with a callback function (start_response) to invoke the WSGI application object.An application in Flask is defined as an instance of a Flask object or its subclass, which is a WSGI application object.When a WSGI server calls the WSGI application, it is actually calling the Flask object, which will locate the object's route based on the URI path and method of the HTTP request.Upon finding a matching route (view function), Flask will call it to process the HTTP request and get a result, usually a response object will be returned, the response data includes status code, header and body of a HTTP response, then send the response back to the client.

EMQX (also known as EMQX Broker
) is an open-source, distributed MQTT message middleware server [4], used for implementing MQTT protocol-based message transmission and communication.It is widely applied in various real-time communication and message push scenarios, including the IoT, smart homes, and industrial control.The latest version, EMQX 5.0, adopts a brand-new Mria cluster architecture, allowing an EMQX cluster to support up to 100 million concurrent MQTT connections, significantly enhancing its scalability.Additionally, the Mria cluster architecture reduces the risk and impact of brain-splitting in large-scale deployments, providing customers with more stable access to IoT data services.
EMQX supports publish/subscribe messaging model and provides multiple functions including support for subscribing to wildcard topics, retaining message and Quality of Service (QoS).Wildcard support is that EMQX supports MQTT wildcard subscription.Clients can use specific wildcard symbols to subscribe vaguely, flexibly realizing topic-based message filtering, the wildcard symbol includes two kinds of symbols: "+" and "#".Retained message refers to the MQTT message retention mechanism supported by EMQX to maintain message persistence.When a client publishes a message with the retain flag to designated topic, EMQX server will retain the message and if a new client subscribes to the topic, the retained message will be immediately delivered to the new client.The retain flag is a boolean value, configurable by the client, which can be either "0" or "1".Quality of Service (QoS) support refers to EMQX's support for MQTT's QoS level settings.The quality of service for message distribution can be categorized into QoS 0, QoS 1, and QoS 2, again allowing the client specify its own quality of message delivery.
As a server-side software, EMQX Broker is responsible for maintaining subscription relationships, it receives MQTT messages from different clients and ensures that these messages are routed to the correct subscribers, acting as a relay station for the messages.EMQX Broker is a central server implementing the MQTT protocol and can be a local server or a cloud server.This project established a connection with the MQTT Broker server using python code, allowing the application to publish and subscribe to messages for real-time data transfer and communication.The used connection parameters and their explanations are shown in Tab. 1.

Model and structure of IoT network
This project adopted the architecture design of 'mobile frontend display + Flask framework backend + EMQX Broker.'The code has strong scalability and maintainability.The system structure and interaction process are shown in Fig. 2.

Fig. 2. Structure of IoT network for AD diagnostics
The Frontend layout of the screen was written in Java, it realized the process of uploading data to the local server through HTTP protocol and received the prediction result after the data was processed through MQTT protocol.The Result was presented on the screen.The function of local server was implemented by Flask framework and EMQX Broker, Flask framework received HTTP request sent from phone, parsed and found a matching view function, executed it, returned a HTTP response.EMQX Broker precisely sent the prediction result to the client subscribed to the topic cross-platform to realize the real-time communication.The following is a specific materialization of all the processes in the code, which was shown in three blocks from client-side to server-side in detail.
1. Uploading data from client to the local server: a) reading the pre-collected data features from mobile phone.After collected participant's related speech, it will be processed and feature-extracted by the data preprocessing and feature extraction algorithms installed on the client.The authors directly load the data feature file in this project, which has a file extension of 'csv'; b) setting URL for the request.The authors set URL as "http://192.168.100.14:5000/predict",containing local IP address and local port in data format, 192.168.100.14 was the local IP address of authors' computers, 5000 is authors' local port number, which can be used to identify the web service, indicating that the web service listens on port "5000" on computer.'/predict' was the path portion of URL, which can be used to identify a specific resource or function in the Web service.In this project, function 'predict' can predict whether a participant has Alzheimer's disease based on the data uploaded by the client and generate a diagnostic prediction of Alzheimer's disease; c) sending a POST request and receiving HTTP response Project code as: "response = requests.post(url,json=data [1])" 'requests' is a Python third-party library for sending HTTP requests.POST requests are usually used when the client submits data to the server to perform various operations or create new resources.The requests.post()method in this line of code accepted two parameters, one was the URL address to be requested, the other was the requested data.Response variable can store the HTTP response returned by the requests.post()method; d) checking the status code of the HTTP response object Project code as: "if response.status_code== 200: result = response.json()prediction = result['prediction'] print('Prediction result:', prediction) else: print(' Request failed:', response.status_code)"The HTTP status code is a three-digit numerical code returned by the server in response to a request, it was used to indicate the result of the request's processing.In particular, status codes starting with '2**' indicate successful responses, and specifically, a status code of 200 means the request has been successfully processed.Therefore, authors checked whether the status code of the HTTP response object was 200, if it was, printed the prediction result from the data returned by the server, if not, then printed the current status code received, which will help debugging the project.
2. Designing a Flask program: a) importing modules Project code as: "from flask import Flask, jsonify, request from joblib import load import pandas as pd" The authors introduced three classes from Flask framework to build web applications, where 'Flask' is the main class of it, designed to create instances of Flask applications, 'jsonify' is a helper function provided by the Flask framework that converts a Python object into a JSON-formatted HTTP response, and 'request' can represent an HTTP request initiated by a client.The 'joblib' library is a library for serializing and deserializing python objects in python.The 'load' function can load python object from disk which has been saved to disk by 'dump' function.The 'pandas' third-party library has also been imported into the current code environment, providing extensive functionality for handling manipulation of tabular data (such as csv); b) EMQX Broker page.The page of the EMQX Broker after being successfully connected by devices was shown in Fig. 4. It can be seen that there were 2 devices connected to the broker, in this project implementation, the cell phone and the MQTTX client, with the number of subscribed topics being 1; c) MQTTX page.Since in this project, the predicted result that displayed on the mobile phone page was parsed from the HTTP response.To examine the feasibility of distributing the prediction results using the EMQX Broker, the authors used MQTTX to simulate a new client, whose page display was shown in Fig. 5. MQTTX is an open source, cross-platform MQTT 5.0 client tool built on Electron, which is primarily used for debugging and testing MQTT communication.As can be seen from the figure, after subscribed to the topic "/flask/predict", MQTTX, as another client, received the prediction results transmitted via the MQTT protocol.The article presents the model and structure of the Internet of things network, which are designed to determine the presence of Alzheimer's disease in patients, using the author's developments in the technology of IT diagnostics of this disease.An instance of the network project was created using the Flask framework, described how to create a WSGI application from app.py to process client requests.The process of using the app.route decorator method of an instance of the Flask program to crea te viewing functions that are performed when accessing routes was explained, thus, business logic was implemented for fart information and result display functions.
2. It also describes how to use the JSONIFY function to return data in JSON format to the client based on a call to the view function.It explains how to start the Flask web application service using the app.run() method.To expand the scope of providing prediction results, the EMQX Broker was used to facilitate data transmission over the MQTT protocol.The layout of the client page of this pro ject was developed using Java, which included displaying the prediction results of Alzheimer's disease on smartphones of a patient and a doctor.

Table 1 .
Connection Parameters for the EMQX Broker