A multimodal brain-computer interface digital prescription generation method and platform

CN122991561APending Publication Date: 2026-10-27WUHAN YIRUIDE MEDICAL EQUIP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611479158.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-22
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

不同模态、不同厂商的BCI设备采用各异的数据采集协议与存储格式(如EEG的EDF、fNIRS的NIRS、fMRI的NIfTI,以及调控设备的私有参数格式),导致跨模态原始数据整合困难

Benefits of technology

1.可审计单文件处方工作流:基于Quarto.qmd格式的同构处方脚本,每一脚本文件内嵌统一的处方上下文数据对象作为中心数据载体,该数据对象中包含溯源标识字段,在各处理阶段被动继承并自动追加来源标识、处理参数与环境指纹,形成贯穿数据全生命周期的可审计溯源链。将多模态脑机接口数据处理全流程(输入→处理→输出)封装于单一可执行文件中。该文件天然支持版本管理(Git),自动记录数据处理的完整演变历史,通过哈希值写入元数据区域实现完整性锁定,确保最终报告与原始数据、处理参数、运行环境的不可篡改绑定,从根本上解决了现有脑机接口数据处理流程中分析步骤难追溯、参数版本难对齐、跨设备跨模态数据难复现的行业痛点。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122991561A_ABST
    Figure CN122991561A_ABST
Patent Text Reader

Abstract

The application discloses a multimodal brain-computer interface digital prescription generation method and platform, which takes an isomorphic prescription script as a running carrier and takes a prescription context data object as a central data carrier. The data object contains a traceable identification field, which passively inherits source identification, processing parameters and environmental fingerprints at each processing stage to form an auditable traceable chain. The data information carried by the data object evolves unidirectionally along an input / processing / output three-layer data structure in six isomorphic prescription paths. Each path encapsulates algorithms, charts and medical texts in the same script file, and writes the hash value of the structured intermediate state data object and the script version identification into the metadata area to realize integrity locking. An integrated digital prescription report in Word, PDF or HTML format is generated through a Pandoc document converter. The application realizes a single-file auditable workflow from multimodal data to digital prescriptions, and can be applied to clinical diagnosis and treatment, individualized treatment, scientific research data management and health management scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method and platform for generating digital prescriptions using a multimodal brain-computer interface. Background Technology

[0002] Brain-computer interface (BCI) technology is rapidly evolving towards high-value applications involving multimodal collaboration and closed-loop feedback. Currently, BCI technology has differentiated into two major systems: output-based BCI (neural signal reading and decoding, such as fNIRS, EEG, fMRI, etc.) and input-based BCI (neural function modulation and intervention, such as TMS, tES, DBS, etc.). The integration of these two systems, namely the read-interpret-imitate-write closed-loop BCI, is considered an important direction for realizing personalized treatment and optimized intervention strategies for brain diseases. However, existing integration schemes lack a workflow mechanism to integrate multimodal BCI data into auditable, reproducible, and executable digital prescriptions.

[0003] However, in the process of translating from laboratory to large-scale clinical application, the existing technology system has the following systemic defects: (i) Severe data silos and lack of unified interface standards Different modalities and manufacturers of BCI devices employ varying data acquisition protocols and storage formats (such as EDF for EEG, NIRS for fNIRS, NIfTI for fMRI, and proprietary parameter formats for modulators), making cross-modal raw data integration difficult. Output-based BCIs and input-based BCIs are incompatible in terms of data formats, coordinate spaces, and temporal references, making stimulus-response correlation analysis difficult to perform on a single platform. Furthermore, existing system architectures are generally closed; when introducing new modal devices (such as fUS and tPBM), a new data parsing module must be developed, resulting in high integration costs and long validation cycles.

[0004] (ii) The reporting system is missing or non-standardized, resulting in insufficient support for clinical decision-making. Most output-type BCI devices only output raw data or simple waveforms, lacking standardized reports that include quantitative indicators (such as brain region activation intensity and frequency band power values) and clinical interpretation. Some input-type BCI devices don't even have report generation capabilities, relying on doctors' subjective records for treatment effectiveness. Even those few devices that can generate reports are limited to a single technical dimension, and the report formats and indicator definitions are inconsistent. Reports generated by different devices vary in format, requiring doctors to manually copy and paste charts into the electronic medical record system, which is time-consuming (averaging 20-30 minutes per case) and prone to human error, making horizontal comparisons and longitudinal tracking difficult. Furthermore, existing reporting systems lack an auditable traceability mechanism for the entire data processing process—key information such as analysis parameters, processing steps, and operating environment is not recorded, making it difficult to reproduce and review report results, failing to meet the traceability compliance requirements of Medical Device Software (SaMD).

[0005] (iii) Existing technologies cannot support multimodal closed-loop collaborative clinical pathways. While existing technologies have attempted to optimize single-modal report output, they are all limited to a specific type of BCI technology and cannot be extended to the integration of treatment data from input BCI devices, let alone achieve multimodal result correlation between "output BCI measurement data + input BCI treatment data". For example, in stroke rehabilitation assessment scenarios, doctors need to separately review fMRI brain injury localization reports, EEG neural electrical activity reports, and TMS treatment parameter records, manually correlating the three, which is cumbersome and prone to information bias. Traditional reports only present static results and do not combine stimulation parameters with multimodal decoding results to provide suggestions for the next stage of regulation, resulting in the inability to automate the clinical decision-making loop of "data → indicators → suggestions".

[0006] In summary, existing technologies suffer from systemic limitations in key areas such as cross-modal data compatibility, standardized analysis processes, automated report generation, and closed-loop brain-computer interface clinical workflow support. These limitations prevent the full automation of the entire process—from "arbitrary modal data reading to cross-modal indicator extraction to digital prescription generation"—within a single platform. Therefore, there is an urgent need for a universal, scalable, multimodal brain-computer interface digital prescription platform that supports read-write interaction and personalized treatment, thereby connecting the entire "read-interpretation-simulation-writing" chain and improving the intelligence and precision of brain disease diagnosis and treatment. Summary of the Invention

[0007] To overcome the shortcomings of the prior art, this invention provides a multimodal brain-computer interface digital prescription generation method and platform. Its core lies in constructing an auditable single-file prescription workflow with isomorphic prescription scripts as the carrier and prescription context as the data center. In this workflow, six isomorphic prescription pathways each carry prescription context and evolve unidirectionally along three stages: input layer / processing layer / output layer.

[0008] The technical solution adopted in this invention is as follows: (I) Methodological Aspects This invention provides a method for generating digital prescriptions for a multimodal brain-computer interface, based on a set of isomorphic prescription scripts. Each script file in the isomorphic prescription script uniformly embeds the same prescription context data object as its central data carrier. The data information carried in the central data carrier evolves unidirectionally along a three-layer data structure of input, processing, and output layers within six isomorphic prescription pathways. The prescription context data object includes a traceability identifier field, which passively inherits the source identifier, current processing parameters, and operating environment fingerprint of the input data at each processing stage, and automatically adds a new layer of processing records at each stage, forming an auditable traceability chain that spans the entire data lifecycle. The six isomorphic prescription pathways include three regulatory prescription pathways and three detection prescription pathways. The three regulatory prescription pathways respectively carry TMS regulation, tDCS regulation, and TUS regulation, while the three detection prescription pathways respectively carry fNIRS detection, EEG detection, and fMRI detection.

[0009] The method specifically includes the following steps: Step 1 (Input Layer Writing): Write raw data to the central data carrier at the input layer nodes of each pathway, and generate a corresponding source identifier for each piece of raw data. Record the data source device type, channel identifier, and acquisition timestamp. The raw data includes neurometry data from the neurodetection brain-computer interface device and / or neuromodulation data from the neuromodulation brain-computer interface device.

[0010] Step Two (Processing Layer Standardization): The raw data is standardized at the processing layer nodes of each pathway. Specifically, when the raw data is neural measurement data, corresponding preprocessing, key indicator extraction, and visualization result generation are performed according to the modality type; when the raw data is neural modulation data, parameter parsing and recording are performed. After processing, the algorithm identifier, parameter snapshot, and runtime fingerprint are automatically appended to the traceability identifier field. The analysis results after processing are written to the output layer nodes of the same pathway.

[0011] Step 3 (Output Layer Integration): Obtain the analysis results from the output layer nodes of each pathway and integrate them to generate a structured intermediate data object. Write the hash value of the structured intermediate data object and the version identifier or hash value of the complete isomorphic prescription script on which the object was generated into the metadata area of ​​the same file, so that the final integrated digital prescription report forms an immutable binding relationship with the original data, processing parameters, and operating environment.

[0012] Step 4 (Prescription Report Generation): Invoke the Pandoc document converter to convert the structured intermediate data object into an integrated digital prescription report in the target delivery format.

