Data synchronization method for intelligent medicine box and mobile terminal
By analyzing the data interaction frequency and connection stability between the smart medicine box and the mobile terminal, using batch, timing or key data synchronization methods to optimize the data transmission strategy, solving the problem of inaccurate network environment analysis when the smart medicine box and the mobile terminal data synchronization is improved, and the accuracy and integrity of data synchronization is improved, and the safety and health management of users' medication use are ensured.
Patent Information
- Application Number
- CN202510421918.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-04-07
AI Technical Summary
In the prior art, the network environment analysis is not accurate enough when the data synchronization between the smart medicine box and the mobile terminal, resulting in low and incomplete data synchronization accuracy, especially when the network fluctuates, it is prone to delays, interrupts or data loss, affecting the user experience.
By obtaining the data interaction frequency and connection stability within the preset time before data synchronization, we determine the data synchronization tendency type, and according to the distribution and data volume of abnormal connection time points, batch data synchronization, timing data synchronization or key data synchronization methods are used to adjust the data transmission strategy and optimize the data synchronization interval and frequency to adapt to different network conditions and user needs.
It improves the accuracy and integrity of data synchronization, reduces data loss and resource waste caused by network instability, extends the service life of the equipment, ensures timely transmission of key data, and meets users' needs for real-time data.
Smart Images

