# MBPPE: A Modular Batch Processing Platform for Electroencephalography
## 2 Materials and Methods  
### System Architecture Overview  
The system architecture adopts a two-tier structure, consisting of a User Layer and a Server Layer, as depicted in Figure 1. The User Layer developed using Vue.js, focuses primarily on user interaction. In contrast, the Server Layer, constructed and operated with Python, specializes in data processing tasks. Data exchange between these layers occurs via the hypertext transfer protocol (HTTP).  
In the framework, the Interface Driver takes on the responsibility of converting user operation instructions for diverse modules into HTTP requests. The Router Adapter receives these requests and verifies access rights. Upon meeting the access control, the Router Adapter distributes requests to the corresponding processing functions, following routing rules. After processing, the Server Layer packages the results into HTTP responses and sends them to the User Layer. Within the system modules, both the Process and Pipeline components utilize the processing methods of the Process Tools, but they serve different usage scenarios. The Pipeline module establishes an automated workflow by initiating asynchronous sub-threads on the server side to complete all preset tasks, rendering it well-suited for continuous and batch processing tasks. In contrast, the Process module is tailored for single processing tasks and operates synchronously, waiting for the results of the current task before proceeding. This synchronous operation gives the Process module an advantage in handling tasks necessitating real-time feedback.  
The operational modes, as shown in Figure 2, facilitate both online and offline data processing. It seeks to integrate the efficiency of cloud computing with the convenience of integrated platforms, thus achieving a balanced set of benefits.  
Figure 1: System architecture.  
The offline operational mode resembles traditional integrated platforms, allowing users to process EEG data directly on their local computers. The hypertext markup language (HTML) pages built by Vue.js are encapsulated within the Electron framework, allowing for cross-platform application support. Upon program startup, the Server Layer initiates locally as a subprocess. Data exchange relies on the local loopback network, managed by the machine's loopback adapter. Consequently, in most scenarios, the CPU performance primarily dictates data transmission speed, ensuring that transmission performance is not a limiting factor. Local hardware capabilities are crucial for both data processing and user interaction performance in offline mode. Therefore, a certain level of hardware performance is required to process intricate EEG data smoothly.  
Conversely, the online operation mode takes inspiration from cloud computing. In this model, high-performance computers manage data processing tasks, leaving the local system dedicated solely to user interaction and data visualization. This mode supports the concurrent processing of tasks by multiple users, requiring only that users establish a connection between their local machine and the remote server. As we utilized HTML for the development of the user layer, servers that have been deployed can be accessed directly through a web browser. In contrast to other distributed systems, MBPPE grants users full control over system resources, eliminating the necessity for role segmentation. This suggests that the online mode may offer appropriate private deployment solutions for EEG data to laboratories and individual users. Compared to publicly available EEG processing platforms, private deployment can provide enhanced data security and minimize the risk of data leakage.