[0013] Furthermore, in the above method, during the standardization of raw data at the processing layer nodes of each pathway, when the raw data is neurometric data, a task-specific processing flow is executed according to the modality type and experimental task type. Specifically: when the neurometric data is functional near-infrared spectroscopy data, the near-infrared analysis library is called to perform optical density conversion and Beer-Lambert law correction calculations. After denoising and baseline correction, the integral value, mean, peak value, and centroid slope during the task period are extracted as activation intensity indicators. The surface mapping algorithm is used to map the activation intensity to the cortical grid to generate a three-dimensional brain functional topography object. When the neurometric data is electroencephalogram (EEG) data, the EEG analysis library is called to perform resampling, filtering, independent component analysis to remove artifacts, and bad lead interpolation. Based on event-related potential (ERP) markers, segmentation and superposition averaging are performed to extract EEP parameters within the region of interest. The amplitude peak and latency of discrete scalp electrode data are determined, and spherical harmonic interpolation is used to interpolate the discrete scalp electrode data onto a continuous scalp projection plane, generating a two-dimensional EEG topology map object and an average waveform map object of the region of interest. When the neurometric data is functional magnetic resonance imaging (fMRI) data, the fMRI preprocessing toolkit is invoked to perform head motion correction, temporal layer correction, magnetic field inhomogeneity correction, spatial registration, and standardization to a standard space. A single interpolation resampling strategy is used to concatenate multiple transformation matrices and perform only one interpolation operation. Based on the preprocessed data, brain region activation heatmap objects or functional connectivity matrix objects are generated according to the task state or resting state, respectively. The processing flow loads corresponding exclusive processing parameters and algorithm configurations according to the user's preset experimental task type. Different task types correspond to different preprocessing parameters, index extraction time windows, and result interpretation rules.

[0014] Furthermore, in the above method, calling the Pandoc document converter to convert the structured intermediate data object into an integrated digital prescription report in the target delivery format specifically includes: building a digital prescription template engine based on Quarto dynamic document technology; injecting the structured intermediate data object into the digital prescription template engine using a parametric rendering mechanism, triggering the execution of the embedded code block in the template, and automatically generating an intermediate document containing medical text descriptions and visual graphic objects; and calling the Pandoc document converter to convert the intermediate document into a report in the target delivery format.

[0015] Furthermore, in the above method, automatically generating an intermediate document containing medical text descriptions and visual graphical objects specifically includes: comparing quantitative indicators in the structured intermediate data object with preset norm thresholds in real time, automatically combining medical terms and explanatory text to generate dynamic medical text descriptions; and directly embedding the visual graphical objects into the intermediate document through memory object references.

[0016] Furthermore, in the above method, during the standardization of raw data at the processing layer nodes of each pathway, a physical field simulation step is also included: receiving individualized structural magnetic resonance imaging data or a standard brain template, and executing physical field simulation logic according to the modulation mode. For transcranial magnetic stimulation or transcranial electrical stimulation, a finite element model of the patient's head or a standard brain is constructed, and the electric field distribution of the neuromodulation device in the brain is calculated; for transcranial ultrasound stimulation, an acoustic propagation model is constructed, and the sound field distribution of ultrasound waves in the brain is calculated. The simulation step generates a three-dimensional brain mesh object with a three-dimensional electric field or sound field distribution and writes it into the output layer node of the same pathway.

[0017] (ii) Platform aspect This invention also provides a multimodal brain-computer interface digital prescription platform for performing the methods described in any of the above embodiments. The platform comprises a three-tiered processing architecture: a task configuration layer, a computational simulation layer, and a prescription generation layer.

[0018] The task configuration layer is used to write raw data to the central data carrier at the input layer nodes of each pathway, and generate a corresponding source identifier for each piece of raw data. The raw data includes neurometry data from the neurodetection brain-computer interface device and / or neuromodulation data from the neuromodulation brain-computer interface device.

[0019] The computational simulation layer is used to standardize the raw data at the processing layer nodes of each pathway, including: when the raw data is neural measurement data, performing corresponding preprocessing, key indicator extraction and visualization result generation according to the modality type; when the raw data is neural modulation data, performing parameter parsing and recording; and writing the analysis results after processing to the output layer nodes of the same pathway, and maintaining the source identification update of the data at each processing stage.

[0020] The prescription generation layer is used to obtain and integrate the analysis results at the output layer nodes of each pathway, generate a structured intermediate data object, and call the Pandoc document converter to convert the structured intermediate data object into an integrated digital prescription report in the target delivery format. The traceability identification chain and the structured intermediate data object are then encapsulated together in the final digital prescription report.

[0021] Furthermore, in the aforementioned platform, the prescription generation layer is also used to: construct a digital prescription template engine based on Quarto dynamic document technology; inject patient information, the analysis results, and task parameters obtained through the task configuration layer into the digital prescription template engine using a parameterized rendering mechanism, trigger the execution of the template embedded code block, and automatically generate an intermediate document containing medical text descriptions and visual graphical objects; and call the Pandoc document converter to convert the intermediate document into a report in the target delivery format.

[0022] Furthermore, in the aforementioned platform, during the standardization of raw data at the processing layer nodes of each pathway, the computational simulation layer executes task-specific processing procedures based on modality type and experimental task type when the raw data is neurometric data. When the neurometric data is functional near-infrared spectroscopy data, the near-infrared analysis library is invoked to perform optical density conversion and Beer-Lambert law correction calculations. After denoising and baseline correction, activation intensity indicators are extracted and a three-dimensional brain functional topography object is generated. When the neurometric data is electroencephalogram (EEG) data, the EEG analysis library is invoked to perform resampling, filtering, independent component analysis for artifact removal, and bad lead interpolation. Event-related potential (ERP) component indicators are extracted and a two-dimensional EEG topology object is generated. When the neurometric data is functional magnetic resonance imaging (fMRI) data, the fMRI preprocessing toolkit is invoked to perform head motion correction, temporal correction, and spatial standardization. Based on the corrected and standardized data, brain region activation heatmap objects or functional connectivity matrix objects are generated according to task state or resting state, respectively. The computational simulation layer loads corresponding exclusive processing parameters and algorithm configurations according to the user's preset experimental task type. Different task types correspond to different preprocessing parameters, index extraction time windows, and result interpretation rules.

[0023] Furthermore, in the aforementioned platform, during the standardization of raw data at the processing layer nodes of each pathway, the computational simulation layer is also used to: execute physical field simulation logic based on the received individualized structural magnetic resonance data or standard brain templates. For transcranial magnetic stimulation or transcranial electrical stimulation, a finite element model of the patient's head or standard brain is constructed to calculate the electric field distribution of the neuromodulation device within the brain; for transcranial ultrasound stimulation, an acoustic propagation model is constructed to calculate the sound field distribution of ultrasound waves within the brain. The simulation step generates a three-dimensional brain mesh object with a three-dimensional electric or sound field distribution and writes it to the output layer node of the same pathway, then transmits it to the prescription generation layer.

[0024] Furthermore, in the aforementioned platform, the integrated digital prescription report generated by the prescription generation layer is used for at least one of the following data processing scenarios: A. Integrate the neuro-detection brain-computer interface brain function decoding indicators and neuro-modulation brain-computer interface stimulation parameters in the integrated digital prescription report to generate structured data for characterizing the quantitative screening and assessment of auxiliary diseases, and analyze the brain function-specific correlation mechanism to generate structured data for characterizing the recommendation of neuro-modulation targets. B. Based on the integrated digital prescription report, generate structured data to characterize the recommended regulatory sites, perform data correlation analysis of the treatment process, and generate structured data to characterize the comparison of efficacy before and after treatment; C. Through the computational simulation layer of the platform, brain function data from different manufacturers and different modalities are preprocessed and indexes are extracted in a unified manner to generate digital prescription reports for research purposes, so as to construct a multimodal brain function database; D. Through cloud deployment or standardized reporting interfaces, output the structured assessment conclusions and historical tracking data from the integrated digital prescription report to generate health management recommendations.

[0025] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Auditable Single-File Prescription Workflow: Based on isomorphic prescription scripts in the Quarto.qmd format, each script file embeds a unified prescription context data object as the central data carrier. This data object contains a traceability identifier field, which is passively inherited and automatically appended with source identifiers, processing parameters, and environmental fingerprints at each processing stage, forming an auditable traceability chain throughout the entire data lifecycle. The entire multimodal brain-computer interface data processing workflow (input → processing → output) is encapsulated in a single executable file. This file natively supports version control (Git), automatically recording the complete evolution history of data processing. Integrity locking is achieved by writing hash values ​​to the metadata area, ensuring the final report is immutably bound to the original data, processing parameters, and operating environment. This fundamentally solves the industry pain points in existing brain-computer interface data processing workflows, such as difficulty in tracing analysis steps, difficulty in aligning parameter versions, and difficulty in reproducing cross-device and cross-modal data.

