System for drawing and analyzing electrocardiogram in real time
By designing a system for real-time drawing and analyzing ECG, using Bluetooth transmission data and analysis tools developed in Java, the existing ECG software cannot meet the needs of complex data processing and timeliness, real-time acquisition of ECG data and multiple analysis functions are realized, reducing costs and improving analysis accuracy.
Patent Information
- Application Number
- CN202510028162.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-03-14
AI Technical Summary
Existing electrocardiogram mapping software cannot meet the medical community's demand for complex electrocardiogram data processing and analysis, and mainstream electrocardiogram mapping software on the market needs to collect fixed time data, which cannot meet the timeliness needs.
A system for real-time drawing and analysis of electrocardiograms is designed, and real-time reading and analysis of electrocardiogram data is realized by receiving Bluetooth transmission data from electrocardiogram devices. The system includes ECG data acquisition equipment, Bluetooth scanning connection module, real-time data processing and analysis tool module and user interface module. It is developed in Java language, based on the Android Studio platform, and supports Android 11 and higher versions and Harmony OS 1.0 and higher versions.
Real-time acquisition and analysis of ECG data is realized, and a variety of analysis tools are provided, such as heart rate analysis, ST segment analysis, arrhythmia detection and ECG feature extraction. It can perform custom analysis based on the parameters entered by the user, reducing the procurement cost of ECG monitoring equipment and improving the flexibility and accuracy of analysis.
Abstract
Description
Technical Field
[0001] The invention belongs to the field of biomedicine and engineering, and is specifically a system for drawing and analyzing an electrocardiogram in real time. Background Art
[0002] In the medical field, electrocardiogram (ECG) is one of the important tools for evaluating heart function and diagnosing heart disease. Traditional ECG drawing and analysis usually rely on professional equipment and software, which are complex and costly. Traditional software usually needs to run on specific operating systems and hardware platforms, which limits its flexibility and scalability. In addition, the functions of traditional software are relatively limited and cannot meet the medical community's needs for complex ECG data processing and analysis.
[0003] In recent years, with the development of computer technology, software has played an increasingly important role in medical diagnosis and research. Software developed based on Java has the advantages of cross-platform and flexibility, can run on different operating systems, and has good user interface design and user experience. Therefore, the application of Java technology in the development of electrocardiogram drawing and analysis software has important significance and potential market prospects.
[0004] However, the mainstream ECG drawing software on the market is based on watches, bracelets, etc., which require the collection of data for a fixed period of time for sampling and analysis, and the data accuracy is very low. It is difficult to meet the timeliness requirements for heart monitoring. Therefore, it is necessary to provide a more advanced and convenient solution to meet the medical community's needs for preliminary processing and analysis of ECGs, and promote the convenience and accuracy of pre-hospital diagnosis of heart problems. Summary of the invention
[0005] The present invention provides a system for drawing and analyzing an electrocardiogram in real time. The system realizes the reading of electrocardiogram data by receiving Bluetooth transparent transmission data of an electrocardiogram device. The specific technical scheme is as follows: A system for drawing and analyzing an electrocardiogram in real time comprises an electrocardiogram data acquisition device, a Bluetooth scanning connection module, a real-time data processing and analysis tool module and a user interface module; the electrocardiogram data acquisition device is used to collect the electrocardiogram data of the user; the real-time data processing and analysis tool module communicates with the electrocardiogram data acquisition device via the Bluetooth scanning connection module, receives the electrocardiogram data stream transmitted by the electrocardiogram data acquisition device in real time, draws the electrocardiogram waveform in real time according to the data stream, and performs real-time filtering and real-time analysis on the electrocardiogram signal; the user interface module is used to display the electrocardiogram signal data on the user interface.
[0006] Preferably, the analysis tool module includes a variety of analysis tools, including but not limited to heart rate analysis, ST segment analysis, arrhythmia detection, and electrocardiogram feature extraction.
[0007] Preferably, the analysis tool module can perform customized analysis according to parameters input by the user to meet the specific needs of different users.
[0008] Preferably, the analysis tool is developed in Java language based on the Android Studio platform and can be adapted to Android 11 and higher versions, and Harmony OS 1.0 and above.
[0009] Preferably, the ECG data acquisition device includes but is not limited to an ECG data acquisition system based on the BMD101 chip, which is suitable for all devices developed based on the UART interface, and the data packet format is defined as 1 start bit, 8 data bits, 1 stop bit format, and the baud rate is 57600.
[0010] Preferably, the real-time ECG data drawing adopts a two-way scrolling drawing method, that is, when the next data is input, the previous data is scrolled out of the screen, so as to achieve the effect of dynamic ECG drawing.
[0011] Preferably, the interface of the user interface module is divided into two parts, namely a Bluetooth scanning interface and a drawing analysis interface. The Bluetooth scanning interface adopts a click-to-auto connection method, and the drawing analysis interface adds an interface to start and stop electrocardiogram drawing.
[0012] Preferably, the analysis tool uses a window sliding algorithm to process the data stream. In the initialization phase of the window sliding algorithm, a double-ended queue is pre-allocated to store the maximum or minimum value in the current window. When the window slides, the maximum or minimum value stored in the double-ended queue is used for comparison operations.
[0013] Preferably, the analysis tool uses a window sliding algorithm to process the data stream, and the window sliding algorithm uses multiple cores or GPUs to allocate multiple processing units during initialization to synchronously perform operations on multiple sliding windows.
[0014] Preferably, the analysis tool uses a window sliding algorithm to process the data stream and introduces a multi-level sub-window structure when extracting window data.
[0015] The steps of using the system of the present invention are as follows: (1) Location permission, Bluetooth usage permission check and request; (2) Bluetooth scanning to obtain the corresponding Bluetooth module connection permission; (3) Connect to the ECG detection hardware and send data through the hardware; (4) The software draws the ECG waveform in real time, filters in real time, and performs real-time analysis on the ECG signal.
[0016] The present invention has the following further features and functions in achieving electrocardiogram drawing and analysis: 1. Real-time data acquisition function: The system of the present invention can not only acquire the ECG data of the matching flexible ECG monitor in real time, but also has data buffering and processing functions to ensure the stability and accuracy of the data. The system of the present invention also has automatic connection and disconnection functions, which can automatically detect the connection status of the ECG sensor or device and perform corresponding operations.
[0017] 2. Analysis function: The system of the present invention transfers the heart health analysis function realized by traditional computers to mobile phones through a self-written window moving algorithm, and transplants abnormal detection methods such as QRS splitting, abnormal ST elevation, and abnormal P wave to mobile phones. Compared with sports health software on mobile phones, the software can detect and identify signs of diseases such as arrhythmia and myocardial ischemia at the medical level. The module also has a real-time monitoring function, which can scroll and draw pictures like medical equipment, continuously monitor electrocardiogram data and automatically alarm to remind users to pay attention to potential abnormalities so that they can respond at the first time of onset.
[0018] Compared with traditional electrocardiogram equipment and software, the present invention has the following advantages: 1. Low cost: No expensive equipment is needed. Only a flexible ECG signal collector (3 square centimeters in size) and the software are needed to draw and analyze the ECG, which reduces the purchase cost of application monitoring equipment and better serves the public.
[0019] 2. Strong flexibility: Developed in Java, it has good cross-platform capabilities and can run on different operating systems and hardware platforms, which improves the usability and flexibility of the software.
[0020] 3. Rich functions: It provides a variety of analysis tools to meet the needs of different users, bringing the ECG analysis on mobile phones to clinical level, which can be applied to multiple fields such as clinical preliminary diagnosis, scientific research exploration and development.
[0021] 4. Algorithm innovation: The window moving algorithm is innovatively applied to the data processing of portable ECG devices, making real-time analysis of ECG data possible and greatly improving the analysis speed. Based on the sliding window mechanism, the key elements include window, window step, and comparison operation. The following steps are included: define the window size and step, set the initial position; extract a subsequence with a length of the window size at the current position of the data sequence; perform comparison operations on the data in the window, such as finding the maximum value, minimum value, or average calculation; record the comparison results; move the window forward according to the step, and repeat the above steps to traverse the entire data sequence, and finally output the comparison results of all windows. DETAILED DESCRIPTION
[0022] The software of the system in this embodiment is developed in the Java programming language and can be run on various brands of mobile phones and various operating systems, including Android, Harmony OS, etc. It utilizes the cross-platform characteristics of Java, allowing users to easily use the software in different environments.
[0023] Architecture design: The software adopts a modular architecture design, which is divided into multiple modules, including ECG data acquisition equipment, Bluetooth scanning connection module, real-time data processing and analysis tool module and user interface module. The modules communicate and interact through clearly defined interfaces. The front-end design is simple and suitable for emergency situations and middle-aged and elderly users.
[0024] ECG data acquisition device: This module is responsible for communicating with ECG sensors or devices and receiving ECG data streams in real time. The module supports UART interface and baud rate of 57600. All ECG monitoring instruments that comply with the data transmission protocol can use this software for ECG data visualization analysis. The module also has error handling and data verification functions to ensure data integrity and accuracy.
[0025] Real-time data processing and analysis tool module: The data processing module receives the ECG data from the ECG data acquisition device, performs preprocessing and filtering operations to remove noise and interference, and improve the quality and reliability of the data. The module can also monitor the ECG data stream in real time, identify arrhythmias and abnormal conditions, and perform corresponding processing and alarms. In the analysis part, the module integrates various ECG analysis algorithms and models, including the window sliding algorithm creatively applied to ECG equipment. These analysis tools can be competent for a variety of analysis tasks, including heart rate analysis, ST segment analysis, QRS waveform feature extraction, etc. The module can perform intelligent analysis and diagnosis of ECG data, automatically identify signs of diseases such as arrhythmias and myocardial ischemia, and generate corresponding analysis reports. The analysis module uses a window sliding algorithm for ST segment analysis, QRS waveform feature extraction and other analyses. The window sliding algorithm is an algorithm used to compare data within a sliding window. It is often used in signal processing, image processing, pattern recognition and other fields, and is particularly suitable for processing data scenarios that require local comparison. The core idea of the algorithm is to compare data one by one within a window of fixed length, and output the results or use them for subsequent processing.
[0026] 1. Basic Concepts of Algorithms The window sliding algorithm is based on the sliding window mechanism and mainly includes the following key elements: Window: In a data sequence, a fixed-size window is defined, which is used to perform local sampling and comparison of data; Window stride: The step size of the window sliding in the data sequence, that is, the distance the window moves each time, which can be 1 (moving element by element) or a larger step size; Comparison operation: Perform some type of comparison operation within the window. Common comparisons include maximum, minimum, average, variance, mean difference, etc. Output results: After each window movement, the comparison result is output as a new data point to form a new sequence.
[0027] 2. Algorithm Process Initialization: define the window size and step size, and set the initial position; Extract window data: extract a subsequence with a length of the window size at the current position of the data sequence; Comparison operation: compare the data in the window, such as finding the maximum value, minimum value, or calculating the average value; Record results: record the results of the comparison; Window movement: according to the step size, the window is moved forward, and the steps of extracting window data, comparing operations, and recording results are repeated until the entire data sequence is traversed; Output results: Finally, the comparison results of all windows are output.
[0028] 3. Application Scenarios The window sliding algorithm is applicable to a variety of scenarios. The following are some common application areas: Signal processing: Calculate the average value or detect the peak value within the window of time series signals for filtering or feature extraction; Image processing: comparison within local areas of an image, such as edge detection within a sliding window, template matching, noise suppression, etc. Pattern recognition: used to detect local patterns or features in a sequence; Data analysis: In time series, use the maximum, minimum, or average value within a window to perform trend analysis or anomaly detection.
[0029] 4. Innovation and Optimization In the present invention, the following innovative strategies are adopted for the algorithm: Sliding window optimization: Use the result of the previous calculation to reduce the repeated operations of the current calculation, such as using a double-ended queue (Deque) to efficiently maintain the maximum or minimum value; Parallel processing: Parallel processing in a multi-core or GPU environment to speed up comparison; Multi-layer window: Use nested comparison of multiple windows to retain local information while capturing global information in a larger range.
[0030] 5. Innovation in Cardiac Waveform Analysis 1. Window sliding algorithm detection principle of QRS complex The application of sliding window algorithm in ECG analysis is based on comparing local changes of data one by one with sliding window to identify the characteristics of QRS complex; the following are the basic steps to detect QRS complex: Signal preprocessing: First, the ECG signal is preprocessed, including filtering and normalization, to remove baseline drift, power frequency interference, and myoelectric noise; Window setting: define an appropriate window size W and step size S. The window size is generally set according to the duration of the QRS complex, usually 100-200 ms; Local peak detection: Find the maximum and minimum values in each window and calculate the amplitude change in the window: ΔA=max (X [i:i+W−1] )−min (X [i:i+W−1] ), where X [i:i+W−1] represents the signal value within the window, and ΔA represents the amplitude difference; QRS discrimination threshold setting: set an amplitude threshold TA according to the characteristics of the QRS complex; if ΔA>TA, it is determined that there is a QRS complex in the window; Peak location and split detection: Further analysis of the detected QRS complex. If multiple peaks are detected within a short period of time, it is considered QRS fragmentation. QRS splitting refers to the phenomenon of multiple peaks in a single QRS complex, which usually indicates abnormal conduction within the ventricles and is an important indicator in the diagnosis of heart disease. The window sliding algorithm detects QRS splitting through the following steps: Set a shorter sliding window: Based on the preliminary detection of the QRS complex, narrow the window to 20-50 ms to detect multiple local peaks within the QRS complex; Calculate the local amplitude change: In the reduced window, calculate the local amplitude change of each sub-window: ΔA j =max(X [i+j:i+j+Wj−1] )−min (X [i+j:i+j+Wj−1] ), where W j For a smaller sub-window size, ΔA j Represents the amplitude difference within the subwindow; Split judgment threshold: If there are two or more sub-windows satisfying ΔA in a QRS complex j >T F , it is determined to be QRS splitting, where T F is the split decision threshold.
[0031] 2. Window sliding algorithm to analyze T wave elevation Window settings include: In ECG analysis, the window length of the window sliding algorithm needs to be set according to the duration of the T wave, usually 200-400 ms. The step size is adjusted according to the heart rate and signal sampling frequency, and a smaller step size (such as 1 sampling point) is generally selected to ensure accurate detection of T wave changes.
[0032] The steps for detecting a window with elevated T waves include: Signal preprocessing: Filter, denoise and normalize the ECG signal to reduce interference and improve the accuracy of T wave detection.
[0033] Sliding window extraction: Set the sliding window size to W T , the step length is S T ; On the ECG signal sequence X, each extraction length is W T Signal segment: X window =X [i:i+WT−1] .
[0034] Calculation of maximum and minimum values within the window: In each window, the maximum and minimum values of the T wave are calculated: T max =max(X window ), T min =min(X window ); Calculate the change in T wave amplitude within this window: ΔT=T max −T min .
[0035] T wave elevation determination: Set the T wave elevation threshold T threshold If ΔT>T threshold , it is considered that the T wave is elevated; The sharpness of the T wave can be further tested to determine whether the T wave is peaked or broad-based. Peaked T waves are usually accompanied by rapid rise and fall, which can be evaluated by calculating the rise and fall speed within the window: Slope up =(T peak −T base ) / (t peak −t base ) where T peak and T base are the peak value and baseline value of the T wave, t peak and t base The corresponding time point.
[0036] T wave segmentation analysis and feature extraction: The window sliding algorithm can detect different parts of the T wave in segments, such as the rising segment, peak segment, and falling segment of the T wave. By comparing the windows of each segment, the morphological changes of the T wave can be judged more accurately.
[0037] 3. Detecting arrhythmias using a sliding window algorithm The occurrence of arrhythmia is often accompanied by abnormal changes in the waveform of the electrocardiogram, especially in the context of elevated T waves, which may trigger specific types of arrhythmias. The window sliding algorithm can be used to monitor the changes in the T wave in real time and associate it with the characteristic waveform of the arrhythmia.
[0038] Long QT syndrome (LQTS) is a type of arrhythmia characterized by a prolonged QT interval. The window sliding algorithm can be used to calculate the QT interval in each window in real time and combine it with the amplitude change of the T wave to comprehensively evaluate whether LQTS exists. interval = T tend − Q start Among them, T tend is the end time of T wave, Q start is the Q wave start time.
[0039] If the QT interval exceeds the normal threshold and the T wave is significantly elevated, one should be alert to the risk of LQTS.
[0040] The following is a further description of the window sliding algorithm: 1. QRS complex window sliding algorithm detection principle Signal preprocessing: During filtering and normalization, a parallel processing strategy can be used to distribute filtering and normalization operations to multiple cores or GPUs for parallel computing, thereby improving the preprocessing speed.
[0041] Window settings: Sliding window optimization: Set the sliding window size to 100-200 ms, and use a double-ended queue (Deque) to dynamically maintain the maximum and minimum values in the window based on the step size S to avoid repeated scanning of all data in the window during each calculation.
[0042] Parallel processing: During the detection process, different processing units can be assigned to different sliding window instances, so that multiple windows can be calculated in parallel to increase the detection speed.
[0043] Local peak detection: Sliding window optimization: When calculating the amplitude change ΔA, only the newly added and removed elements in the window need to be updated, and a double-ended queue is used to effectively manage the maximum and minimum values in the window, thereby reducing repeated calculations.
[0044] Multi-layer window: A multi-layer window structure can be introduced at the same time. The first window detects the global characteristics of the QRS complex, and the second window is used for more fine-grained local change analysis to more accurately detect the splitting phenomenon.
[0045] Peak location and split detection: Setting a shorter sliding window: When the window is reduced to 20-50 ms, a nested multi-layer window structure is used to detect multiple local peaks to ensure that QRS splitting can be identified.
[0046] Multi-layer windows: Utilize the nested structure of multi-layer windows to further accurately locate the peaks detected locally, and use smaller sub-windows for detailed analysis.
[0047] 2. Analysis of the sliding window algorithm for T wave elevation Signal preprocessing: Similar to the detection of QRS complexes, a parallel processing strategy can be used in the signal preprocessing stage to improve the efficiency of filtering and normalization.
[0048] Window settings: Sliding window optimization: Set the window size to 200-400 ms. Based on the step size ST, use a double-ended queue to manage the maximum and minimum values within the window to reduce the number of scans of the entire window.
[0049] Parallel processing: Multiple sliding windows simultaneously perform T wave elevation detection, using parallel processing to improve detection efficiency.
[0050] Multi-layer window: Different window levels can be used, one for detecting the overall morphology of the T wave and another for detecting local changes in the T wave.
[0051] T wave elevation detection: Sliding window optimization: When calculating the amplitude change ΔT of the T wave, a double-ended queue is used to maintain the maximum and minimum values within the window. Only the elements at the window boundary need to be updated without rescanning the entire window each time.
[0052] Multi-layer window: Use different windows to analyze the rising, peak, and falling segments of the T wave to more accurately detect changes in T wave morphology.
[0053] T wave segmentation analysis and feature extraction: Multi-layer window: Using a multi-layer window structure, the different stages of the T wave can be carefully segmented and analyzed to accurately extract the characteristic changes of the T wave.
[0054] 3. Detecting arrhythmias using a sliding window algorithm Arrhythmia Detection: Sliding window optimization: When monitoring the changes in T waves in real time, a double-ended queue can be used to maintain the maximum and minimum values of the current window to reduce computational complexity.
[0055] Parallel processing: Through parallel processing, different types of arrhythmias can be detected simultaneously in multiple sliding windows, improving the efficiency of real-time detection.
[0056] Long QT syndrome testing: Sliding window optimization: The QT interval is calculated through a sliding window, and combined with the use of double-ended queues, the changes in T wave amplitude are dynamically maintained.
[0057] Multi-layer window: A multi-layer window structure is used, with one layer detecting the QT interval and the other layer detecting the amplitude change and morphology of the T wave, ensuring a comprehensive assessment of long QT syndrome.
Claims
1. A system for drawing and analyzing an electrocardiogram in real time, characterized in that: It includes an ECG data acquisition device, a Bluetooth scanning connection module, a real-time data acquisition and analysis tool module and a user interface module; the ECG data acquisition device is used to collect the user's ECG data; the real-time data acquisition and analysis tool module communicates with the ECG data acquisition device through the Bluetooth scanning connection module, receives the ECG data stream from the ECG data acquisition device in real time and draws the ECG waveform in real time according to the data stream, performs real-time filtering and real-time analysis of the ECG signal; the user interface module is used to display the ECG signal data on the user interface.
2. A system for real-time drawing and analyzing electrocardiogram according to claim 1, characterized in that: The analysis tool module includes a variety of analysis tools, including heart rate analysis, ST segment analysis, arrhythmia detection, and electrocardiogram feature extraction.
3. A system for real-time drawing and analyzing electrocardiogram according to claim 1, characterized in that: The analysis tool module performs customized analysis based on the parameters input by the user to meet the specific needs of different users.
4. A system for real-time drawing and analyzing electrocardiogram according to claim 2, characterized in that: The analysis tool is developed in Java language based on the Android Studio platform and is compatible with Android 11 and higher versions and HarmonyOS 1.0 and above.
5. A system for real-time drawing and analyzing electrocardiogram according to claim 1, characterized in that: The ECG data acquisition device is an ECG data acquisition system based on the BMD101 chip, which is suitable for all devices developed based on the UART interface. The data packet format is defined as 1 start bit, 8 data bits, 1 stop bit format, and the serial port transmission baud rate is 57600.
6. A system for real-time drawing and analyzing electrocardiogram according to claim 1, characterized in that: The real-time ECG data drawing adopts a two-way rolling drawing method, that is, when the next data is input, the previous data is rolled out of the screen to realize dynamic ECG drawing.
7. A system for real-time drawing and analyzing electrocardiogram according to claim 1, characterized in that: The interface of the user interface module is divided into a Bluetooth scanning interface and a drawing analysis interface. The Bluetooth scanning interface adopts a click-to-auto connection method, and the drawing analysis interface is provided with an interface for starting and stopping electrocardiogram drawing.
8. A system for real-time drawing and analyzing electrocardiogram according to claim 2, characterized in that: The analysis tool uses a window sliding algorithm to process the data stream. In the initialization phase of the window sliding algorithm, a double-ended queue is pre-allocated to store the maximum or minimum value in the current window. When the window slides, the maximum or minimum value stored in the double-ended queue is used for comparison operations.
9. A system for real-time drawing and analyzing electrocardiogram according to claim 2, characterized in that: The analysis tool uses a window sliding algorithm to process the data stream. The window sliding algorithm uses multiple cores or GPUs and allocates multiple processing units during initialization to synchronously perform operations on multiple sliding windows.
10. A system for real-time drawing and analyzing electrocardiogram according to claim 2, characterized in that: The analysis tool uses a window sliding algorithm to process the data stream and introduces a multi-level sub-window structure when extracting window data.