Intelligent medicine box and mobile terminal data synchronization method
By analyzing the data interaction frequency and connection stability between the smart pillbox and the mobile terminal, and by adopting batch, timed, or key data synchronization methods, the data synchronization problem under poor network conditions was solved, achieving higher accuracy and integrity, and ensuring medication safety and health management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- THE FIRST MEDICAL CENT CHINESE PLA GENERAL HOSPITAL
- Filing Date
- 2025-04-07
- Publication Date
- 2026-05-05
AI Technical Summary
In existing technologies, data synchronization between smart pillboxes and mobile terminals suffers from low accuracy and incompleteness when the network environment is poor. This can lead to missed medication reminders or data loss, especially in areas with weak signals.
By analyzing the data interaction frequency and connection stability between the smart pillbox and the mobile terminal, the data synchronization tendency type is determined, and batch data synchronization, timed data synchronization, or critical data synchronization methods are adopted. Combined with dynamic adjustments based on the distribution of connection anomaly time points and data growth rate, the data transmission strategy is optimized.
It improves the accuracy and integrity of data synchronization, ensures timely transmission of critical information, reduces resource consumption, extends equipment life, adapts to different network conditions and user needs, and enhances data transmission success rate and reliability.
Smart Images

Figure CN120378436B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data transmission technology, and in particular to a method for synchronizing data between a smart pillbox and a mobile terminal. Background Technology
[0002] In real-world usage scenarios, the network environments of smart pillboxes and mobile terminals vary greatly, from stable indoor Wi-Fi environments to unstable outdoor mobile networks. Different network conditions significantly impact the stability and efficiency of data synchronization. When the network signal is poor, data synchronization may experience delays, interruptions, or data loss, severely affecting the user experience. For example, in areas with weak signals, such as elevators or basements, smart pillboxes may fail to synchronize medication data to mobile terminals in a timely manner, causing users to miss important medication reminders or lose important usage data from the smart pillbox.
[0003] For example, Chinese patent application publication number CN109121176B discloses a distributed data synchronization method. Addressing the characteristics of limited channel bandwidth, predominantly connectionless transmission modes, low information transmission rates, relatively high bit error rates, and small service capacity in wireless network environments, this method optimizes the diffusion node selection mechanism of the Goss IP protocol, which uses inter-node message diffusion for data synchronization. By selecting the optimal data synchronization node based on constraints such as heartbeat index, bandwidth, latency jitter, and transmission path, it effectively improves distributed data synchronization performance. This avoids the problem of random message diffusion triggering a large amount of invalid information, severely consuming wireless network communication resources, and affecting distributed data synchronization performance when using the traditional Goss IP protocol in wireless network environments.
[0004] However, existing technologies suffer from insufficient accuracy in analyzing the network environment during data synchronization, leading to low data synchronization precision and incomplete data synchronization due to network fluctuations. Summary of the Invention
[0005] To address this issue, the present invention provides a data synchronization method between a smart pillbox and a mobile terminal, thereby overcoming the problem in the prior art where insufficient network environment analysis during data synchronization leads to low data synchronization accuracy and incomplete data synchronization due to network fluctuations.
[0006] To achieve the above objectives, the present invention provides a data synchronization method between a smart pillbox and a mobile terminal, comprising:
[0007] Acquire data synchronization data and connection data between the smart pillbox and the mobile terminal within a preset time before data synchronization;
[0008] The data synchronization tendency type is determined based on the frequency of data interaction between the smart pillbox and the mobile terminal and the stability of the connection within a preset time before data synchronization.
[0009] Based on the data synchronization tendency type between the smart pillbox and the mobile terminal and the stability of the real-time connection, the data synchronization between the smart pillbox and the mobile terminal is determined to be carried out in batches, timed, or key data synchronization mode.
[0010] When synchronizing data between the smart pillbox and the mobile terminal in batches, the second division of the synchronization data or the adjustment of the synchronization data transmission order is determined based on whether the distribution of connection anomalies between the smart pillbox and the mobile terminal is uniform and the amount of data in a single batch.
[0011] Based on the data synchronization accuracy and data growth rate within a preset period, the preset interaction frequency and preset connection stability can be adjusted, or the data synchronization interval can be adjusted.
[0012] Furthermore, determining the data synchronization tendency type includes:
[0013] If the data interaction frequency between the smart pillbox and the mobile terminal is greater than the preset interaction frequency and the connection stability is less than the preset stability within a preset time before data synchronization, the data synchronization tendency type is determined to be a strong data synchronization tendency type.
[0014] If the data interaction frequency between the smart pillbox and the mobile terminal is less than or equal to the preset interaction frequency or the connection stability is greater than or equal to the preset stability within a preset time before data synchronization, the data synchronization tendency type is determined to be a weak data synchronization tendency type.
[0015] Furthermore, the connection stability is determined based on the packet loss rate and the number of connection interruptions within a preset time period.
[0016] Furthermore, the preset interaction frequency is determined based on the historical average of the data interaction frequency between the smart pillbox and the mobile terminal, and the preset connection stability is determined based on the historical average of the connection stability between the smart pillbox and the mobile terminal.
[0017] Furthermore, determining whether to synchronize data between the smart pillbox and the mobile terminal using batch data synchronization, scheduled data synchronization, or key data synchronization includes:
[0018] If the data synchronization tendency type between the smart pillbox and the mobile terminal is strong data synchronization tendency type and the real-time connection stability is less than the preset real-time connection stability, it is determined to perform data synchronization between the smart pillbox and the mobile terminal in batch data synchronization mode.
[0019] If the data synchronization tendency type between the smart pillbox and the mobile terminal is weak data synchronization tendency type and the real-time connection stability is less than the preset real-time connection stability, then the data synchronization between the smart pillbox and the mobile terminal will be performed using the critical data synchronization method.
[0020] If the real-time connection stability is greater than or equal to the preset real-time connection stability, the data synchronization between the smart pillbox and the mobile terminal will be performed using a timed data synchronization method.
[0021] Furthermore, determining the secondary partitioning of synchronization data or adjusting the synchronization data transmission order includes:
[0022] If the abnormal connection points between the smart pillbox and the mobile terminal are unevenly distributed and the data volume of a single batch is greater than the preset data volume, a second division of synchronized data will be determined.
[0023] If the abnormal connection points between the smart pillbox and the mobile terminal are evenly distributed, or if the data volume of a single batch is less than or equal to the preset data volume, the synchronization data transmission order will be adjusted.
[0024] Furthermore, determining whether the distribution of abnormal connection times between the smart pillbox and the mobile terminal is uniform includes:
[0025] The time period in which connection failure events occurred is evenly divided into multiple time intervals, and the number of connection failure events in each time interval is counted.
[0026] Calculate the average number of connection anomalies within each time interval;
[0027] The absolute value of the difference between the number of connected abnormal events and the average number in each time interval is compared with the preset absolute value of the difference.
[0028] If the absolute value of the difference between the number of connection anomaly events and the average number of connection anomalies is greater than the absolute value of the preset difference in time intervals, it is determined that the distribution of connection anomaly time points between the smart pillbox and the mobile terminal is uneven.
[0029] Furthermore, the connection anomaly events include connection interruption, data transmission failure, and packet loss.
[0030] Furthermore, determining whether to adjust the preset interaction frequency and preset connection stability, or to adjust the data synchronization interval, includes:
[0031] If the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the data synchronization growth rate is greater than the preset growth rate, the data synchronization interval will be adjusted.
[0032] If the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the data synchronization growth rate is less than or equal to the preset growth rate, then the preset interaction frequency and preset connection stability will be adjusted.
[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 is positively correlated with the data synchronization accuracy within the preset period.
[0034] Compared with existing technologies, the advantages of this invention lie in its ability to determine the data synchronization tendency type by comprehensively considering data interaction frequency and connection stability. This allows for better adaptation to different user habits and actual usage scenarios. For users with high data interaction frequency but low connection stability, a strong data synchronization tendency type is identified, enabling the adoption of more efficient and frequent data synchronization strategies to meet their real-time data requirements. Conversely, for users with low data interaction frequency or high connection stability, a weak data synchronization tendency type is identified, employing a more conservative synchronization strategy to avoid unnecessary resource consumption. By utilizing packet loss rate and connection interruption counts, and using weighting coefficients α and β to comprehensively calculate connection stability, the actual network connection status can be more accurately reflected. This quantitative evaluation method avoids the limitations of single indicators and more comprehensively considers the impact of various network connection problems on data synchronization. By improving the accuracy of network environment analysis during data synchronization, this invention enhances data synchronization precision and integrity.
[0035] Furthermore, this invention selects an appropriate data synchronization method based on the data synchronization tendency type and the stability of the real-time connection. This effectively addresses different network conditions and user needs. For situations with a strong data synchronization tendency and unstable connections, a batch data synchronization method is adopted, dividing the data into multiple batches for transmission. This reduces the amount of data transmitted in a single batch, minimizing the risk of entire batch data transmission failure due to connection anomalies and improving the success rate and reliability of data synchronization. For example, when network fluctuations are significant, batch transmission can avoid long waiting times or data loss caused by transmitting large amounts of data at once. In situations with a weak data synchronization tendency and unstable connections, the critical data synchronization method selects only critical data for synchronization, ensuring that important medication-related information (such as medication reminder settings and drug inventory thresholds) can be transmitted to the mobile terminal in a timely and accurate manner. This is crucial for ensuring user medication safety and health management, avoiding the waste of network resources due to the transmission of large amounts of non-critical data, and also reducing the possibility of critical data failing to synchronize due to network instability. The timed data synchronization method performs data synchronization at fixed time intervals when the connection is stable, ensuring regular data updates without excessively consuming network and device resources. Compared to continuous data synchronization, this method reduces the energy consumption of smart pillboxes and mobile terminals, extends the lifespan of the devices, and also reduces the occupation of network bandwidth, avoiding impact on the normal operation of other network applications.
[0036] Furthermore, by accurately judging the distribution of connection anomaly time points, the system 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 data partitioning synchronization strategy is implemented to avoid large amounts of data loss or transmission failure due to excessive data transmission at one time during network anomaly periods. For example, a week's medication records are split and transmitted by day, reducing transmission risk. When the distribution of connection anomaly time points is uniform, the data transmission order is adjusted to reasonably arrange the transmission timing of different data batches, reducing the impact of network anomalies on data synchronization. Transmission parameters are optimized according to network conditions. For example, after secondary data partitioning, the transmission rate of each small batch of data is reduced to reduce network congestion, reduce the probability of packet loss and connection interruption, adapt to unstable network environments, and improve the success rate of data transmission. The transmission order is adjusted according to data size and transmission difficulty, prioritizing the transmission of data batches with small data volume and relatively easy transmission. Even if connection anomalies occur during transmission, it can ensure that some data is successfully transmitted, reducing the pressure of subsequent transmission recovery and significantly improving the overall efficiency of data synchronization. When connection anomalies exhibit a regular distribution, it avoids transmitting important data during high-risk periods, ensuring the timely synchronization of important data. This 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, this invention determines the adjustment strategy based on the data synchronization accuracy and synchronization data growth rate within a preset period, enabling dynamic adaptation to different data synchronization situations. When the data synchronization accuracy is less than the preset value, the system will adjust the data synchronization interval, preset interaction frequency, or preset connection stability 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 high within the preset period, adjusting the data synchronization interval to increase the frequency of synchronization helps improve the data synchronization accuracy, making the amount of successfully synchronized data closer to the total data amount. When the synchronization data growth rate is greater than the preset growth rate, it indicates that the data... When the data volume increases rapidly, adjusting the data synchronization interval can enable the system to process new data more promptly, avoiding synchronization delays or failures due to excessive data accumulation. For example, as the usage time of a smart pillbox increases, the amount of data such as medication records continues to grow. By adjusting the synchronization interval, it can be ensured that newly generated data is synchronized to the mobile terminal in a timely manner. When the data synchronization growth rate is less than or equal to the preset growth rate but the data synchronization accuracy is still lower than the preset value, adjusting the preset interaction frequency and preset connection stability can optimize the data synchronization performance of the system during the relatively stable data growth phase. This invention improves the accuracy and completeness of data synchronization by enhancing the accuracy of network environment analysis during data synchronization. Attached Figure Description
[0038] Figure 1This is a flowchart illustrating the data synchronization method between the smart pillbox and the mobile terminal according to an embodiment of the present invention.
[0039] Figure 2 This is a flowchart illustrating the process of determining whether the distribution of connection anomalies between the smart pillbox and the mobile terminal is uniform in the data synchronization method between the smart pillbox and the mobile terminal according to an embodiment of the present invention.
[0040] Figure 3 This is a flowchart illustrating the process of determining the data synchronization tendency type in the data synchronization method between the smart pillbox and the mobile terminal according to an embodiment of the present invention. Detailed Implementation
[0041] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.
[0042] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0043] Please see Figures 1-3 As shown, Figure 1 This is a flowchart illustrating the data synchronization method between the smart pillbox and the mobile terminal according to an embodiment of the present invention. Figure 2 This is a flowchart illustrating the process of determining whether the distribution of connection anomalies between the smart pillbox and the mobile terminal is uniform in the data synchronization method between the smart pillbox and the mobile terminal according to an embodiment of the present invention. Figure 3 This is a flowchart illustrating the process of determining the data synchronization tendency type in the data synchronization method between the smart pillbox and the mobile terminal according to an embodiment of the present invention.
[0044] The data synchronization method between the smart pillbox and the mobile terminal in this embodiment of the invention includes:
[0045] Step S1: Obtain the data synchronization data and connection data between the smart medicine box and the mobile terminal within a preset time before data synchronization;
[0046] Step S2: Determine the data synchronization tendency type based on the data interaction frequency and connection stability between the smart medicine box and the mobile terminal within a preset time before data synchronization;
[0047] Step S3: Based on the data synchronization tendency type between the smart pillbox and the mobile terminal and the stability of the real-time connection, determine whether to perform data synchronization between the smart pillbox and the mobile terminal in batches, timed data synchronization, or key data synchronization.
[0048] Step S4: When synchronizing data between the smart pillbox and the mobile terminal in batch data synchronization mode, determine whether the distribution of connection abnormality time points between the smart pillbox and the mobile terminal is uniform and the amount of data in a single batch to divide the synchronization data for the second time or adjust the synchronization data transmission order.
[0049] Step S5: Based on the data synchronization accuracy and synchronization data growth rate within the preset period, determine whether to adjust the preset interaction frequency and preset connection stability, or adjust the data synchronization interval.
[0050] The data synchronization data in this embodiment of the invention includes, but is not limited to, "medication record data of the smart pillbox (such as medication time, drug name, dosage, etc.), drug inventory data (remaining amount of medicine, drug expiration date, etc.), user settings modification data for medication reminders on mobile terminals, and self-test status data of the smart pillbox." 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, connection establishment and disconnection time data, and network latency data."
[0051] Specifically, in step S2, when determining the data synchronization tendency type, the data synchronization tendency type is determined based on the data interaction frequency between the smart medicine box and the mobile terminal and the connection stability within a preset time before data synchronization.
[0052] When the data interaction frequency between the smart medicine box and the mobile terminal is greater than the preset interaction frequency and the connection stability is less than the preset stability within a preset time before data synchronization, the data synchronization tendency type is determined to be a strong data synchronization tendency type.
[0053] If the data interaction frequency between the smart pillbox and the mobile terminal is less than or equal to the preset interaction frequency or the connection stability is greater than or equal to the preset stability within a preset time before data synchronization, the data synchronization tendency type is determined to be a weak data synchronization tendency type.
[0054] In this embodiment of the invention, the preset time range is set to 3-10 days, preferably 5 days. The preset interaction frequency is the historical average of the data interaction frequency between the smart pillbox and the mobile terminal. The preset connection stability is the historical average of the connection stability between the smart pillbox and the mobile terminal. The connection stability is determined based on the packet loss rate and the number of connection interruptions within the preset time period. Where L represents the connection stability, 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 weighting coefficients, and α+β=1. The values of α and β can be adjusted according to the actual situation and experimental results to balance the impact of packet loss rate and the number of connection interruptions on the connection stability. For example, if it is believed that the packet loss rate has a greater impact on connection stability, the value of α can be set higher.
[0055] This invention determines the data synchronization tendency type by comprehensively considering data interaction frequency and connection stability. This approach better adapts to different user habits and actual usage scenarios. For users with high data interaction frequency but low connection stability, a strong data synchronization tendency type is identified, allowing for more efficient and frequent data synchronization strategies to meet their real-time data requirements. Conversely, for users with low data interaction frequency or high connection stability, a weak data synchronization tendency type is identified, employing a more conservative synchronization strategy to avoid unnecessary resource consumption. By utilizing packet loss rate and connection interruption counts, and using weighted coefficients α and β to comprehensively calculate connection stability, this method more accurately reflects the actual network connection status. This quantitative evaluation method avoids the limitations of single indicators and more comprehensively considers the impact of various network connection problems on data synchronization. By improving the accuracy of network environment analysis during data synchronization, this invention enhances data synchronization precision and completeness.
[0056] Specifically, in step S3, when it is determined that the data synchronization between the smart pillbox and the mobile terminal is performed in a batch data synchronization mode, a timed data synchronization mode, or a key data synchronization mode, the data synchronization between the smart pillbox and the mobile terminal is performed in a batch data synchronization mode, a timed data synchronization mode, or a key data synchronization mode based on the data synchronization tendency type of the smart pillbox and the mobile terminal and the stability of the real-time connection.
[0057] When the data synchronization tendency type between the smart pillbox and the mobile terminal is strong data synchronization tendency type and the real-time connection stability is less than the preset real-time connection stability, it is determined to perform data synchronization between the smart pillbox and the mobile terminal in batch data synchronization mode.
[0058] When the data synchronization tendency type between the smart pillbox and the mobile terminal is weak data synchronization tendency type and the real-time connection stability is less than the preset real-time connection stability, it is determined to perform data synchronization between the smart pillbox and the mobile terminal in the critical data synchronization mode.
[0059] When the real-time connection stability is greater than or equal to the preset real-time connection stability, the data synchronization between the smart pillbox and the mobile terminal will be performed using a timed data synchronization method.
[0060] In this embodiment of the invention, the preset real-time connection stability level is the average value of the connection stability level between the smart pillbox and the mobile terminal over several preset time periods. The calculation method for the real-time connection stability level is the same as the above-mentioned connection stability level calculation method, but the above value is not limited to this. Those skilled in the art can also adjust the value according to actual needs.
[0061] The batch data synchronization method described in this embodiment of the invention includes dividing the data into multiple batches for synchronization to adapt to unstable connection situations. Assuming that the smart pillbox and mobile terminal have a high data interaction frequency over the past 5 days, exceeding a preset interaction frequency, and the connection stability is lower than a preset stability level, this is determined to be a strong data synchronization tendency type. In a certain real-time connection test, the calculated real-time connection stability is 80%, while the preset real-time connection stability is 85%. At this point, the data to be synchronized is divided into multiple batches according to certain rules, such as by data type or time sequence, and synchronized sequentially to reduce data loss or synchronization failure due to unstable connection. The key data synchronization method includes selecting only key data for synchronization when the smart pillbox and mobile terminal are of the weak data synchronization tendency type and the real-time connection stability is less than the preset real-time connection stability level, to ensure the transmission of important information. For example, only key data such as medication reminder settings and drug inventory thresholds are selected for synchronization to avoid transmitting a large amount of non-critical data under unstable connection, which would lead to low synchronization efficiency or failure. The timed data synchronization method includes performing data synchronization at fixed time intervals when the real-time connection stability is greater than or equal to the preset real-time connection stability level, to ensure regular data updates. For example, after multiple tests, the system is set to perform data synchronization once per hour. At each hour on the hour, the data in the smart pillbox, 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, while also avoiding excessive resource consumption due to overly frequent synchronization.
[0062] This invention selects an appropriate data synchronization method based on the data synchronization tendency type and the stability of the real-time connection. This effectively addresses different network conditions and user needs. For situations with a strong data synchronization tendency and unstable connections, a batch data synchronization method is used, dividing data into multiple batches for transmission. This reduces the amount of data transmitted in a single batch, minimizing the risk of entire batch data transmission failure due to connection anomalies, and improving the success rate and reliability of data synchronization. For example, when network fluctuations are significant, batch transmission avoids long waiting times or data loss caused by transmitting large amounts of data at once. In situations with a weak data synchronization tendency and unstable connections, the critical data synchronization method selects only critical data for synchronization, ensuring that important medication-related information (such as medication reminder settings and drug inventory thresholds) is transmitted to the mobile terminal in a timely and accurate manner. This is crucial for ensuring user medication safety and health management, avoiding the waste of network resources due to the transmission of large amounts of non-critical data, and also reducing the possibility of critical data failure due to network instability. The timed data synchronization method performs data synchronization at fixed time intervals when the connection is stable, ensuring regular data updates without excessively consuming network and device resources. Compared to continuous data synchronization, this method reduces the energy consumption of smart pillboxes and mobile terminals, extends the lifespan of the devices, and also reduces the occupation of network bandwidth, avoiding impact on the normal operation of other network applications.
[0063] Specifically, in step S4, when determining whether to divide the synchronization data for the second time or adjust the synchronization data transmission order, the determination is made based on whether the distribution of abnormal connection time points between the smart medicine box and the mobile terminal is uniform and the amount of data in a single batch.
[0064] When the abnormal connection points between the smart pillbox and the mobile terminal are unevenly distributed and the amount of data in a single batch is greater than the preset amount of data, a second division of synchronized data is determined.
[0065] When the abnormal connection points between the smart pillbox and the mobile terminal are evenly distributed or the amount of data in a single batch is less than or equal to the preset amount of data, the synchronization data transmission order will be adjusted.
[0066] Specifically, in step S4, the step of determining whether the distribution of abnormal connection times between the smart pillbox and the mobile terminal is uniform includes:
[0067] Step S4401: Divide the time period of the connection failure event into multiple time intervals evenly, and count the number of connection failure events in each time interval;
[0068] Step S4402: Calculate the average number of connection exception events within each time interval;
[0069] Step S4403: Compare the absolute value of the difference between the number of connected abnormal events and the average number in each time interval with a preset absolute value of the difference;
[0070] Step S4404: If the absolute value of the difference between the number of connection anomaly events and the average number of connection anomaly events is greater than the absolute value of the preset difference in time intervals, it is determined that the distribution of connection anomaly time points between the smart medicine box and the mobile terminal is uneven.
[0071] In this embodiment of the invention, the connection anomaly events include connection interruption, data transmission failure, and packet loss. The preset data volume is the average value of a single batch of data when synchronizing data between the smart pillbox and the mobile terminal in a batch data synchronization manner over several preset time periods. The secondary division of synchronized data includes dividing the excess data in a single batch according to certain rules based on the actual network conditions and data transmission characteristics. For example, based on data category, different types of data such as medication records, drug information, and device status are separated into multiple small batches; or according to time sequence, data generated within a period of time, such as a week's medication records, is divided into daily small batches of data. To ensure the orderly transmission and correct reassembly of the split data, a specific identifier is added to each newly generated small batch of data. The identifier includes key information such as batch number, total data volume, and original batch, so that the mobile terminal can accurately sort and integrate the data based on the identifier after receiving it. For the data batches after secondary division, the transmission parameters are optimized accordingly. For example, assuming the smart pillbox needs to synchronize a week's worth of medication record data, it was originally planned to be transmitted as a batch, but the calculated data volume is greater than the preset data volume. During transmission, steps S4401-S4404 determine that the distribution of connection anomalies is uneven. At this point, a second data synchronization operation is performed: the week's medication records are divided into 7 small batches by day, each batch containing the medication record data for that day; each small batch is labeled with an identifier, such as batch number 1-7, the total data volume is the original whole batch data volume, and the original batch to which it belongs is the originally planned whole batch data; the transmission rate of each small batch is reduced by 20%.
[0072] The adjustment of the synchronous data transmission order in this embodiment of the invention includes: if the distribution of connection anomaly times exhibits a certain pattern, such as connection anomalies occurring frequently during certain fixed time periods, then important data can be transmitted outside of these time periods, with transmission scheduled during relatively stable connection periods. Less critical data or preparatory work for data transmission can be transmitted during periods where connection anomalies are likely to occur. If the distribution of connection anomaly times is relatively uniform, the order can be adjusted according to the data size and transmission difficulty. Smaller, easier data batches are transmitted first, ensuring that even if connection anomalies occur during transmission, some data has already been successfully transmitted, and the pressure on subsequent transmission recovery is reduced. For larger, more difficult data batches, transmission is only initiated after the smaller data batches have been transmitted and the network condition is good.
[0073] In this embodiment of the invention, the preset absolute difference value is determined by experimentally testing the distribution of connection anomaly events under different network environments. The absolute difference between the number of connection anomaly events and the average number in each time interval is calculated, and a reasonable threshold is selected so that the absolute difference value in most time intervals falls within this threshold range. For example, the range of the preset absolute difference value is set to 0.8-2, and the preferred value is 1.2. The preset quantity is determined by experimental testing to identify the number of time intervals exceeding the preset absolute difference value when the distribution of connection anomaly time points is uneven under different network environments. A reasonable quantity is selected as the preset value. For example, the range of the preset quantity is set to 2-5, and the preferred value is 3. However, the above values are not limited to these, and those skilled in the art can adjust the value according to actual needs.
[0074] This invention, by accurately judging the distribution of connection anomaly times, allows the system to flexibly adjust data synchronization strategies. When the distribution of connection anomaly times is uneven and the amount of data in a single batch is large, a secondary data partitioning strategy is implemented to avoid large amounts of data loss or transmission failure during network anomaly periods due to excessive data transmission at one time. For example, a week's medication records are split and transmitted by day, reducing transmission risk. When the distribution of connection anomaly times is uniform, the data transmission order is adjusted to reasonably arrange the transmission timing of different data batches, reducing the impact of network anomalies on data synchronization. Transmission parameters are optimized according to network conditions. For example, after secondary data partitioning, the transmission rate of each small batch of data is reduced to reduce network congestion, lower the probability of packet loss and connection interruption, adapt to unstable network environments, and improve the success rate of data transmission. The transmission order is adjusted according to data size and transmission difficulty, prioritizing the transmission of data batches with small data volume and relatively easy transmission. Even if connection anomalies occur during transmission, it can ensure that some data is successfully transmitted, reducing the pressure of subsequent transmission recovery and significantly improving the overall efficiency of data synchronization. When connection anomalies exhibit a regular distribution, it avoids transmitting important data during high-risk periods, ensuring the timely synchronization of important data. This 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 that the preset interaction frequency and preset connection stability should be adjusted or the data synchronization interval should be adjusted, the adjustment of the preset interaction frequency and preset connection stability or the data synchronization interval is determined based on the data synchronization accuracy and the data synchronization growth rate within the preset period.
[0076] When the data synchronization accuracy within a preset period is less than the preset synchronization accuracy and the data synchronization growth rate is greater than the preset growth rate, the data synchronization interval will be adjusted.
[0077] When the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the data synchronization growth rate is less than or equal to the preset growth amount, the preset interaction frequency and preset connection stability will be adjusted.
[0078] When the data synchronization accuracy within a 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 this embodiment of the invention, the preset period is set to a range of 10 to 30 days, preferably 20 days. The preset synchronization accuracy is the average of the data synchronization accuracy within several preset periods. The data synchronization accuracy can be determined by the ratio of the amount of successfully synchronized data to the total amount of data. The synchronization data growth rate is determined by the ratio of the amount of synchronized data in the current period to the amount of synchronized data in the previous period. The preset growth rate is the average of the synchronization data growth rate within several preset periods. However, the above values are not limited to these, and those skilled in the art can adjust the values according to actual needs.
[0080] In this embodiment of the invention, adjusting the data synchronization interval includes adjusting the data synchronization interval with a first adjustment coefficient, adjusting the preset interaction frequency includes adjusting the preset interaction frequency with a second adjustment coefficient, and adjusting the preset connection stability includes adjusting the preset connection stability with a third adjustment coefficient. The first adjustment coefficient is set to a value range of 1.04-1.19, preferably 1.11; the second adjustment coefficient is set to a value range of 0.82-0.96, preferably 0.89; and the third adjustment coefficient is set to a value range of 0.86-0.98, preferably 0.91. The adjustment amount of the data synchronization interval is positively correlated with the data synchronization growth rate, the preset interaction frequency is positively correlated with the data synchronization accuracy within a preset period, and the preset connection stability is positively correlated with the data synchronization accuracy within a preset period. However, the values are not limited to these values, and those skilled in the art can adjust them according to actual needs.
[0081] This invention determines its adjustment strategy based on the data synchronization accuracy and data growth rate within a preset period, enabling dynamic adaptation to different data synchronization situations. When the data synchronization accuracy is less than the preset value, the system will adjust the data synchronization interval, preset interaction frequency, or preset connection stability according to the different data growth rates to ensure the accuracy and integrity of data synchronization. For example, if the data synchronization accuracy is low and the data growth rate is high within the preset period, adjusting the data synchronization interval to increase the frequency of synchronization helps improve the data synchronization accuracy, making the amount of successfully synchronized data closer to the total data amount. When the data growth rate is greater than the preset growth rate, it indicates that the data volume is increasing. The data synchronization interval is relatively fast. Adjusting the data synchronization interval at this time can make the system process new data more promptly and avoid synchronization delays or failures due to excessive data accumulation. For example, as the usage time of a smart pillbox increases, the amount of data such as medication records continues to grow. By adjusting the synchronization interval, it can be ensured that newly generated data is synchronized to the mobile terminal in a timely manner. When the data synchronization growth rate is less than or equal to the preset growth rate but the data synchronization accuracy is still lower than the preset value, adjusting the preset interaction frequency and preset connection stability can optimize the data synchronization performance of the system during the relatively stable data growth phase. This invention improves the accuracy of data synchronization and the integrity of data synchronization by improving the accuracy of network environment analysis during data synchronization.
[0082] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles 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 all fall within the scope of protection of the present invention.
Claims
1. A method for synchronizing data between a smart pillbox and a mobile terminal, characterized in that, include: Acquire data synchronization data and connection data between the smart pillbox and the mobile terminal within a preset time before data synchronization; The data synchronization tendency type is determined based on the frequency of data interaction between the smart pillbox and the mobile terminal and the stability of the connection within a preset time before data synchronization. Based on the data synchronization tendency type between the smart pillbox and the mobile terminal and the stability of the real-time connection, it is determined whether to perform data synchronization between the smart pillbox and the mobile terminal in batches or on a timed basis, and based on the stability of the real-time connection, it is determined whether to perform data synchronization between the smart pillbox and the mobile terminal in a critical data synchronization method. When synchronizing data between the smart pillbox and the mobile terminal in batches, the second division of the synchronization data or the adjustment of the synchronization data transmission order is determined based on whether the distribution of connection anomalies between the smart pillbox and the mobile terminal is uniform and the amount of data in a single batch. Based on the data synchronization accuracy and data growth rate within a preset period, the preset interaction frequency and preset connection stability are adjusted, or the data synchronization interval is adjusted. Determining the data synchronization preference type includes: If the data interaction frequency between the smart pillbox and the mobile terminal is greater than the preset interaction frequency and the connection stability is less than the preset stability within a preset time before data synchronization, the data synchronization tendency type is determined to be a strong data synchronization tendency type. If the data interaction frequency between the smart medicine box and the mobile terminal is less than or equal to the preset interaction frequency or the connection stability is greater than or equal to the preset stability within a preset time before data synchronization, the data synchronization tendency type is determined to be a weak data synchronization tendency type. The connection stability is determined based on the packet loss rate and the number of connection interruptions within a preset time period; Based on the data synchronization preference type and real-time connection stability between the smart pillbox and the mobile terminal, the system determines whether to perform data synchronization in batches or on a timed basis. Furthermore, based on the real-time connection stability, it determines whether to perform data synchronization using a critical data synchronization method, including: If the data synchronization tendency type between the smart pillbox and the mobile terminal is strong data synchronization tendency type and the real-time connection stability is less than the preset real-time connection stability, it is determined to perform data synchronization between the smart pillbox and the mobile terminal in batch data synchronization mode. If the data synchronization tendency type between the smart pillbox and the mobile terminal is weak data synchronization tendency type and the real-time connection stability is less than the preset real-time connection stability, then the data synchronization between the smart pillbox and the mobile terminal will be performed using the critical data synchronization method. If the real-time connection stability is greater than or equal to the preset real-time connection stability, the data synchronization between the smart pillbox and the mobile terminal will be performed using a timed data synchronization method.
2. The data synchronization method between the smart pillbox and the mobile terminal according to claim 1, characterized in that, The preset interaction frequency is determined based on the historical average of the data interaction frequency between the smart pillbox and the mobile terminal, and the preset connection stability is determined based on the historical average of the connection stability between the smart pillbox and the mobile terminal.
3. The data synchronization method between the smart pillbox and the mobile terminal according to claim 2, characterized in that, Determining the secondary partitioning of synchronization data or adjusting the synchronization data transmission order includes: If the abnormal connection points between the smart pillbox and the mobile terminal are unevenly distributed and the data volume of a single batch is greater than the preset data volume, a second division of synchronized data will be determined. If the abnormal connection points between the smart pillbox and the mobile terminal are evenly distributed, or if the data volume of a single batch is less than or equal to the preset data volume, the synchronization data transmission order will be adjusted.
4. The data synchronization method between the smart pillbox and the mobile terminal according to claim 3, characterized in that, Determining whether the distribution of abnormal connection times between the smart pillbox and the mobile terminal is uniform includes: The time period in which connection failure events occurred is evenly divided into multiple time intervals, and the number of connection failure events in each time interval is counted. Calculate the average number of connection anomalies within each time interval; The absolute value of the difference between the number of connected abnormal events and the average number in each time interval is compared with the preset absolute value of the difference. If the absolute value of the difference between the number of connection anomaly events and the average number of connection anomalies is greater than the absolute value of the preset difference in time intervals, it is determined that the distribution of connection anomaly time points between the smart pillbox and the mobile terminal is uneven.
5. The data synchronization method between the smart pillbox and the mobile terminal according to claim 4, characterized in that, The connection failure events include connection interruption, data transmission failure, and packet loss.
6. The data synchronization method between the smart pillbox and the mobile terminal according to claim 5, characterized in that, Adjustments may be made to the preset interaction frequency and preset connection stability, or to the data synchronization interval, including: If the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the data synchronization growth rate is greater than the preset growth rate, the data synchronization interval will be adjusted. If the data synchronization accuracy within the preset period is less than the preset synchronization accuracy and the data synchronization growth rate is less than or equal to the preset growth rate, then the preset interaction frequency and preset connection stability will be adjusted.
7. The data synchronization method between the smart pillbox and the mobile terminal according to claim 6, characterized in that, 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 is positively correlated with the data synchronization accuracy within the preset period.
Citation Information
Patent Citations
A distributed data synchronization method
CN109121176B
Data transmission and updating system and method of cloud mobile phone
CN119402886A