[0026] 2. Multimodal Unified Adaptation of a Six-Pathway Isomorphic Architecture: Through the isomorphic design of three regulatory pathways and three detection pathways, six brain-computer interface devices with different physical mechanisms (TMS, tDCS, TUS, fNIRS, EEG, fMRI) are uniformly mapped to the same three-layer data structure (input layer → processing layer → output layer), eliminating the fragmentation dilemma of "one device, one analysis process" in traditional solutions. Each pathway uses the same prescription context data object as the central data carrier, ensuring that regardless of the data source, its processing logic follows a unified unidirectional evolution rule.

[0027] 3. Closed-loop integration of regulation and detection: Through the correlation and integration of output layer nodes, the brain function decoding indicators of the neural detection workflow and the stimulation parameters of the neural regulation workflow are fused into the same structured intermediate data object to generate an integrated digital prescription report. Based on this, further capabilities can be achieved: analysis of brain function-specific correlation mechanisms, recommendation of neural regulation targets, comparison of efficacy before and after treatment, and optimization of closed-loop brain-computer interface parameters—achievements that cannot be accomplished by existing single-modality or regulation-detection separation schemes.

[0028] 4. Standardized Prescription Delivery and Clinical Decision Support: Pandoc document converter transforms structured intermediate data objects into multiple delivery formats such as Word, PDF, and HTML with a single click, meeting the reporting needs of various clinical scenarios (specialty diagnosis and treatment, research management, and health management). Combined with Quarto dynamic document technology, it enables real-time comparison of quantitative indicators with normative thresholds and automatic generation of medical text, upgrading digital prescriptions from "data reports" to "interpretable clinical decision support."

[0029] 5. Deep integration of physical field simulation: The electric field simulation of TMS / tDCS and the acoustic field simulation of TUS are embedded into the processing layer nodes, so that the field distribution visualization results of the brain can be obtained before the regulation prescription is generated, further improving the accuracy of neuromodulation target localization and the level of individualization of treatment plan. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0031] Figure 1 This is a schematic diagram of the architecture of a multimodal brain-computer interface digital prescription platform with 6 prescription pathways provided in an embodiment of the present invention. The diagram shows: 3 regulatory prescription pathways on the left (TMS pathways 211~213, tDCS pathways 221~223, TUS pathways 231~233), and 3 detection prescription pathways on the right (fNIRS pathways 311~313, EEG pathways 321~323, fMRI pathways 331~333). Each pathway consists of three prescription context stage blocks: input layer, processing layer, and output layer. The output layer blocks of the 6 pathways are collectively aggregated into a Pandoc document converter (500), which outputs three target delivery formats—Word document (361), PDF file (362), and HTML report (363)—after format mapping, and finally aggregated into an integrated digital prescription report (400). Detailed Implementation

[0032] The terms “comprising” and “having”, and any variations thereof, in the specification, claims, and accompanying drawings of this invention are intended to cover a non-exclusive inclusion, such as a process, method, system, product, or apparatus that includes a series of steps or units, not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. In addition, the technical features of the various embodiments or individual embodiments provided by the present invention can be arbitrarily combined to form new technical solutions. Such combinations are not bound by the order of steps and / or structural composition patterns, but must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.

[0034] This invention provides a method for generating digital prescriptions for multimodal brain-computer interfaces, which is applied to a multimodal brain-computer interface digital prescription platform.

[0035] Before detailing each step, the overall architecture of the multimodal brain-computer interface digital prescription platform will be explained first.

[0036] like Figure 1 As shown, the platform uses a set of isomorphic prescription scripts (Quarto.qmd files) as its runtime environment and adopts a three-tier processing architecture, including: a task configuration layer, a computational simulation layer, and a prescription generation layer.

[0037] The core mechanism of the platform lies in the following: each isomorphic prescription script file uniformly embeds the same prescription context data object as the central data carrier of the script file; the prescription context data object contains a traceability identifier field, which passively inherits the source identifier, current processing parameters, and operating environment fingerprint of the input data at each processing stage, and automatically adds a new layer of processing records at each stage, forming an auditable traceability chain that runs through the entire data lifecycle; the data information carried in the central data carrier evolves unidirectionally along the three-layer data structure of the input layer, processing layer, and output layer in six isomorphic prescription pathways. The six isomorphic prescription pathways include three regulatory prescription pathways (TMS pathways 211~213, tDCS pathways 221~223, TUS pathways 231~233) and three detection prescription pathways (fNIRS pathways 311~313, EEG pathways 321~323, fMRI pathways 331~333).

[0038] The functions of each level are as follows: The task configuration layer corresponds to the function of the input layer. It is used to write raw data to the central data carrier at the input layer nodes of each pathway, and generate a corresponding source identifier for each piece of raw data. It records the data source device type, channel identifier, and acquisition timestamp, including neurometry data from neural detection brain-computer interface devices and / or neuromodulation data from neural modulation brain-computer interface devices. This layer is responsible for receiving, parsing, and routing raw data, as well as configuring and distributing task parameters.

[0039] The computational simulation layer corresponds to the processing layer's function, used to standardize the raw data at the processing layer nodes of each pathway. This includes: when the raw data is neural measurement data, performing corresponding preprocessing, key indicator extraction, and visualization result generation based on the modality type; and when the raw data is neural modulation data, performing parameter parsing and recording. After processing, the algorithm identifier, parameter snapshot, and runtime environment fingerprint are automatically appended to the traceability identifier field. The analysis results after processing are written to the output layer nodes of the same pathway.

[0040] The prescription generation layer corresponds to the output layer's function. It acquires and integrates analysis results from the output layer nodes of each pathway, generates a structured intermediate data object, and calls the Pandoc document converter to convert the structured intermediate data object into an integrated digital prescription report in the target delivery format. The prescription generation layer writes the hash value of the structured intermediate data object and the version identifier or hash value of the complete isomorphic prescription script on which the object was generated into the metadata area of ​​the same file, thus creating an immutable binding relationship between the final integrated digital prescription report and the original data, processing parameters, and operating environment.

[0041] The following combination Figure 1The specific implementation methods for each step are described in detail.

[0042] Step 1: Write the raw data to the central data carrier at the input layer nodes of each channel.

[0043] Raw data is written to the central data carrier at the input layer nodes of each pathway. The raw data includes neurometric data from the neurodetection brain-computer interface device and / or neuromodulation data from the neuromodulation brain-computer interface device.

[0044] Specifically, the task configuration layer, as the system's input control hub, is responsible for the parameterization of medical tasks, the parsing and routing of multimodal raw data, and the intelligent distribution of business flows. It aims to build standardized task context data packets to provide a unified entry point for subsequent calculations.

[0045] For the neuromodulation brain-computer interface workflow, the task configuration layer provides a structured parameter input interface, allowing users to manually input the necessary parameters for generating the modulation report via the software front-end. The system dynamically loads the corresponding parameter template based on the type of modulation device.

[0046] (1) Transcranial Magnetic Stimulation (TMS): Required parameters include stimulation intensity (%MSO, range 20%-80%), stimulation frequency (Hz, range 1-50Hz), number of stimulations (1-200 per series), interval time (ITI) (1-60s), number of repetitions (1-100 times), and coil selection (left / right / dual). Recommended parameters include RMT threshold (30%-70%MSO), stimulated brain region (e.g., DLPFC / M1), and total number of pulses (600-3000, calculated by multiplying the number of stimulations by the number of repetitions). Optional parameters include TBS mode-specific parameters (intraplexal frequency 50Hz, number of intraplexal stimulations 2-5, interplexal frequency 5Hz, number of interplexal stimulations 1-200), dual-coil time difference (0-100ms), stimulation mode (standard / TBS / single), coil type (H-coil), and pulse waveform (monophagic / biphagic). These parameters can be manually input by the user.

[0047] (2) Transcranial direct current stimulation (tDCS): Required parameters include current intensity (500-2000μA), total time (600-1800s), fade-in time (10-30s), and fade-out time (10-30s); recommended parameters include electrode polarity (anode / cathode), electrode position (e.g., F3 / F4), electrode area (25-35cm²), current density (0.02-0.08mA / cm², calculated by dividing the current intensity by the electrode area), and contact impedance (<10kohm); optional parameters include sham stimulation mode.