Figure CN120378436A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and particularly to a method for data synchronization between an intelligent medicine box and a mobile terminal. Background Art
[0002] In actual usage scenarios, the network environments of the intelligent medicine box and the mobile terminal vary greatly. From a stable indoor Wi-Fi environment to an unstable outdoor mobile network, different network conditions have a significant impact on the stability and efficiency of data synchronization. When the network signal is poor, data synchronization may be delayed, interrupted, or data may be lost, seriously affecting the user experience. For example, in areas with weak signals such as elevators and basements, the intelligent medicine box may not be able to synchronize medication data to the mobile terminal in a timely manner, resulting in users missing important medication reminders or lacking important usage data of the intelligent medicine box.
[0003] For example, Chinese Patent Application Publication No.: CN109121176B discloses a distributed data synchronization method. Aiming at the characteristics of limited channel bandwidth in a wireless network environment, mostly connectionless transmission modes, low information transmission rate, relatively high error rate, and small service capacity, the diffusion node selection mechanism for data synchronization by message diffusion between nodes in the Goss ip protocol is optimized. The optimal data synchronization node is selected through constraint conditions such as heartbeat index, bandwidth, delay jitter, and transmission path, effectively improving the distributed data synchronization performance and avoiding a large amount of invalid information triggered by random message diffusion between nodes when using the traditional Goss ip protocol in a wireless network environment, seriously consuming the communication resources of the wireless network and affecting the distributed data synchronization performance.
[0004] However, the existing technology has the problem that the analysis of the network environment during data synchronization is not accurate enough, resulting in low data synchronization accuracy and incomplete data synchronization due to network fluctuations. Summary of the Invention
[0005] Therefore, the present invention provides a method for data synchronization between an intelligent medicine box and a mobile terminal to overcome the problem in the existing technology that the analysis of the network environment during data synchronization is not accurate enough, resulting in low data synchronization accuracy and incomplete data synchronization due to network fluctuations.
[0006] To achieve the above object, the present invention provides a method for data synchronization between an intelligent medicine box and a mobile terminal, including:
[0007] Obtaining the data synchronization data and connection data of the intelligent medicine box and the mobile terminal within a preset time before data synchronization;
[0008] Determining the data synchronization tendency type based on the data interaction frequency and connection stability degree of the intelligent medicine box and the mobile terminal within a preset time before data synchronization;
[0009] Determine the data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode, a timed data synchronization mode, or a critical data synchronization mode based on the data synchronization tendency type and the real-time connection stability degree between the intelligent medicine box and the mobile terminal;
[0010] When the data synchronization between the intelligent medicine box and the mobile terminal is performed in a batch data synchronization mode, determine whether to re-partition the synchronized data or adjust the synchronization data transmission order according to whether the distribution of connection abnormal time points between the intelligent medicine box and the mobile terminal is uniform and the amount of data in a single batch;
[0011] Based on the data synchronization accuracy and the synchronization data growth rate within a preset period, determine to adjust the preset interaction frequency and the preset connection stability degree, or adjust the data synchronization interval.
[0012] Further, determining the data synchronization tendency type includes:
[0013] If the data interaction frequency between the intelligent medicine box and the mobile terminal within a preset time before data synchronization is greater than the preset interaction frequency and the connection stability degree is less than the preset stability degree, determine that the data synchronization tendency type is a strong data synchronization tendency type;
[0014] If the data interaction frequency between the intelligent medicine box and the mobile terminal within a preset time before data synchronization is less than or equal to the preset interaction frequency or the connection stability degree is greater than or equal to the preset stability degree, determine that the data synchronization tendency type is a weak data synchronization tendency type.
[0015] Further, the connection stability degree is determined according to the packet loss rate and the number of connection interruptions within a preset time.
[0016] Further, the preset interaction frequency is determined according to the historical average value of the data interaction frequency between the intelligent medicine box and the mobile terminal, and the preset connection stability degree is determined according to the historical average value of the connection stability degree between the intelligent medicine box and the mobile terminal.
[0017] Further, determining to perform the data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode, a timed data synchronization mode, or a critical data synchronization mode includes:
[0018] If the data synchronization tendency type between the intelligent medicine box and the mobile terminal is a strong data synchronization tendency type and the real-time connection stability degree is less than the preset real-time connection stability degree, determine to perform the data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode;
[0019] If the data synchronization tendency type between the intelligent medicine box and the mobile terminal is a weak data synchronization tendency type and the real-time connection stability degree is less than the preset real-time connection stability degree, determine to perform the data synchronization between the intelligent medicine box and the mobile terminal in a critical data synchronization mode;
[0020] If the real-time connection stability degree is greater than or equal to the preset real-time connection stability degree, determine to perform data synchronization between the intelligent medicine box and the mobile terminal in a timed data synchronization manner.
[0021] Further, determining the secondary division of synchronization data or adjusting the synchronization data transmission order includes:
[0022] If the connection abnormal time points between the intelligent medicine box and the mobile terminal are unevenly distributed and the single-batch data volume is greater than the preset data volume, determine the secondary division of synchronization data;
[0023] If the connection abnormal time points between the intelligent medicine box and the mobile terminal are evenly distributed, or the single-batch data volume is less than or equal to the preset data volume, determine to adjust the synchronization data transmission order.
[0024] Further, determining whether the connection abnormal time points between the intelligent medicine box and the mobile terminal are evenly distributed includes:
[0025] Evenly divide the time period when the connection abnormal event occurs into multiple time intervals, and count the number of connection abnormal events in each time interval;
[0026] Calculate the average number of connection abnormal events in each time interval;
[0027] Compare the absolute value of the difference between the number of connection abnormal events and the average number in each time interval with the preset absolute value of the difference;
[0028] If the number of time intervals in which the absolute value of the difference between the number of connection abnormal events and the average number is greater than the preset number, determine that the connection abnormal time points between the intelligent medicine box and the mobile terminal are unevenly distributed.
[0029] Further, the connection abnormal events include connection interruption, data transmission failure, and packet loss.
[0030] Further, determining to adjust the preset interaction frequency and preset connection stability degree, or adjusting the data synchronization interval includes:
[0031] If the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the synchronization data growth rate is greater than the preset growth amount, determine to adjust the data synchronization interval;
[0032] If the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the synchronization data growth rate is less than or equal to the preset growth amount, determine to adjust the preset interaction frequency and preset connection stability degree.
[0033] Furthermore, the adjustment amount of the data synchronization interval is positively correlated with the growth rate of synchronized data, the preset interaction frequency is positively correlated with the data synchronization accuracy within the preset period, and the preset connection stability degree is positively correlated with the data synchronization accuracy within the preset period.
[0034] Compared with the prior art, the beneficial effects of the present invention are as follows. By comprehensively considering the data interaction frequency and the connection stability degree to determine the data synchronization tendency type, the present invention can better adapt to different user usage habits and actual usage scenarios. For users with a high data interaction frequency, if the connection stability degree is low, it is determined as a strong data synchronization tendency type, and a more efficient and frequent data synchronization strategy can be adopted accordingly to meet their requirements for data real-time performance. For the situation of low data interaction frequency or high connection stability degree, it is determined as a weak data synchronization tendency type, and a relatively conservative synchronization strategy is adopted to avoid unnecessary resource consumption. By using the packet loss rate and the number of connection interruptions, and comprehensively calculating the connection stability degree through the weight coefficients α and β, the actual situation of the network connection can be more accurately reflected. This quantitative evaluation method can avoid the limitations of a single index and more comprehensively consider the impacts of various problems that may occur in the network connection on data synchronization. The present invention improves the data synchronization accuracy and the data synchronization integrity by enhancing the accuracy of analyzing the network environment during data synchronization.
[0035] Furthermore, the present invention selects a suitable data synchronization method according to the data synchronization tendency type and the real-time connection stability degree, which can effectively cope with different network conditions and user requirements. For the case of a strong data synchronization tendency type and an unstable connection, the batch data synchronization method is adopted, and the data is divided into multiple batches for transmission, reducing the amount of data transmitted in a single transmission and reducing the risk of the entire batch of data transmission failure caused by connection anomalies, thereby improving the success rate and reliability of data synchronization. For example, when the network fluctuates greatly, batch transmission can avoid long waiting or data loss caused by transmitting a large amount of data at one time. The key data synchronization method only selects key data for synchronization when the data synchronization tendency type is weak and the connection is unstable, ensuring that important information related to user medication (such as medication reminder settings and drug inventory critical values) can be transmitted to the mobile terminal in a timely and accurate manner. This is crucial for ensuring the user's medication safety and health management, avoiding wasting network resources by transmitting a large amount of non-key data, and reducing the situation where key data cannot be synchronized due to network instability. The timed data synchronization method performs data synchronization at fixed time intervals when the connection is stable, which can not only ensure the regular update of data but also not occupy network and device resources too frequently. Compared with continuously performing data synchronization, this method reduces the energy consumption of the intelligent medicine box and the mobile terminal, extends the service life of the device, and also reduces the occupation of network bandwidth, avoiding affecting the normal operation of other network applications.
[0036] Furthermore, by accurately judging the distribution of connection abnormal time points, the system of the present invention can flexibly adjust the data synchronization strategy. When the distribution of connection abnormal time points is uneven and the amount of data in a single batch is large, the system implements a secondary division synchronization data strategy to avoid excessive data loss or transmission failure during network abnormal periods due to excessive data transmitted at one time. For example, splitting the weekly medication records and transmitting them daily reduces the transmission risk. When the distribution of connection abnormal time points is even, the system adjusts the data transmission order, reasonably arranges the transmission timing of different data batches, reduces the impact of network abnormalities on data synchronization, optimizes the transmission parameters according to the network conditions. For example, after secondary division of the data, the transmission rate of each small batch of data is reduced to reduce network congestion and the probability of packet loss and connection interruption, adapt to the unstable network environment, and improve the success rate of data transmission. The transmission order is adjusted according to the data size and transmission difficulty, and the data batches with small data volume and relatively easy transmission are preferentially transmitted. Even if a connection abnormality occurs during the transmission process, it can ensure the successful transmission of some data, and the pressure for subsequent resumption of transmission is smaller, significantly improving the overall efficiency of data synchronization. When the connection abnormalities show a regular distribution, important data is transmitted during off-peak high-risk periods to ensure the timely synchronization of important data. The present invention improves the accuracy of data synchronization and the integrity of data synchronization by enhancing the accuracy of network environment analysis during data synchronization.
[0037] Furthermore, the present invention determines the adjustment strategy based on the data synchronization accuracy and the synchronization data growth rate within a preset period, and can dynamically adapt to different data synchronization situations. When the data synchronization accuracy is less than the preset value, the system will adjust the data synchronization interval, the preset interaction frequency, or the preset connection stability degree according to the different synchronization data growth rates to ensure the accuracy and integrity of data synchronization. For example, if the data synchronization accuracy is low and the synchronization data growth rate is large within the preset period, by adjusting the data synchronization interval and increasing the synchronization frequency, it helps to improve the data synchronization accuracy and make the amount of successfully synchronized data closer to the total data volume. When the synchronization data growth rate is greater than the preset growth amount, it indicates that the data volume is growing rapidly. At this time, adjusting the data synchronization interval can enable the system to process the newly added data more timely and avoid synchronization delay or failure caused by excessive data accumulation. For example, as the usage time of the intelligent medicine box increases, the amount of data such as medication records continues to grow. By adjusting the synchronization interval, it can ensure that the newly generated data is timely synchronized to the mobile terminal. When the synchronization data growth rate is less than or equal to the preset growth amount but the data synchronization accuracy is still lower than the preset value, adjusting the preset interaction frequency and the preset connection stability degree can optimize the data synchronization performance of the system during the relatively stable data growth stage. The present invention improves the accuracy of data synchronization and the integrity of data synchronization by enhancing the accuracy of network environment analysis during data synchronization. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1This is the flowchart of the data synchronization method between the intelligent medicine box and the mobile terminal in the embodiment of the present invention;
[0039] Figure 2 This is the flowchart of determining whether the distribution of connection abnormal time points between the intelligent medicine box and the mobile terminal is uniform in the data synchronization method between the intelligent medicine box and the mobile terminal in the embodiment of the present invention;
[0040] Figure 3 This is the flowchart of determining the data synchronization tendency type in the data synchronization method between the intelligent medicine box and the mobile terminal in the embodiment of the present invention. Detailed implementation manners
[0041] In order to make the objectives and advantages of the present invention clearer, the present invention will be further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0042] The preferred implementation manners of the present invention will be described below with reference to the accompanying drawings. Those skilled in the art should understand that these implementation manners are only used to explain the technical principles of the present invention and do not limit the protection scope of the present invention.
[0043] Please refer to Figures 1 - 3 as shown in Figure 1 This is the flowchart of the data synchronization method between the intelligent medicine box and the mobile terminal in the embodiment of the present invention; Figure 2 This is the flowchart of determining whether the distribution of connection abnormal time points between the intelligent medicine box and the mobile terminal is uniform in the data synchronization method between the intelligent medicine box and the mobile terminal in the embodiment of the present invention; Figure 3 This is the flowchart of determining the data synchronization tendency type in the data synchronization method between the intelligent medicine box and the mobile terminal in the embodiment of the present invention.
[0044] The data synchronization method between the intelligent medicine box and the mobile terminal in the embodiment of the present invention includes:
[0045] Step S1, obtaining the data synchronization data and connection data between the intelligent medicine box and the mobile terminal within a preset time before data synchronization;
[0046] Step S2, determining the data synchronization tendency type based on the data interaction frequency and connection stability degree between the intelligent medicine box and the mobile terminal within a preset time before data synchronization;
[0047] Step S3, determining to perform data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization manner, a timed data synchronization manner, or a key data synchronization manner based on the data synchronization tendency type between the intelligent medicine box and the mobile terminal and the real-time connection stability degree;
[0048] Step S4, when data synchronization between the intelligent medicine box and the mobile terminal is performed in a batch data synchronization manner, determine whether to re-partition the synchronization data or adjust the synchronization data transmission order according to whether the distribution of the connection abnormal time points between the intelligent medicine box and the mobile terminal is uniform and the amount of data in a single batch.
[0049] Step S5, based on the data synchronization accuracy and the synchronization data growth rate within a preset period, determine to adjust the preset interaction frequency and the preset connection stability, or adjust the data synchronization interval.
[0050] In the embodiment of the present invention, the data synchronization data includes but is not limited to "medication record data of the intelligent medicine box (such as medication time, drug name, dose, etc.), drug inventory data (remaining drug amount, drug expiration date, etc.), data of the user's setting modification of the medication reminder on the mobile terminal, and self-check status data of the intelligent medicine box", and the connection data includes but is not limited to "connection method (such as Bluetooth, Wi-Fi, mobile network, etc.), connection duration, number of connection interruptions, signal strength change data, time point data of connection establishment and disconnection, and network delay data".
[0051] Specifically, in step S2, when determining the data synchronization tendency type, determine the data synchronization tendency type according to the data interaction frequency and the connection stability between the intelligent medicine box and the mobile terminal within a preset time before data synchronization.
[0052] When the data interaction frequency between the intelligent medicine box and the mobile terminal within a preset time before data synchronization is greater than the preset interaction frequency and the connection stability is less than the preset stability, determine that the data synchronization tendency type is a strong data synchronization tendency type.
[0053] When the data interaction frequency between the intelligent medicine box and the mobile terminal within a preset time before data synchronization is less than or equal to the preset interaction frequency or the connection stability is greater than or equal to the preset stability, determine that the data synchronization tendency type is a weak data synchronization tendency type.
[0054] In the embodiment of the present invention, the value range of the preset time is set to 3 days - 10 days, the preferred value of the preset time is 5 days, the preset interaction frequency is the historical average value of the data interaction frequency between the intelligent medicine box and the mobile terminal, the preset connection stability is the historical average value of the connection stability between the intelligent medicine box and the mobile terminal, the connection stability is determined according to the packet loss rate and the number of connection interruptions within the preset time, and the connection stability is Among them, L represents the connection stability degree, P represents the packet loss rate, N represents the number of connection interruptions within a preset time, T represents the total number of connection attempts within a preset time, α and β are weight coefficients, and α + β = 1. The values of α and β can be adjusted according to the actual situation and experimental results to balance the influence of the packet loss rate and the number of connection interruptions on the connection stability degree. For example, if it is considered that the packet loss rate has a greater impact on the connection stability, the value of α can be set higher.
[0055] The present invention determines the data synchronization tendency type by comprehensively considering the data interaction frequency and the connection stability degree, and can better adapt to the usage habits and actual usage scenarios of different users. For users with a high data interaction frequency, if the connection stability degree is low, it is determined as a strong data synchronization tendency type, and a more efficient and frequent data synchronization strategy can be adopted specifically to meet their requirements for data real-time performance; for the situation of low data interaction frequency or high connection stability degree, it is determined as a weak data synchronization tendency type, and a relatively conservative synchronization strategy is adopted to avoid unnecessary resource consumption. By using the packet loss rate and the number of connection interruptions, and comprehensively calculating the connection stability degree through the weight coefficients α and β, the actual situation of the network connection can be more accurately reflected. This quantitative evaluation method can avoid the limitations of a single index and more comprehensively consider the influence of various problems that may occur in the network connection on data synchronization. The present invention improves the accuracy of data synchronization and the data synchronization integrity by improving the accuracy of the network environment analysis during data synchronization.
[0056] Specifically, in step S3, when it is determined to perform data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode, a timed data synchronization mode, or a key data synchronization mode, the data synchronization between the intelligent medicine box and the mobile terminal is determined in a batch data synchronization mode, a timed data synchronization mode, or a key data synchronization mode according to the data synchronization tendency type between the intelligent medicine box and the mobile terminal and the real-time connection stability degree;
[0057] When the data synchronization tendency type between the intelligent medicine box and the mobile terminal is a strong data synchronization tendency type and the real-time connection stability degree is less than the preset real-time connection stability degree, it is determined to perform data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode;
[0058] When the data synchronization tendency type between the intelligent medicine box and the mobile terminal is a weak data synchronization tendency type and the real-time connection stability degree is less than the preset real-time connection stability degree, it is determined to perform data synchronization between the intelligent medicine box and the mobile terminal in a key data synchronization mode;
[0059] When the real-time connection stability degree is greater than or equal to the preset real-time connection stability degree, it is determined to perform data synchronization between the intelligent medicine box and the mobile terminal in a timed data synchronization mode.
[0060] In the embodiment of the present invention, the preset real-time connection stability is the average value of the connection stabilities between the intelligent medicine box and the mobile terminal within a plurality of preset time periods. The calculation method of the real-time connection stability is the same as the above-mentioned connection stability calculation method, but the above values are not limited to this, and those skilled in the art can also adjust the values according to actual needs.
[0061] In the embodiment of the present invention, the batch data synchronization method includes dividing the data into multiple batches for synchronization to adapt to unstable connection situations. Suppose the data interaction frequency between the intelligent medicine box and the mobile terminal in the past 5 days is relatively high, greater than the preset interaction frequency, and the connection stability is lower than the preset stability, it is determined as a strong data synchronization tendency type. In a certain real-time connection detection, the calculated real-time connection stability is 80%, while the preset real-time connection stability is 85%. At this time, the data to be synchronized is divided into multiple batches according to certain rules, such as according to the type or time sequence of the data, and synchronized in turn to reduce data loss or synchronization failure caused by unstable connection; the key data synchronization method includes when the intelligent medicine box and the mobile terminal are in a weak data synchronization tendency type and the real-time connection stability is less than the preset real-time connection stability, only select key data for synchronization to ensure the transmission of important information. For example, only select key data such as medication reminder settings and drug inventory critical values for synchronization to avoid low synchronization efficiency or failure caused by transmitting a large amount of non-key data under unstable connection; the timed data synchronization method includes when the real-time connection stability is greater than or equal to the preset real-time connection stability, perform data synchronization at fixed time intervals to ensure regular data update; for example, after multiple detections, the system is set to perform data synchronization once an hour. At each whole hour moment, the data in the intelligent medicine box, such as medication records and device status, is automatically synchronized to the mobile terminal to ensure that the data on the mobile terminal can be updated in a timely and accurate manner, and at the same time, it will not consume too many resources due to overly frequent synchronization.
[0062] The present invention selects an appropriate data synchronization method according to the data synchronization tendency type and the real-time connection stability degree, and can effectively cope with different network conditions and user requirements. For the case of strong data synchronization tendency type and unstable connection, the batch data synchronization method is adopted, and the data is divided into multiple batches for transmission, reducing the amount of data transmitted in a single transmission, reducing the risk of the entire batch of data transmission failure due to connection anomalies, and improving the success rate and reliability of data synchronization. For example, when the network fluctuates greatly, batch transmission can avoid long waiting or data loss caused by transmitting a large amount of data at one time. When the key data synchronization method is for the weak data synchronization tendency type and unstable connection, only key data is selected for synchronization, ensuring that important information related to user medication (such as medication reminder settings, drug inventory critical values) can be transmitted to the mobile terminal in a timely and accurate manner. This is crucial for ensuring the medication safety and health management of users, avoiding wasting network resources by transmitting a large amount of non-critical data, and also reducing the situation where key data cannot be synchronized due to network instability. The timed data synchronization method performs data synchronization at fixed time intervals when the connection is stable, which can not only ensure the regular update of data, but also not occupy network and device resources too frequently. Compared with continuous data synchronization, this method reduces the energy consumption of the intelligent medicine box and the mobile terminal, extends the service life of the device, and also reduces the occupation of network bandwidth, avoiding affecting the normal operation of other network applications.
[0063] Specifically, in step S4, when determining to secondarily divide the synchronized data or adjust the synchronized data transmission order, determine the secondarily dividing the synchronized data or adjusting the synchronized data transmission order according to whether the distribution of connection anomaly time points between the intelligent medicine box and the mobile terminal is uniform and the amount of data in a single batch;
[0064] When the distribution of connection anomaly time points between the intelligent medicine box and the mobile terminal is non-uniform and the amount of data in a single batch is greater than the preset amount of data, determine to secondarily divide the synchronized data;
[0065] When the distribution of connection anomaly time points between the intelligent medicine box and the mobile terminal is uniform or the amount of data in a single batch is less than or equal to the preset amount of data, determine to adjust the synchronized data transmission order.
[0066] Specifically, in step S4, the steps for determining whether the distribution of connection anomaly time points between the intelligent medicine box and the mobile terminal is uniform include:
[0067] Step S4401, evenly divide the time period when the connection anomaly event occurs into multiple time intervals, and count the number of connection anomaly events in each time interval;
[0068] Step S4402, calculate the average number of connection anomaly events in each time interval;
[0069] Step S4403: Compare the absolute value of the difference between the number of connection exception events in each time interval and the average number with a preset absolute value of the difference.
[0070] Step S4404: If the number of time intervals in which the absolute value of the difference between the number of connection exception events and the average number is greater than the preset absolute value of the difference is greater than the preset number, it is determined that the distribution of connection exception time points between the intelligent medicine box and the mobile terminal is uneven.
[0071] In the embodiment of the present invention, the connection exception events include connection interruption, data transmission failure, and packet loss. The value of the preset data volume is the average value of the data volume of a single batch during data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization manner within several preset time periods. The secondary partition of the synchronization data includes splitting the single-batch excessive data according to certain rules based on the actual network condition and data transmission characteristics. For example, different types of data such as medication records, drug information, and device status are separated based on the data category to form multiple small batches; or the data generated within a period of time, such as the medication records for a week, are split into daily small batches according to the time sequence. To ensure the orderly transmission and correct recombination of the split data, specific identifiers are added to each newly generated small batch of data. The identifier content includes key information such as batch number, total data volume, and the original batch to which it belongs, facilitating the accurate sorting and integration by the mobile terminal after receiving the data based on the identifier. For the data batches after the secondary partition, the transmission parameters are optimized accordingly. For example, assume that the intelligent medicine box needs to synchronize the medication record data for a week, which was originally planned to be transmitted as a single batch, and the calculated data volume is greater than the preset data volume. During the transmission process, it is determined through steps S4401 - S4404 that the distribution of connection exception time points is uneven; at this time, the secondary partition of the synchronization data operation is performed: the medication records for a week are split into 7 small batches by day, and each small batch contains the medication record data for the day; identifiers are added to each small batch of data, such as the batch numbers being 1 - 7 respectively, the total data volume being the original entire batch data volume, and the original batch to which it belongs being the originally planned entire batch for transmission; the transmission rate of each small batch of data is reduced by 20%.
[0072] In the embodiments of the present invention, the adjustment of the synchronous data transmission order includes: if the distribution of connection abnormal time points shows a certain pattern, for example, connection abnormalities are likely to occur in certain fixed time periods, then these time periods can be avoided for transmitting important data, and the transmission of important data can be arranged in relatively stable connection time periods, while some less critical data can be transmitted or preparations for data transmission can be made in the time periods where connection abnormalities may occur. If the distribution of connection abnormal time points is relatively uniform, the order can be adjusted according to the size and transmission difficulty of the data. First, transmit the data batches with smaller data volume and relatively easy transmission. In this way, even if a connection abnormality occurs during the transmission, it can be ensured that some data has been successfully transmitted, and the pressure for subsequent resumption of transmission is relatively small. For data batches with larger data volume and higher transmission difficulty, they are transmitted when the smaller data batches in front have been transmitted and the network condition is good.
[0073] In the embodiments of the present invention, the preset absolute difference value is obtained by experimentally testing the distribution of connection abnormal events in different network environments, calculating the absolute value of the difference between the number of connection abnormal events and the average number in each time interval, and selecting a reasonable threshold value such that the absolute value of the difference in most time intervals is within this threshold range. For example, the value range of the preset absolute difference value is set to 0.8 - 2, and the preferred value of the preset absolute difference value is 1.2. The preset quantity is obtained by experimental testing to determine the number of time intervals exceeding the preset absolute difference value when the distribution of connection abnormal time points is uneven in different network environments, and a reasonable quantity is selected as the preset value. For example, the value range of the preset quantity is set to 2 - 5, and the preferred value of the preset quantity is 3. However, the above values are not limited to this, and those skilled in the art can also adjust the values according to actual needs.
[0074] Through precise judgment of the distribution of connection anomaly time points, the system of the present invention can flexibly adjust the data synchronization strategy. When the distribution of connection anomaly time points is uneven and the amount of data in a single batch is large, a secondary partitioning data synchronization strategy is implemented to avoid excessive data loss or transmission failure during network anomaly periods due to too much data transmitted at one time. For example, the weekly medication records are split and transmitted by day, reducing the transmission risk. When the distribution of connection anomaly time points is even, the data transmission order is adjusted, and the transmission timing of different data batches is reasonably arranged to reduce the impact of network anomalies on data synchronization. The transmission parameters are optimized according to the network conditions. For example, after secondary partitioning the data, the transmission rate of each small batch of data is reduced to reduce network congestion and the probability of packet loss and connection interruption, adapting to an unstable network environment and improving the success rate of data transmission. The transmission order is adjusted according to the data size and transmission difficulty, and the data batches with small data volume and relatively easy transmission are preferentially transmitted. Even if a connection anomaly occurs during the transmission process, it can ensure that part of the data is successfully transmitted, and the pressure for subsequent resumed transmission is smaller, significantly improving the overall efficiency of data synchronization. When the connection anomalies show a regular distribution, important data is transmitted during low-risk periods, ensuring the timely synchronization of important data. The present invention improves the accuracy of data synchronization and the integrity of data synchronization by enhancing the accuracy of network environment analysis during data synchronization.
[0075] Specifically, in step S5, when it is determined to adjust the preset interaction frequency and preset connection stability or to adjust the data synchronization interval, the adjustment of the preset interaction frequency and preset connection stability or the adjustment of the data synchronization interval is determined according to the data synchronization accuracy and the synchronization data growth rate within the preset period.
[0076] When the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the synchronization data growth rate is greater than the preset growth amount, it is determined to adjust the data synchronization interval.
[0077] When the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the synchronization data growth rate is less than or equal to the preset growth amount, it is determined to adjust the preset interaction frequency and preset connection stability.
[0078] When the data synchronization accuracy within the preset period is greater than or equal to the preset synchronization accuracy, it is determined that there is no need to adjust the data synchronization interval, the preset interaction frequency, and the preset connection stability.
[0079] In the embodiment of the present invention, the value range of the preset period is set to 10 days - 30 days, the value of the preset period is preferably 20 days, the preset synchronization accuracy is the average value of the data synchronization accuracy within several preset periods, the data synchronization accuracy can be determined by the ratio of the successfully synchronized data volume to the total data volume, the synchronization data growth rate is determined by the ratio of the synchronization data volume in this period to the synchronization data volume in the previous period, the preset growth rate is the average value of the synchronization data growth rates within several preset periods, but the above values are not limited to this, and those skilled in the art can also adjust the values according to actual needs.
[0080] In the embodiment of the present invention, the adjustment of the data synchronization interval includes adjusting the data synchronization interval with a first adjustment coefficient, the adjustment of the preset interaction frequency includes adjusting the preset interaction frequency with a second adjustment coefficient, the adjustment of the preset connection stability includes adjusting the preset connection stability with a third adjustment coefficient. The value range of the first adjustment coefficient is set to 1.04 - 1.19, the value of the first adjustment coefficient is preferably 1.11. The value range of the second adjustment coefficient is set to 0.82 - 0.96, the value of the second adjustment coefficient is preferably 0.89. The value range of the third adjustment coefficient is set to 0.86 - 0.98, the value of the third adjustment coefficient is preferably 0.91. The adjustment amount of the data synchronization interval is positively correlated with the synchronization data growth rate, the preset interaction frequency is positively correlated with the data synchronization accuracy within the preset period, and the preset connection stability is positively correlated with the data synchronization accuracy within the preset period. However, the above values are not limited to this, and those skilled in the art can also adjust the values according to actual needs.
[0081] The present invention determines the adjustment strategy based on the data synchronization accuracy and the synchronization data growth rate within a preset period, and can dynamically adapt to different data synchronization situations. When the data synchronization accuracy is less than the preset value, the system will, according to the different synchronization data growth rates, specifically adjust the data synchronization interval, the preset interaction frequency or the preset connection stability degree to ensure the accuracy and integrity of data synchronization. For example, if the data synchronization accuracy is low and the synchronization data growth rate is large within the preset period, by adjusting the data synchronization interval and increasing the synchronization frequency, it helps to improve the data synchronization accuracy and make the amount of successfully synchronized data closer to the total data volume; when the synchronization data growth rate is greater than the preset growth amount, it indicates that the data volume is growing rapidly. At this time, adjusting the data synchronization interval can enable the system to process the newly added data more timely and avoid synchronization delay or failure caused by excessive data accumulation. For example, as the usage time of the intelligent medicine box increases, the amount of data such as medication records keeps growing. By adjusting the synchronization interval, it can ensure that the newly generated data is synchronized to the mobile terminal in a timely manner. When the synchronization data growth rate is less than or equal to the preset growth amount but the data synchronization accuracy is still lower than the preset value, adjusting the preset interaction frequency and the preset connection stability degree can optimize the data synchronization performance of the system in the stage of relatively stable data growth. The present invention improves the accuracy of network environment analysis during data synchronization, thereby improving the data synchronization accuracy and the data synchronization integrity.
[0082] So far, the technical solution of the present invention has been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. A method for data synchronization between an intelligent medicine box and a mobile terminal, characterized in that, Including: Obtaining the data synchronization data and connection data between the intelligent medicine box and the mobile terminal within a preset time before data synchronization; Determining the data synchronization tendency type based on the data interaction frequency and connection stability degree between the intelligent medicine box and the mobile terminal within a preset time before data synchronization; Determining to perform data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode, a timed data synchronization mode, or a key data synchronization mode based on the data synchronization tendency type between the intelligent medicine box and the mobile terminal and the real-time connection stability degree; When performing data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode, determining whether to re-partition the synchronization data or adjust the synchronization data transmission order according to whether the distribution of connection abnormal time points between the intelligent medicine box and the mobile terminal is uniform and the single-batch data volume; Determining to adjust the preset interaction frequency and preset connection stability degree, or adjust the data synchronization interval based on the data synchronization accuracy and synchronization data growth rate within a preset period; 2. The data synchronization method between the intelligent medicine box and the mobile terminal according to claim 1, characterized in that, Determining the data synchronization tendency type includes: If the data interaction frequency between the intelligent medicine box and the mobile terminal within a preset time before data synchronization is greater than the preset interaction frequency and the connection stability degree is less than the preset stability degree, determining that the data synchronization tendency type is a strong data synchronization tendency type; If the data interaction frequency between the intelligent medicine box and the mobile terminal within a preset time before data synchronization is less than or equal to the preset interaction frequency or the connection stability degree is greater than or equal to the preset stability degree, determining that the data synchronization tendency type is a weak data synchronization tendency type.
3. The data synchronization method between the intelligent medicine box and the mobile terminal according to claim 2, characterized in that, The connection stability degree is determined according to the packet loss rate and the number of connection interruptions within a preset time.
4. The data synchronization method between the intelligent medicine box and the mobile terminal according to claim 2, characterized in that, The preset interaction frequency is determined according to the historical average value of the data interaction frequency between the intelligent medicine box and the mobile terminal, and the preset connection stability degree is determined according to the historical average value of the connection stability degree between the intelligent medicine box and the mobile terminal.
5. The data synchronization method between the intelligent medicine box and the mobile terminal according to claim 4, wherein Determining to perform data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode, a timed data synchronization mode, or a key data synchronization mode includes: If the data synchronization tendency type between the intelligent medicine box and the mobile terminal is a strong data synchronization tendency type and the real-time connection stability degree is less than the preset real-time connection stability degree, determining to perform data synchronization between the intelligent medicine box and the mobile terminal in a batch data synchronization mode; If the data synchronization tendency type between the intelligent medicine box and the mobile terminal is a weak data synchronization tendency type and the real-time connection stability degree is less than the preset real-time connection stability degree, determining to perform data synchronization between the intelligent medicine box and the mobile terminal in a key data synchronization mode; If the real-time connection stability degree is greater than or equal to the preset real-time connection stability degree, determining to perform data synchronization between the intelligent medicine box and the mobile terminal in a timed data synchronization mode.
6. The data synchronization method between the intelligent medicine box and the mobile terminal according to claim 5, characterized in that, Determining whether to re-partition the synchronization data or adjust the synchronization data transmission order includes: If the distribution of connection abnormal time points between the intelligent medicine box and the mobile terminal is not uniform and the single-batch data volume is greater than the preset data volume, determining to re-partition the synchronization data; If the distribution of connection abnormal time points between the intelligent medicine box and the mobile terminal is uniform, or the single-batch data volume is less than or equal to the preset data volume, determining to adjust the synchronization data transmission order.
7. The data synchronization method between the intelligent medicine box and the mobile terminal according to claim 6, characterized in that, Determining whether the distribution of connection abnormal time points between the intelligent medicine box and the mobile terminal is uniform includes: Evenly divide the time period when connection exception events occur into multiple time intervals, and count the number of connection exception events in each time interval; Calculate the average number of connection exception events in each time interval; Compare the absolute value of the difference between the number of connection exception events and the average number in each time interval with a preset absolute value of the difference; If the number of time intervals where the absolute value of the difference between the number of connection exception events and the average number is greater than the preset number, it is determined that the distribution of connection exception time points between the intelligent medicine box and the mobile terminal is uneven.
8. The data synchronization method between the intelligent medicine box and the mobile terminal according to claim 7, characterized in that, The connection exception events include connection interruption, data transmission failure, and packet loss.
9. The data synchronization method of the intelligent medicine box and the mobile terminal according to claim 8, characterized in that, Determining to adjust the preset interaction frequency and preset connection stability, or, adjusting the data synchronization interval includes: If the data synchronization accuracy within a preset period is less than the preset synchronization accuracy and the synchronization data growth rate is greater than the preset growth amount, determine to adjust the data synchronization interval; If the data synchronization accuracy within a preset period is less than the preset synchronization accuracy and the synchronization data growth rate is less than or equal to the preset growth amount, determine to adjust the preset interaction frequency and preset connection stability.
10. The data synchronization method between the intelligent medicine box and the mobile terminal according to claim 9, characterized in that, The adjustment amount of the data synchronization interval is positively correlated with the synchronization data growth rate, the preset interaction frequency is positively correlated with the data synchronization accuracy within the preset period, and the preset connection stability is positively correlated with the data synchronization accuracy within the preset period.
Citation Information
Patent Citations
A distributed data synchronization method
CN109121176B
Data synchronization method and its implementing device and system
CN101155018A
Method and system for data synchronization of Web client and server
CN102904887A
Cloud data synchronization method, device and system
CN105100261A
Methods and systems for triggering efficient application synchronization
CN106537883A