[0048] (3) Transcranial AC Stimulation (tACS): Required parameters include peak-to-peak current intensity (500-1500 μA), stimulation frequency (0.01-250 Hz), and total duration (600-1800 s); optional parameters include initial phase (0-355°) and DC offset (±1000 μA); recommended parameters include fade-in time (10-30 s), fade-out time (10-30 s), electrode position, and electrode area (25-35 cm²). The device shares the same hardware platform as tDCS and distinguishes its working mode through command codes.

[0049] The parameters can be manually input by the user. After receiving the parameters, the system writes them into the task context data packet and passes them to the computational simulation layer and the prescription generation layer. The prescription generation layer calls the Quarto dynamic document template (.qmd file), injects the control parameters as input variables into the template, triggers the execution of the embedded code block, and automatically generates an integrated report containing control parameter records and control effect simulation graphs.

[0050] Meanwhile, the task configuration layer provides a channel for uploading and parsing structural magnetic resonance (sMRI) data. Depending on whether such data is received, the task context is automatically marked as either individualized simulation mode or standard brain simulation mode, achieving adaptive compatibility with different data completeness.

[0051] For the neural detection brain-computer interface workflow, the task configuration layer implements a file extension recognition and parser routing mechanism: the system maintains a predefined modality-parser mapping table, stored in JSON format, recording the file extensions supported by each modality, the corresponding parsing toolkit, and the parameter reading method. After the user selects the detection technology type and uploads the corresponding raw detection data file on the front-end interface, the task configuration layer obtains the technology type identifier and data file information. Based on the technology type identifier and the verification result of the data file extension, it queries the modality-parser mapping table to determine the corresponding data reading toolkit and parsing interface, and then reads and parses the raw data.

[0052] A specific implementation example of the modality-parser mapping table is as follows: For functional near-infrared spectroscopy (fNIRS) modes, supported file formats include .csv, .xlsx, .snirf, .mat, and .nirs. The corresponding parsing toolkit is the near-infrared analysis library (MNE-NIRS / Hinirs). The system automatically recognizes the file extension and routes it to the corresponding reading interface. For EEG / MEG modalities, supported file formats include .edf, .bdf, .eeg, .set, .fdt, .fif, .ds, etc. (MNE-Python compatible formats), and the corresponding parsing toolkit is the MNE EEG Analysis Library; For functional magnetic resonance imaging (fMRI) modality, supported file formats include .nii, .nii.gz, .img, .hdr, etc. (NiBabel compatible formats), and the corresponding parsing toolkit is the magnetic resonance analysis library.

[0053] When introducing new modal devices, it is only necessary to add the corresponding modal entry, supported formats, and parsing toolkit path to the JSON configuration file of the modality-parser mapping table. No modification to the core system code is required, thus achieving scalability for device access. For example, when a user selects the fNIRS modality and uploads a .nirs file, the platform calls the corresponding near-infrared analysis library for structured reading, and simultaneously writes the technology type identifier and reading method information into the task context data packet, which is then sent to the computational simulation layer for subsequent processing.

[0054] For the brain-computer interface business pipeline for neural testing, the platform uses a pre-set mapping table to filter and display effective experimental paradigms in real time after the user selects a technical modality (such as fNIRS, EEG, fMRI, etc.). For example, when selecting the fNIRS modality, the system automatically associates paradigm options such as N-back, Go / NoGo, or verbal fluency task (VFT).

[0055] Step 2: Standardize the raw data at the processing layer nodes of each pathway.

[0056] The raw data is standardized at the processing layer nodes of each pathway. The computational simulation layer receives the task context data packet issued by the task configuration layer, and calls the corresponding numerical calculation, signal processing algorithms and physical simulation models within a unified execution framework to generate quantified index results and visualized graphical objects. All outputs are temporarily stored in the form of memory objects or standardized files, with accompanying metadata descriptions, for precise use by the prescription generation layer.

[0057] The standardization process includes: when the raw data is neural measurement data, performing corresponding preprocessing, key indicator extraction, and visualization result generation according to the modality type; when the raw data is neural modulation data, performing parameter parsing and recording. The processed analysis results are then written to the output layer nodes of the same pathway.

[0058] (1) Neural modulation workflow - physical field simulation Specifically, for the neuromodulation brain-computer interface workflow, the computational simulation layer routes to the corresponding physics simulation engine based on the modulation mode: Transcranial magnetic stimulation (TMS): The bioelectromagnetic field simulation tool (SimNIBS) was invoked. Based on the received individualized structural MRI data, the CHARM pipeline was used to perform MRI segmentation (SAMSEG probability mapping combined with a Gaussian mixture model), thickness-adaptive tetrahedral mesh generation (CGAL 3D meshing, dynamically adjusting mesh density based on local tissue thickness), and tissue conductivity assignment (isotropic scalar or anisotropic 3×3 conductivity tensor based on DTI data). The A-phi formula was used to solve for the TMS induced electric field: total electric field. The magnetic vector potential A is calculated from the coil current using Biot-Savart's law, and the scalar potential V is solved using the finite element method (tetrahedral first-order FEM) to obtain the Poisson equation under the quasi-static approximation. The solver used is Hypre (CG + BoomerAMG preconditioning) or PARDISO. After the calculation is completed, the electric field distribution is mapped to the middle surface of the gray matter (50% depth) to generate a three-dimensional electric field intensity mesh object.

[0059] Transcranial electrical stimulation (tES, including tDCS / tACS / tRNS): Utilizing the same bioelectromagnetic field simulation tool (SimNIBS), based on an individualized head mesh model, the Poisson equation is solved. Neumann boundary conditions (current density) or Dirichlet boundary conditions (fixed potential) are applied to the electrode surface to calculate the intracranial electric field distribution and generate a three-dimensional electric field intensity mesh object. tDCS / tACS / tRNS share the same hardware platform and distinguish their operating modes through command codes.

[0060] Transcranial ultrasound stimulation (TUS): This method uses the ultrasound field simulation tool (k-Wave) to construct an acoustic propagation model based on skull CT or structural magnetic resonance data. It calculates the sound pressure distribution and energy focusing area of ​​ultrasound waves within the skull and generates a three-dimensional sound field distribution mesh object.

[0061] The physical field simulation generates a three-dimensional brain mesh object with a three-dimensional electric field or sound field distribution, and writes it into the output layer node of the same path, which is then passed to the prescription generation layer and embedded into the final digital prescription report.

[0062] (2) Neural detection workflow—signal processing and index extraction For functional near-infrared spectroscopy (fNIRS) data, perform the speech fluency task processing workflow: The near-infrared analysis library is called to perform optical density conversion and Beer-Lambert law calculation. After denoising and baseline correction, the integral value (cumulative effect), mean, peak value and centroid slope during the task period are extracted. At least one of the integral value, mean, peak value and centroid slope is used as the activation intensity. The activation intensity is mapped to the cortical mesh using the surface mapping algorithm (nirs2surf method) to generate a three-dimensional brain functional topography object, and at the same time, a multi-region waveform object is generated.

[0063] The surface mapping algorithm uses the nirs2surf method and includes the following steps: (a) Coordinate transformation: Based on the probabilistic correspondence between the electrode positions of the international 10-20 system and the MNI standard coordinate system, solve the 4×4 affine transformation matrix W from the subject's head surface points to the MNI standard space, such that P_MNI = P_reality × W; (b) Cortical projection: The transformed head surface points are projected onto the reference cerebral cortex surface along the normal direction using the balloon-inflation method to obtain the cortical projection points; (c) Multi-reference brain fusion: After calculating the cortical projection points for N=17 reference brains, the average value is taken and the actual vertex (cortical surface centroid) of the template cortical surface is located through nearest neighbor search to avoid the average point falling below the cortex. (d) Gaussian radial basis function interpolation: Centered on the MNI coordinates of each channel, the discrete channel data is smoothly interpolated to the vertices of the continuous cortical grid using the Gaussian kernel function (sigma=10mm, cutoff radius 20mm). The value of each vertex is the weighted sum of the contributions of all channels received. (e) 3D rendering: Scalar data is rendered using the PyVista engine on an optimized OBJ format cerebral cortex mesh (with linear subdivision and Laplacian smoothing) to generate multi-view (left / forward / right / top view) 3D brain functional topographic objects.

[0064] The processing flow described is task-specific: the system loads corresponding dedicated processing parameters and algorithm configurations based on the experimental task type selected by the user in the task configuration layer (such as verbal fluency task VFT, N-back working memory task, Go / NoGo inhibition control task, emotion picture description task, storytelling task, resting state acquisition, etc.). Different task types correspond to different preprocessing parameters (such as filter frequency band, baseline correction window), indicator extraction time windows (such as task start and end time, latency range of event-related potential components), and result interpretation rules (such as norm threshold, anomaly judgment criteria). The above flow is only a macro example; the parameter configuration for specific tasks is automatically matched by the system from a predefined task-parameter mapping table based on the task type identifier.

[0065] For electroencephalogram (EEG) data, perform the standard processing procedure: The system calls upon an EEG analysis library (such as MNE) to perform resampling, filtering, independent component analysis to remove artifacts, and bad lead interpolation. Based on event-related potential markers, it performs epoch segmentation and superimposed averaging to extract the amplitude peak and latency of event-related potential components (such as P300 and mismatched negative wave MMN) within the region of interest. The discrete scalp electrode data are then interpolated to a continuous scalp projection plane using spherical harmonic interpolation to generate a two-dimensional EEG topology map object, and simultaneously generates an average waveform object of the region of interest.

[0066] The processing flow is task-specific: the system loads corresponding dedicated processing parameters and algorithm configurations based on the experimental task type selected by the user in the task configuration layer. Different task types correspond to different preprocessing parameters, indicator extraction time windows, and result interpretation rules.

[0067] For functional magnetic resonance imaging (fMRI) data, perform task-specific processing procedures: The preprocessing pipeline is executed using functional magnetic resonance imaging (fMRI) preprocessing toolkits (such as fMRIPrep), including: head motion correction (FSL mcflirt, a 6-parameter rigid body transformation), interslice time correction (AFNI 3dTshift, aligning all slices to the TR midpoint), magnetic field inhomogeneity correction (SDCFlows multi-source field map fusion, supporting automatic selection of phase difference maps, B0 mapping maps, PEPOLAR, and SyN field map-free methods), EPI to T1w boundary registration (FreeSurfer bbregister or FSL flirt+BBR cost function, with quality control backoff mechanism), and spatial normalization to MNI standard space (ANTs nonlinear registration). This preprocessing pipeline employs a single interpolation resampling strategy, concatenating all transformation matrices such as head motion correction, magnetic field distortion correction, EPI-to-T1w registration, and T1w-to-standard space registration, and performing only one Lanczos interpolation, avoiding information loss and spatial blurring caused by multiple interpolations in traditional multi-step pipelines.

[0068] Based on the preprocessed data, generate either a brain region activation heatmap or a functional connectivity matrix object according to the task state or resting state: For task-oriented fMRI data: a general linear model (GLM) is constructed based on the preprocessed time-series data to calculate the activation intensity statistical parameters (t-value / z-value) and statistical significance (p-value) of the target brain region, and to generate a brain region activation heatmap object.

[0069] For resting-state fMRI data: calculate the time-series correlation of oxygenation level dependent (BOLD) signals between preset regions of interest (ROIs) to generate functional connectivity matrix objects and related network topology objects.

[0070] For task-oriented fMRI data, spatial representation employs a voxel-to-surface sampling method: the mri_vol2surf tool of FreeSurfer is used to sample the BOLD time series from voxel space to the cortical surface (averaging multiple layers between the white matter surface and the pial surface), directly presenting the activation intensity distribution on the cortical mesh without the need for additional spatial mapping algorithms.

[0071] The processing flow is task-specific: the system loads corresponding dedicated processing parameters and algorithm configurations based on the user-preset experimental task type. Different task types correspond to different preprocessing parameters, indicator extraction time windows, and result interpretation rules.

[0072] Step 3: Obtain the analysis results at the output layer nodes of each pathway and integrate them to generate a structured intermediate data object; call the Pandoc document converter to convert the structured intermediate data object into an integrated digital prescription report in the target delivery format.

[0073] The analysis results are acquired and integrated at the output layer nodes of each pathway to generate structured intermediate data objects. The prescription generation layer is used to automate the construction and output of digital prescriptions. This layer introduces Quarto dynamic document technology as the core implementation method to build a digital prescription template engine. By encapsulating the calculation process, result data, and text description in an executable document, it achieves a seamless conversion from calculation results to medical narrative.

[0074] Then, the Pandoc document converter is invoked to convert the structured intermediate data object into an integrated digital prescription report in the target delivery format.

[0075] Quarto is a dynamic document generation technology based on parametric rendering. Its core mechanism uses .qmd files as template execution units to integrate document markup language with executable code blocks. During the document compilation process, the code is automatically executed and the results (including text output and graphical objects) are embedded into the final document.

[0076] To address the systemic shortcomings mentioned in the background technology, this invention deeply integrates the core principles of Quarto dynamic document technology with the needs of digital prescription generation, specifically in the following seven aspects: (1) A three-stage rendering pipeline ensures report consistency. Addressing the shortcomings of existing reports with varying output formats from different devices, requiring manual integration by doctors, Quarto employs a three-stage rendering pipeline: "code execution → Abstract Syntax Tree (AST) conversion → post-processing." In the first stage (code execution), Quarto scans the language types of code blocks in the document through an engine registration and claiming mechanism. Each execution engine declares its claiming priority, and the one with the highest score gains execution rights. In the second stage (Pandoc rendering), a custom Lua reader replaces the default Markdown parser, converting enhanced Markdown into an abstract syntax tree. In the third stage (post-processing), external resources are inlined into the document through an HTML post-processor chain or self-contained processing. This separation of execution and presentation architecture ensures that analysis results from different modalities (fNIRS activation maps, EEG topology maps, fMRI activation maps, TMS electric field maps) are all structurally integrated through a unified AST intermediate state, eliminating the differences in traditional multi-device report formats and ensuring that the content structure of digital prescriptions remains consistent across all outputs.

[0077] (2) The mediabag inline resource management mechanism enables zero-manual-intervention chart embedding. Addressing the issue that doctors currently need to manually copy and paste charts into the electronic medical record system, averaging 20-30 minutes per case, Quarto employs Pandoc's mediabag mechanism to manage resources in memory. Visual graphics objects generated during code execution (such as 3D brain functional topography maps, 3D brain mesh objects, waveform objects, functional connectivity matrix diagrams, etc.) are not directly written as disk file references, but are stored in a memory key-value cache via the pandoc.mediabag.insert method, and the content is retrieved during rendering via pandoc.mediabag.fetch. In self-contained mode, binary resources are encoded in Base64 DataURL format (data:{mimeType};base64,{base64Encoded}) and directly embedded into the document stream. This memory object reference mechanism avoids resolution loss and version inconsistency issues during the "generating images → importing documents" process, ensuring high fidelity and reproducibility of charts in digital prescriptions, meeting medical compliance and review requirements.

[0078] (3) A multi-format output registry mechanism supports delivery across multiple clinical scenarios. To address the differentiated report format requirements of various use cases, Quarto defines an independent Format object for each output format, comprising five levels: identifier, rendering configuration, execution configuration, Pandoc parameters, and metadata. The system supports generating multiple delivery formats simultaneously from a single intermediate document: Word documents (.docx) retain complete paragraph styles for physician revision, PDF files are formatted using a LaTeX engine for medical compliance archiving, and HTML online reports include interactive elements such as rotatable 3D mind maps for remote viewing. Different output types use different output recipes to ensure semantic structure (chapter hierarchy, referencing relationships, chart positions) remains consistent across all formats. A single analysis workflow generates multiple output formats, providing users with a consistent digital prescription experience across different clinical scenarios.

[0079] (4) Parameterized injection link enables polymorphic template adaptation. Addressing the shortcomings of existing report templates, which are fixed within the software and cannot adapt to different patients and tasks, Quarto declares parameter interfaces through the `params` field in the YAML frontmatter. External parameters are injected via the command line `--execute-params`, encoded in Base64, and written to environment variables. These parameters are then read by the Pandoc Lua filter and passed to the Python code block. Parameter cells marked with parameter tags within the code block receive the injected values, enabling a single template to dynamically adapt to different subjects and task scenarios. This mechanism eliminates the need for the platform to write separate report templates for each patient or task, achieving polymorphic document generation for "one template for multiple patients," significantly reducing the maintenance cost of the reporting system.

[0080] (5) Single-file integrated architecture solves the problems of version inconsistency and maintenance difficulties. Addressing the version inconsistency issues caused by the scattered storage of data files, analysis scripts, chart files, and report templates in traditional reporting systems, Quarto adopts a single-file integrated architecture design. This architecture encapsulates data preprocessing, statistical analysis, visualization generation, and medical text description within a single executable document file (.qmd format). This single-file integrated architecture works in conjunction with the traceability identifier field: the traceability identifier field records the complete evolution history of data processing, while the single-file architecture achieves complete integrity locking of this history by writing the hash value of the structured intermediate data object and the version identifier of the isomorphic prescription script into the metadata area of ​​the same file. Modification at any stage will result in hash value verification failure, thus achieving full auditability and tamper-proof data processing. The core technologies of this architecture include: an integrated computing container, where a single template file simultaneously carries Python data reading code blocks, signal processing algorithm code blocks, statistical testing code blocks, chart rendering code blocks, and medical interpretation text, avoiding version inconsistencies and maintenance difficulties caused by the scattered storage of data files, analysis scripts, chart files, and report templates in traditional reporting systems; competitive execution engine routing, where code blocks from different languages ​​such as Python, R, and Julia can be mixed within the template. Quarto automatically routes code blocks of each language to the optimal execution environment through an execution engine registration and competitive scoring mechanism, eliminating the need for users to manually manage cross-language call relationships; and a simulated AST extension layer, where Quarto builds a simulated AST layer on top of the Pandoc abstract syntax tree, supporting extended document structure semantics (such as callouts, tabsets, cross-references, etc.) through custom node types, allowing medical report templates to contain rich structured elements without affecting the core rendering pipeline.

[0081] (6) Compliance and reproducibility assurance meet the requirements of medical device review. In response to the stringent requirements of clinical decision-making for the traceability and auditability of reports, the digital prescription template engine meets the compliance review requirements of medical device software (SaMD): the data processing process is fully traceable, with each step from reading raw data to generating the final report being coded and recorded; the analysis parameters are transparent and verifiable, with all preprocessing parameters, statistical test thresholds, and visualization configurations explicitly declared in the template file; the output results are reproducible, with the same input data inevitably producing the same output report under the same template; version locking is supported, with both template files and data files identified by hash values, supporting accurate backtracking of historical prescriptions.

[0082] (7) Quarto offers convenient customization. The platform employs a modular template customization mechanism (partials incremental overlay) and a format extension hook mechanism (formatExtras asynchronous hook), allowing different medical institutions to partially customize report templates according to their own needs (such as modifying header formats, adding or removing indicator fields, and adjusting layout styles) without rewriting the entire template file. Simultaneously, new output formats can be integrated into the core rendering pipeline through registered extension hooks, without requiring modifications to the processing logic of existing formats. This modular architecture enables the platform to meet the specialized customization needs of tertiary hospitals as well as adapt to the standardized reporting scenarios of primary healthcare institutions, forming a universally applicable digital prescription generation solution.

[0083] In practice, the prescription generation layer performs the following sub-steps: (1) A digital prescription template engine is built based on Quarto dynamic document technology: The system pre-loads a set of .qmd format template files, each template file corresponding to a specific detection task or regulation modality. The template file contains a YAML document header (defining metadata and parameterized interfaces), a code block parameter declaration area, an executable code block area, and a Markdown narrative area.

[0084] (2) Using a parameterized rendering mechanism, the structured intermediate data object is injected into the digital prescription template engine: The system uses the YAML format document header as an interface to receive the task context data packet passed by the task configuration layer and maps patient information, analysis results and task parameters into global variables inside the document.

[0085] (3) Trigger the execution of the embedded code block in the template to automatically generate an intermediate document containing medical text descriptions and visual graphic objects: compare the quantitative indicators in the structured intermediate data object with the preset norm threshold in real time, automatically combine medical terms and explanatory text to generate dynamic medical text descriptions; embed the visual graphic objects directly into the intermediate document through the mediabag mechanism to avoid resolution loss caused by intermediate file conversion.

[0086] (4) The Pandoc document converter is invoked to convert the intermediate document into a multi-format report: The intermediate Markdown file generated by the Quarto engine contains the results of the executed code and dynamically generated text. The system invokes the Pandoc document converter to parse the intermediate file into an abstract syntax tree, and maps it to the target delivery format while maintaining the semantic structure of the document: an editable Word document (.docx), a non-editable PDF file, and an HTML online report. The three formats share the same intermediate document source to ensure semantic structure consistency and result reproducibility.

[0087] Taking the report template of the functional near-infrared spectroscopy (fNIRS) speech fluency task (VFT) as an example, the workflow is as follows: (a) YAML header declares parameter interfaces (datapath, subject_id, paradigm, etc.); (b) The first code block declares the parameter receiving point and loads the near-infrared analysis library; (c) The second code block executes the complete data processing pipeline: raw data reading → optical density conversion → calculation of corrected Beer-Lambert law → denoising and baseline correction → block averaging → feature extraction; (d) The third code block formats the extracted feature metrics into a GT table for display; (e) The fourth code block uses seaborn to plot multi-region time series waveforms; (f) The fifth code block calls the nirs2surf surface mapping algorithm to generate a three-dimensional brain functional topography map; (g) Quarto compiles and generates intermediate Markdown, which is then converted by Pandoc into Word / PDF / HTML format.

[0088] The joint encapsulation of the traceability identifier field and hash locking described in this invention specifically includes: After the output layer nodes complete the association and integration of analysis results, the system calculates the SHA-256 hash value of the current structured intermediate data object, and simultaneously reads the version identifier (or file hash) of the complete isomorphic prescription script file on which the object was generated. The above hash value, script version identifier, and traceability identifier chain that runs through the entire process (including input layer source identifier, algorithm identifiers and parameter snapshots at each stage of the processing layer, and runtime environment fingerprint) are written together into the YAML metadata area of ​​the .qmd file.

[0089] The YAML metadata area and the script body together form an indivisible file unit. When a prescription report is opened or re-rendered, the system automatically recalculates the hash value of the current structured intermediate data object and compares it with the hash value stored in the metadata area: if they match, it is marked as "verified"; if they do not match, a warning of "file has been tampered with" is issued. This mechanism ensures the immutable binding relationship between the final generated integrated digital prescription report and the original data, processing parameters, and operating environment.

[0090] The traceability identification chain adopts a blockchain-like chain structure: each processing stage's record entry contains a hash pointer pointing to the previous stage. Any modification in the intermediate link will invalidate all subsequent hash pointers, thus being detectable by the system. This constitutes a complete and auditable chain of evidence from data input to report output, meeting the highest compliance requirements for data processing traceability in Medical Device Software (SaMD).

[0091] Based on the same inventive concept as the foregoing embodiments, this invention also provides a multimodal brain-computer interface digital prescription platform, which is used to implement the above-described method embodiments. The platform includes: a task configuration layer, a computational simulation layer, and a prescription generation layer.

[0092] The task configuration layer is used to write raw data to the central data carrier at the input layer nodes of each pathway. The raw data includes neurometry data from the neurodetection brain-computer interface device and / or neuromodulation data from the neuromodulation brain-computer interface device. As the input control hub of the system, the task configuration layer's specific functions are consistent with those described in step 1 of the aforementioned method embodiment, including: providing a structured parameter input interface and dynamic parameter template loading for the neuromodulation workflow; executing a file suffix recognition and parser routing mechanism for the neurodetection workflow, achieving multi-format data access through a modality-parser mapping table; providing a structural magnetic resonance imaging (MRI) data upload and parsing channel, and adaptively labeling individualized simulation modes or standard brain simulation modes.

[0093] The computational simulation layer is used to standardize the raw data at the processing layer nodes of each pathway, including: when the raw data is neural measurement data, performing corresponding preprocessing, key indicator extraction and visualization result generation according to the modality type; when the raw data is neural modulation data, performing parameter parsing and recording; and writing the analysis results after processing to the output layer nodes of the same pathway, and maintaining the source identification update of the data at each processing stage. The specific functions of the computational simulation layer are consistent with those described in step 2 of the aforementioned method embodiment, including: for the neuromodulation workflow, routing to the physical field simulation engine according to the modulation mode (TMS calls SimNIBS to solve the induced electric field using the A-phi formula; tES solves the Poisson equation; TUS calls k-Wave to calculate the sound field distribution), generating a three-dimensional electric field / sound field distribution mesh object and writing it to the output layer node of the same path; for the neurodetection workflow, executing task-specific processing procedures according to the modality type (fNIRS performs optical density conversion, corrected Beer-Lambert law calculation and nirs2surf surface mapping; EEG performs resampling, filtering, ICA artifact removal and spherical harmonic interpolation; fMRI performs head motion correction, time-layer correction, magnetic field inhomogeneity correction, spatial normalization and single interpolation resampling strategy, generating brain region activation heatmap objects or functional connectivity matrix objects according to the task state or resting state respectively), all processing procedures load corresponding exclusive processing parameters and algorithm configurations according to the experimental task type selected by the user in the task configuration layer.

[0094] The prescription generation layer is used to acquire and integrate analysis results at the output layer nodes of each pathway, generate structured intermediate data objects, and call the Pandoc document converter to convert the structured intermediate data objects into an integrated digital prescription report in the target delivery format. The traceability identifier chain and the structured intermediate data objects are then encapsulated together in the final digital prescription report. The specific functions of the prescription generation layer are consistent with those described in step 3 of the aforementioned method embodiment, including: constructing a digital prescription template engine based on Quarto dynamic document technology; injecting patient information, analysis results, and task parameters into the template engine using a parametric rendering mechanism, triggering the execution of embedded code blocks within the template, and automatically generating an intermediate document containing medical text descriptions and visual graphical objects; and calling the Pandoc document converter to convert the intermediate document into a report in the target delivery format (Word document, PDF file, or HTML report). The automatic generation of medical text descriptions is achieved by comparing quantitative indicators with preset norm thresholds in real time and automatically combining medical terminology and explanatory text; the visual graphical objects are directly embedded into the intermediate document through memory object references.

[0095] The computational simulation layer is also used to execute physical field simulation logic based on the received individualized structural magnetic resonance data or standard brain templates: for transcranial magnetic stimulation or transcranial electrical stimulation, a finite element model of the patient's head or standard brain is constructed to calculate the electric field distribution of the neuromodulation device in the brain; for transcranial ultrasound stimulation, an acoustic propagation model is constructed to calculate the sound field distribution of ultrasound waves in the brain; the simulation generates a three-dimensional brain mesh object with a three-dimensional electric field or sound field distribution and writes it into the output layer node of the same pathway, which is then passed to the prescription generation layer.

[0096] This invention also provides an integrated digital prescription report generated by the above-mentioned multimodal brain-computer interface digital prescription platform for use in at least one of the following data processing scenarios: Application scenario (a): Clinical specialty disease diagnosis and treatment auxiliary decision-making By integrating the neuro-detection brain-computer interface brain function decoding indicators and neuro-modulation brain-computer interface stimulation parameters in the integrated digital prescription report, structured data for characterizing disease quantitative screening and assessment grading is generated, and brain function-specific correlation mechanisms are analyzed to generate structured data for characterizing neuro-modulation target recommendations.

[0097] Specifically, targeting mental health disorders (such as depression and anxiety), childhood developmental disorders (such as autism spectrum disorder (ASD) and attention deficit hyperactivity disorder (ADHD), or neurorehabilitation disorders (such as post-stroke cognitive impairment), the platform integrates brain function decoding results from fNIRS, EEG, or fMRI with treatment parameters from TMS and tES. The generated digital prescriptions include quantitative screening indicators (such as brain region activation intensity and frequency band power values) and assessment grading conclusions, allowing physicians to make differential diagnoses. Simultaneously, by analyzing brain function-specific correlation mechanisms, the platform generates precise neuromodulation target recommendations within the digital prescriptions for clinicians' reference.

[0098] Application scenario (b): Closed-loop brain-computer interface and personalized treatment Based on the integrated digital prescription report, structured data for characterizing regulatory site recommendations is generated, data correlation analysis of the treatment process is performed, and structured data for characterizing the comparison of efficacy before and after treatment is generated.

[0099] Specifically, before treatment, the platform generates recommended information on regulatory sites (TMS, tDCS) based on the results of neurometric data (fNIRS, EEG), which is used by clinicians to develop individualized treatment plans. During treatment, the platform connects to the parameters of the neuromodulation device and performs correlation analysis with short-term monitoring data after treatment (such as changes in EEG spectrum within 24 hours). After treatment, the platform generates quantitative indicator change data (such as the blood oxygen recovery rate of specific brain regions and the improvement in cognitive task performance) by comparing a series of digital prescriptions before, during, and after treatment, providing a data-driven basis for clinicians to dynamically optimize intervention strategies.

[0100] Application scenario (c): Standardization and management of multimodal scientific research data The platform's computational simulation layer performs unified preprocessing and index extraction on brain function data from different manufacturers and modalities, generating digital prescription reports for research purposes to construct a multimodal brain function database.

[0101] Specifically, addressing the challenge of heterogeneous and multi-source equipment in brain science research, the platform employs a built-in standardized processing workflow to ensure that brain function data from different manufacturers and modalities undergo unified preprocessing and indicator extraction, generating comparable digital prescriptions for research. These digital prescriptions facilitate the construction of a high-quality, structured multimodal brain function database, providing a reliable data foundation for brain function decoding, disease mechanism research (such as brain function-specific correlation mechanisms), and the development of novel neuromodulation modules and brain functional imaging algorithms.

[0102] Application scenario (d): Health management for the entire population Through cloud deployment or standardized reporting interfaces, the structured assessment conclusions and historical tracking data in the integrated digital prescription report are output to generate health management recommendations.

[0103] Specifically, the platform will cloudify its core analytics engine or provide standardized reporting interfaces to assist primary healthcare institutions in interpreting complex brain function test results. Based on structured assessment conclusions and historical tracking data from digital prescriptions, the platform generates structured health management information, which healthcare professionals can use to form final health management recommendations in conjunction with clinical judgment. This supports residents in conducting self-health management and can be applied to long-term follow-up and rehabilitation guidance after chronic disease screening.

[0104] In the above-mentioned clinical specialty diagnosis and treatment auxiliary decision-making, the neurological diseases include mental health diseases, childhood developmental diseases or neurorehabilitation diseases, the output brain-computer interface devices include functional near-infrared spectroscopy devices, electroencephalography devices or functional magnetic resonance imaging devices, and the input brain-computer interface devices include transcranial magnetic stimulation devices or transcranial electrical stimulation devices.

[0105] In summary, to address the problems of severe data silos, lack of reporting systems, insufficient clinical decision support, and inability to support multimodal closed-loop collaborative clinical pathways in existing brain-computer interface technologies, this invention provides a multimodal brain-computer interface digital prescription generation method and platform, the key points of which are: (I) Multimodal data fusion architecture This invention provides a unified multimodal data fusion architecture capable of simultaneously receiving, parsing, and processing heterogeneous raw data from various neurometric techniques (output-based BCIs, such as fNIRS, EEG, fMRI, etc.) and neuromodulation techniques (input-based BCIs, such as TMS, tES, etc.). This architecture solves the problems of data silos and inconsistent standards among multiple devices, providing a unified data foundation for subsequent cross-modal analysis.

[0106] (ii) Automated processing pipelines This invention employs an automated data processing method built upon open-source toolkits (such as Python). For each input modality, this method automatically executes standardized preprocessing, indicator extraction, and visualization pipelines, achieving efficient and automated transformation from raw data to result indicators. This processing pipeline is repeatable, ensuring the consistency and reliability of the analysis results.

[0107] (III) Report Generation Logic This invention employs a technical architecture that separates data analysis from report presentation. Specifically, diverse analytical results (including quantitative indicators and result charts) are passed from the data processing end (such as Python scripts) to a unified report generation engine (such as Quarto). This logic ensures that heterogeneous results can be programmatically and flexibly integrated into the same report template, achieving decoupling between data processing and report generation.

[0108] (iv) Integrated digital prescription design This invention ultimately generates an integrated digital prescription report structure. This structure integrates separate detection results (such as brain activation maps), regulatory records (such as stimulation parameters), and analytical conclusions into a unified report, providing clinicians with systematic assessment evidence and longitudinal medical record management tools, and solving the problem of difficulty in linking multiple traditional reports.

[0109] (v) Flexible output in multiple formats This invention is based on a single analysis workflow and can generate reports in multiple output formats. Specifically, these include: editable Word documents (for personalized modifications by physicians), standardized PDF documents (for standardized archiving), and HTML online reports (for convenient viewing and remote interaction). This design adapts to different clinical and research application scenarios.

[0110] (vi) Scalable and cross-scenario applicable architecture This invention employs a modular and scalable design, including a rapid access mechanism for adding new neuroimaging or stimulation devices, as well as extended interfaces for report templates and algorithm modules. This architecture supports applications in multiple scenarios such as scientific research, educational screening, and mental rehabilitation, forming a general platform solution for multimodal brain-computer interface systems in clinical and research settings.

[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating digital prescriptions using a multimodal brain-computer interface, characterized in that, It is implemented based on a set of isomorphic prescription scripts, each script embeds the same prescription context data object as the central data carrier; the data information carried in the central data carrier evolves unidirectionally in 6 isomorphic prescription pathways along a three-layer data structure of input layer, processing layer and output layer; the prescription context data object contains a traceability identifier field, which passively inherits the source identifier, processing parameters and environmental fingerprint at each stage and automatically adds processing records to form an auditable traceability chain; The six isomorphic prescription pathways include three regulatory prescription pathways and three detection prescription pathways; The method includes: Raw data is written to the central data carrier at the input layer nodes of each pathway, and a corresponding source identifier is generated for each piece of raw data. The raw data includes neurometric data and / or neuromodulation data. The raw data is standardized at the processing layer nodes of each pathway, and the algorithm identifier, parameter snapshot, and environmental fingerprint are automatically appended to the traceability identifier field after processing. When the raw data is neural measurement data, the corresponding preprocessing, key indicator extraction, and visualization result generation are performed according to the modality type. When the raw data is neural modulation data, the parameters are parsed and recorded. The analysis results after processing are written to the output layer nodes of the same pathway. The analysis results are obtained and integrated at the output layer nodes of each channel to generate a structured intermediate data object. The hash value of the object and the version identifier or hash value of the corresponding script are written into the metadata area of ​​the same file, so that the final report forms an immutable binding relationship with the original data, processing parameters, and running environment. The Pandoc document converter is invoked to convert the structured intermediate data object into an integrated digital prescription report in the target delivery format.

2. The method for generating a digital prescription using a multimodal brain-computer interface according to claim 1, characterized in that, During the standardization of raw data at each processing layer node of each pathway, when the raw data is neural measurement data, a task-specific processing flow is executed according to the modality type and experimental task type: When the neurometric data is functional near-infrared spectral data, the near-infrared analysis library is called to perform optical density conversion and Beer-Lambert law correction calculation. After denoising and baseline correction, the integral value, mean, peak value and centroid slope during the task period are extracted as activation intensity indicators. The activation intensity is then mapped to the cortical grid using a surface mapping algorithm to generate a three-dimensional brain functional topography object. When the neurometric data is EEG data, the EEG analysis library is called to perform resampling, filtering, independent component analysis to remove artifacts and bad lead interpolation. Based on event-related potential markers, segmentation and superposition averaging are performed to extract the amplitude peak and latency of event-related potential components in the region of interest. The discrete scalp electrode data is interpolated to a continuous scalp projection plane using the spherical harmonic interpolation method to generate a two-dimensional EEG topology map object and a region of interest average waveform map object. When the neurometric data is functional magnetic resonance imaging (fMRI) data, the fMRI preprocessing toolkit is invoked to perform head motion correction, time-layer correction, magnetic field inhomogeneity correction, spatial registration, and standardization to standard space. A single interpolation resampling strategy is used to concatenate multiple transformation matrices and perform only one interpolation operation. Based on the preprocessed data, brain region activation heatmap objects or functional connectivity matrix objects are generated according to task state or resting state, respectively. The processing flow loads corresponding exclusive processing parameters and algorithm configurations according to the user's preset experimental task type. Different task types correspond to different preprocessing parameters, indicator extraction time windows, and result interpretation rules.

3. The method for generating a digital prescription using a multimodal brain-computer interface according to claim 1, characterized in that, The Pandoc document converter is invoked to convert the structured intermediate data object into an integrated digital prescription report in the target delivery format, including: A digital prescription template engine built based on Quarto dynamic document technology; Using a parametric rendering mechanism, the structured intermediate data object is injected into the digital prescription template engine, triggering the execution of the embedded code block in the template, and automatically generating an intermediate document containing medical text descriptions and visual graphic objects; The Pandoc document converter is invoked to convert the intermediate document into a report in the target delivery format.

4. The method for generating a digital prescription using a multimodal brain-computer interface according to claim 3, characterized in that, Automatically generate intermediate documents containing medical text descriptions and visual graphical objects, including: The quantitative indicators in the structured intermediate data object are compared with preset norm thresholds in real time, and medical terms and explanatory text are automatically combined to generate dynamic medical text descriptions; and, The visual graphic object is directly embedded into the intermediate document using a memory object reference method.

5. The method for generating a digital prescription using a multimodal brain-computer interface according to claim 1, characterized in that, The standardization process of the raw data at each processing layer node also includes a physical field simulation step: The system receives individualized structural magnetic resonance imaging (SMRI) data or a standard brain template and executes physical field simulation logic based on the modulation mode: for transcranial magnetic stimulation (TMS) or transcranial electrical stimulation (TES), it constructs a finite element model of the patient's head or a standard brain and calculates the electric field distribution of the neuromodulation device in the brain; for transcranial ultrasound stimulation (TES), it constructs an acoustic propagation model and calculates the sound field distribution of ultrasound waves in the brain; the simulation steps generate a three-dimensional brain mesh object with a three-dimensional electric field or sound field distribution and write it into the output layer node of the same pathway.

6. A multimodal brain-computer interface digital prescription platform, characterized in that, The platform for performing the method as described in any one of claims 1 to 5 includes: The task configuration layer is used to write raw data to the central data carrier at the input layer nodes of each pathway. The raw data includes neurometric data from the neurodetection brain-computer interface device and / or neuromodulation data from the neuromodulation brain-computer interface device. The computational simulation layer is used to standardize the raw data at the processing layer nodes of each pathway, including: when the raw data is neural measurement data, performing corresponding preprocessing, key indicator extraction and visualization result generation according to the modality type; when the raw data is neural modulation data, performing parameter parsing and recording; and writing the analysis results after processing to the output layer nodes of the same pathway and maintaining the source identification update of the data at each processing stage. The prescription generation layer is used to obtain and integrate the analysis results from the output layer nodes of each pathway, generate structured intermediate data objects, and call the Pandoc document converter to convert the structured intermediate data objects into an integrated digital prescription report in the target delivery format. The traceability identification chain and the structured intermediate data objects are then encapsulated together in the final digital prescription report.

7. A multimodal brain-computer interface digital prescription platform according to claim 6, characterized in that, The prescription generation layer is also used for: A digital prescription template engine built based on Quarto dynamic document technology; Using a parameterized rendering mechanism, patient information, the analysis results, and task parameters obtained through the task configuration layer are injected into the digital prescription template engine, triggering the execution of the embedded code block in the template, and automatically generating an intermediate document containing medical text descriptions and visual graphic objects; The Pandoc document converter is invoked to convert the intermediate document into a report in the target delivery format.

8. A multimodal brain-computer interface digital prescription platform according to claim 6, characterized in that, During the standardization process of the raw data at each processing layer node of the computational simulation layer, when the raw data is neural measurement data, a task-specific processing flow is executed according to the modality type and experimental task type: When the neurometric data is functional near-infrared spectral data, the near-infrared analysis library is called to perform optical density conversion and Beer-Lambert law correction calculations. After denoising and baseline correction, activation intensity indicators are extracted and a three-dimensional brain functional topography object is generated. When the neurometric data is electroencephalogram (EEG) data, the EEG analysis library is called to perform resampling, filtering, independent component analysis to remove artifacts and bad lead interpolation, extract event-related potential component indicators and generate a two-dimensional EEG topology map object. When the neurometric data is functional magnetic resonance imaging data, the functional magnetic resonance preprocessing toolkit is invoked to perform head motion correction, temporal correction and spatial normalization. Based on the preprocessed data, brain region activation heatmap objects or functional connectivity matrix objects are generated according to task state or resting state. The computational simulation layer loads corresponding dedicated processing parameters and algorithm configurations based on the experimental task type selected by the user during the task configuration phase. Different task types correspond to different preprocessing parameters, index extraction time windows, and result interpretation rules.

9. A multimodal brain-computer interface digital prescription platform according to claim 6, characterized in that, The computational simulation layer, during the standardization process of the raw data at each processing layer node of each pathway, is also used for: Based on the received individualized structural magnetic resonance data or standard brain template, physical field simulation logic is executed: for transcranial magnetic stimulation or transcranial electrical stimulation, a finite element model of the patient's head or standard brain is constructed, and the electric field distribution of the neuromodulation device in the brain is calculated; for transcranial ultrasound stimulation, an acoustic propagation model is constructed, and the sound field distribution of ultrasound waves in the brain is calculated; the physical field simulation logic steps generate a three-dimensional brain mesh object with a three-dimensional electric field or sound field distribution, and write it into the output layer node of the same pathway, and pass it to the prescription generation layer.

10. A multimodal brain-computer interface digital prescription platform according to claim 6, characterized in that, The integrated digital prescription report generated by the prescription generation layer is used in at least one of the following data processing scenarios: By integrating the neuro-detection brain-computer interface brain function decoding indicators and neuro-modulation brain-computer interface stimulation parameters in the integrated digital prescription report, structured data for characterizing disease quantitative screening and assessment grading is generated, and brain function-specific correlation mechanisms are analyzed to generate structured data for characterizing neuro-modulation target recommendations. Based on the integrated digital prescription report, structured data for characterizing regulatory site recommendations is generated, data correlation analysis of the treatment process is performed, and structured data for characterizing the comparison of efficacy before and after treatment is generated; The computational simulation layer of the platform performs unified preprocessing and index extraction on brain function data from different manufacturers and modalities to generate digital prescription reports for research, thereby constructing a multimodal brain function database. Through cloud deployment or standardized reporting interfaces, the structured assessment conclusions and historical tracking data in the integrated digital prescription report are output to generate health management recommendations.