Personalized sleep recommendation generation system based on long-term sleep diary data

By analyzing long-term sleep diary data, constructing a sleep window and calculating multi-objective constraint costs, personalized sleep recommendations are generated. This solves the problem that recommendations for insomnia patients do not conform to biological rhythms in existing technologies, and improves the accuracy and adherence of sleep recommendations.

CN122157998APending Publication Date: 2026-06-05ZHEJIANG PROVINCIAL LITONGDE HOSPITAL (ZHEJIANG PROVINCIAL INST OF MENTAL HEALTH)

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG PROVINCIAL LITONGDE HOSPITAL (ZHEJIANG PROVINCIAL INST OF MENTAL HEALTH)
Filing Date
2026-05-07
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing technologies, when generating sleep recommendations, ignore the fragmentation of sleep and its connection with circadian rhythms in insomnia patients. This results in recommendations that do not match the user's internal rhythms, leading to low accuracy and reduced treatment adherence.

Method used

By acquiring long-term sleep diary data, analyzing bed rest, awakening, and getting out of bed events, constructing a sleep schedule window, calculating the matching cost, awakening interference value, and duration compression penalty coefficient, selecting the optimal window, and generating personalized sleep recommendations.

Benefits of technology

We dynamically adjust sleep recommendations to adapt to changes in users' lives, improve sleep quality and compliance, and provide precise sleep advice based on users' actual daily routines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122157998A_ABST
    Figure CN122157998A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of data monitoring and analysis, and particularly relates to a personalized sleep suggestion generation system based on long-term sleep diary data. Daily sleep behavior data of each observation period in a preset time coordinate system is obtained, including bed, wake, sleep and bed exit events; a work-rest window is determined based on the bed and bed exit time points in the data, which is consistent with the actual work-rest rules of the user; then the matching degree of actual effective sleep and the work-rest window is accurately evaluated, and the matching cost of each work-rest window is obtained; the distribution of wake events is analyzed, and the wake disturbance is calculated; the deviation accumulation of sleep duration and preset requirements is analyzed, and the duration compression penalty coefficient is calculated; these indicators provide a basis for selecting the optimal window; then the optimal window is selected by comprehensively considering the various indicators, and the bed and bed exit events of the next observation period are dynamically adjusted according to the difference between the optimal window and the data in the latest observation period, so as to assist the user in maintaining good sleep habits and improving sleep quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data monitoring and analysis technology, specifically to a personalized sleep suggestion generation system based on long-term sleep diary data. Background Technology

[0002] Sleep quality has a crucial impact on people's physical and mental health, work efficiency, and quality of life. However, due to various reasons such as life stress, unhealthy lifestyle habits, and environmental factors, more and more people are facing various sleep problems, such as insomnia, insufficient sleep, and irregular sleep patterns. Therefore, generating personalized sleep suggestions based on each user's specific situation and needs can effectively improve the pertinence and effectiveness of sleep advice.

[0003] Existing technologies for monitoring users' sleep and generating sleep recommendations typically employ linear ladder algorithms based on average sleep efficiency. These algorithms compare the average sleep efficiency over a user's historical time period with a preset threshold, thus simply increasing or decreasing bedtime. However, in real-world scenarios, insomniacs' sleep is often fragmented and discontinuous, and these fragmented occurrences are usually closely related to the user's circadian rhythm. Linear algorithms, on the other hand, typically only focus on total duration, ignoring the dynamic changes in sleep over time. Consequently, the generated sleep recommendations are highly prone to misalignment with the user's internal circadian rhythm, resulting in low accuracy and significantly reducing user adherence to treatment. Summary of the Invention

[0004] To address the challenges of fragmented and discontinuous sleep patterns in real-world insomnia, where these fragments are often closely linked to the user's circadian rhythm, and the fact that linear algorithms typically focus only on total duration while ignoring the dynamic changes in sleep over time—resulting in sleep recommendations that are prone to misalignment with the user's internal circadian rhythm, leading to low accuracy and significantly reduced treatment adherence—this invention aims to provide a personalized sleep recommendation generation system based on long-term sleep diary data. The specific technical solution adopted is as follows: The data acquisition module is used to acquire daily sleep behavior data within each observation period of a preset time coordinate system; the daily sleep behavior data includes bed rest events, awakening events, sleep events, and getting out of bed events; The sleep schedule window filtering module is used to determine the sleep schedule window based on the time points of bed-lying events and out-of-bed events in the daily sleep behavior data within the observation period; The multi-objective constraint cost calculation module is used to extract effective sleep segments from all observation periods based on sleep events and match them with each sleep window to determine the matching cost; based on the distribution of wakefulness events on the time axis in all observation periods, the module calculates the wakefulness interference value of each sleep window in conjunction with the time period of the sleep window; it analyzes the cumulative deviation between the duration of sleep events and the preset required duration in the daily sleep behavior data within the observation period, and combines it with the length characteristics of the sleep window to calculate the duration compression penalty coefficient; The sleep suggestion generation module is used to select the optimal window by comprehensively considering the matching cost, arousal interference value and duration compression penalty coefficient of each sleep window; and adjust the bed rest events and out-of-bed events in the next observation period by using the difference between the optimal window and the daily sleep behavior data in the latest observation period, thereby generating sleep suggestions.

[0005] Furthermore, the method for obtaining the schedule window includes: In the last observation period, the mean of the start time of bedtime in all daily sleep behavior data was used as the bedtime anchor point, and the mean of the start time of the out-of-bed event in all daily sleep behavior data was used as the out-of-bed anchor point. Each search period is constructed in a preset time coordinate system with the bed rest anchor point and the bed leave anchor point as the center. The search period of the bed rest anchor point is divided with a preset step size to obtain the set of bed rest time points. The search period of the bed leave anchor point is divided with a preset step size to obtain the set of bed leave time points. In the set of bed rest time points and the set of bed alighting time points, time points are matched across sets to obtain all unique matching point pairs; In each matching point pair, the difference between the time point of getting out of bed and the time point of going to bed is calculated as the rest duration. When the rest duration of a certain matching point pair is within the preset rest range, the time period between the time point of going to bed and the time point of getting out of bed corresponding to the matching point pair is taken as a rest window.

[0006] Furthermore, the method for obtaining the effective sleep segments includes: In the daily sleep behavior data within each observation period, if the duration of a certain sleep event is greater than or equal to the preset effective sleep duration threshold, then the sleep event is considered a valid sleep event, and the time period corresponding to the valid sleep event is considered a valid sleep segment.

[0007] Furthermore, the method for obtaining the matching cost includes: Each effective sleep segment is divided into several sleep slices according to a preset length, and the midpoint time in each sleep slice is taken as the central phase. In each work and rest window, the time period of the work and rest window is divided into several time slices according to a preset length, and the midpoint time in each time slice is used as the center time of each time slice; The sleep slice is used as the source node and the time slice is used as the target node. The total number of sleep slices and the total number of time slices in each sleep window are compared. If the number is the same, a matching weight matrix is ​​constructed. If the number is not the same, virtual nodes are added until the number is the same and then a matching weight matrix is ​​constructed. In the matching weight matrix, for any position, if neither the source node nor the target node corresponding to that position is a virtual node, then the absolute value of the difference between the center phase of the source node and the center time of the target node corresponding to that position is used as the element value of that position. If the source node corresponding to this position is a virtual node, then the element value at this position is set to the null cost constant; if the target node corresponding to this position is a virtual node, then the element value at this position is set to the discard penalty constant. The KM algorithm is used to solve the matching weight matrix corresponding to each rest window, and the normalized value of the minimum total weight is used as the matching cost of each rest window.

[0008] Furthermore, the method for obtaining the arousal interference value includes: Based on the temporal distribution of awakening time in a preset time coordinate system within all observation periods, the awakening probability density function is calculated. The arousal probability density function is used to calculate the definite integral over the corresponding time period of each sleep window, and the normalized value is used as the arousal interference value for each sleep window.

[0009] Furthermore, the method for obtaining the arousal probability density function includes: The preset time coordinate system is divided into multiple time grids according to the preset time step. The awakening events of daily sleep behavior data in all observation periods are traversed, and the frequency of awakening events entering each time grid is counted to obtain the original frequency sequence. The original frequency sequence is smoothed and normalized to obtain the arousal probability density function.

[0010] Furthermore, the method for obtaining the duration compression penalty coefficient includes: Analyze the cumulative deviation between the duration of sleep events and the preset required duration in the daily sleep behavior data within the observation period, and determine the cumulative sleep deficit value corresponding to the next observation period; The value obtained by negatively mapping the difference between the length of each rest window and the preset critical length is used as the duration penalty compression factor for each rest window. The normalized value of the product of the duration penalty compression factor of each sleep window and the cumulative sleep deficit is used as the duration compression penalty coefficient of each sleep window.

[0011] Furthermore, the method for obtaining the cumulative sleep deficit includes: For each observation period, the length and value of all sleep events in the daily sleep behavior data are taken as the daily sleep duration, and the average of the daily sleep durations of all days is taken as the average daily sleep duration. Calculate the difference between the preset required duration and the average daily sleep duration for each observation period. If the difference is not positive, record the sleep deficit factor for each observation period as 0; otherwise, record the difference as the sleep deficit factor for each observation period. In terms of time sequence, the sum of the sleep deficit factors of all observation periods is used as the cumulative sleep deficit value for the next observation period.

[0012] Furthermore, the method for obtaining the optimal window includes: The matching cost, arousal interference value, and duration compression penalty coefficient of each rest window are weighted using the preset proportion weights corresponding to the matching cost, arousal interference value, and duration compression penalty coefficient. The weighted result is used as the comprehensive cost value of each rest window. The work and rest window corresponding to the minimum comprehensive cost is taken as the optimal window.

[0013] Furthermore, the step of adjusting bed rest and get-out-of-bed events in the next observation period based on the difference between the optimal window and the daily sleep behavior data in the latest observation period to generate sleep recommendations includes: The starting coordinates are formed by the bed rest anchor point and the bed exit anchor point, and the ending coordinates are formed by the start time and end time of the optimal window. The difference between the start time of the optimal window and the bed rest anchor point is used as the bed rest anchor point adjustment component, and the difference between the end time of the optimal window and the bed leave anchor point is used as the bed leave anchor point adjustment component. The bed rest anchor point adjustment component and the bed exit anchor point adjustment component are collectively referred to as the component to be adjusted. For any component to be adjusted, if the absolute value of the component to be adjusted is greater than the preset adjustment time, the component to be adjusted is processed by the sign function and multiplied by the preset adjustment time. The product is used as the actual adjustment component. If the absolute value of the component to be adjusted is less than or equal to the preset adjustment time, the component to be adjusted is used as the actual adjustment component. The sum of the bed rest anchor point and the corresponding actual adjustment component is used as the suggested bed rest time, and the sum of the bed exit anchor point and the corresponding actual adjustment component is used as the suggested bed exit time.

[0014] The present invention has the following beneficial effects: In the data acquisition module, daily sleep behavior data for each observation period within a preset time coordinate system is acquired, covering events such as lying in bed, waking up, sleeping, and getting out of bed. In the sleep schedule window filtering module, the sleep schedule window is determined based on the time points of lying in bed and getting out of bed events within the daily sleep behavior data within the observation period. This method, based on actual sleep behavior data, can more accurately identify the user's possible sleep schedule time periods, allowing sleep recommendations to be tailored to the user's actual sleep patterns. Furthermore, in the multi-objective constraint cost calculation module, the degree of fit between the user's actual effective sleep and the sleep schedule window is accurately evaluated to obtain the matching cost; the distribution of waking events on the time axis is analyzed, and waking interference is calculated in conjunction with the time periods of the sleep schedule window; simultaneously, the cumulative deviation between the duration of sleep events and the preset required duration in the daily sleep behavior data within the observation period is analyzed to calculate the duration compression penalty coefficient. Through this quantitative evaluation, the sleep matching situation and the degree of waking interference under different sleep schedule windows can be clearly understood, providing an important basis for selecting the optimal window. Finally, in the sleep suggestion generation module, by integrating the aforementioned multiple indicators, the advantages and disadvantages of each sleep window can be comprehensively evaluated, thereby selecting the optimal window. The differences between the optimal window and the daily sleep behavior data in the latest observation period are then used to adjust the bedtime and out-of-bed events for the next observation period. This allows for dynamic generation of sleep suggestions based on real-time changes in the user's sleep status. This dynamic adjustment mechanism can promptly adapt to the impact of changes in the user's lifestyle and health status on sleep, helping users maintain good sleep habits and continuously improve sleep quality. Attached Figure Description

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

[0016] Figure 1 This is a system block diagram of a personalized sleep suggestion generation system based on long-term sleep diary data provided in one embodiment of the present invention; Figure 2 This is a schematic diagram of the system structure of a personalized sleep suggestion generation system based on long-term sleep diary data provided in an embodiment of the present invention. Detailed Implementation

[0017] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a personalized sleep suggestion generation system based on long-term sleep diary data proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0019] The following description, in conjunction with the accompanying drawings, details a specific scheme for a personalized sleep suggestion generation system based on long-term sleep diary data provided by the present invention.

[0020] Please see Figure 1 The diagram illustrates a system block diagram of a personalized sleep suggestion generation system based on long-term sleep diary data according to an embodiment of the present invention. The system includes: a data acquisition module 101, a schedule window filtering module 102, a multi-objective constraint cost calculation module 103, and a sleep suggestion generation module 104.

[0021] The data acquisition module 101 is used to acquire daily sleep behavior data within each observation period of a preset time coordinate system; the daily sleep behavior data includes bed rest events, awakening events, sleep events and getting out of bed events.

[0022] First, the system receives raw sleep diary data input by the user. The sleep diary data records the user's subjective daily routine time points, including the time of going to bed, the time of falling asleep, the time of waking up at night, and the time of finally waking up / getting out of bed. The sleep diary data can be recorded by the user or collected and recorded through devices such as smart bracelets or smartwatches.

[0023] Daily sleep behavior data can be determined based on sleep diary data, which includes time spent in bed, wake-up time, sleep events, and time spent out of bed. Bedtime events correspond to the recorded "time to go to bed", and out-of-bed events correspond to the recorded "time to wake up / get out of bed". Wake-up events are the wake-up time intervals between the "time to fall asleep" and the "time to wake up", which are explicitly recorded by the user. Sleep events correspond to the continuous time interval between the user's "time to fall asleep" and the "time to wake up", after deducting all "nighttime wake-up periods".

[0024] Meanwhile, since sleep behavior typically spans past midnight (e.g., from 11:00 PM to 7:00 AM the next day), directly using the traditional 24-hour clock (00:00-23:59) for mathematical calculations can lead to numerical discontinuities (e.g., errors are easily made when calculating the time difference between 11:00 PM and 1:00 AM the next day). To address this issue, this embodiment of the invention establishes a monotonically increasing continuous numerical time coordinate system (a preset time coordinate system), the domain of which is set to the real number interval. Among them, the numerical values The value at 12:00 noon on that day The value corresponds to midnight 00:00 on that day. This corresponds to 12:00 noon the following day, and this interval can completely cover a standard nighttime sleep cycle. After obtaining the user's daily sleep behavior data within each observation period (in this embodiment, one observation period is set to 7 days, and the number of observation periods is set to 4), for each raw time point recorded in the diary... (In HH:MM format), the following mapping operations can be performed to convert it to a value in a preset time coordinate system. : Daily time mapping: If For values ​​between 12:00 and 23:59 on the same day, directly extract the hours and minutes using the following formula: For example, 23:30 is converted to Next day time mapping: If For transactions occurring between 00:00 and 12:00 the following day, an additional 24.0 needs to be added to the above calculation. The calculation formula is as follows: For example, 01:30 the next day is converted to .

[0025] Through the above processing, the time breaks across days can be eliminated in all daily sleep behavior data, so that all subsequent calculations (such as duration and time difference) can be performed directly through numerical calculation.

[0026] In the embodiments of the present invention, the collection and acquisition of personal information data are authorized by the relevant users, and the process does not violate relevant laws and regulations, nor does it violate public order and good morals.

[0027] The schedule window filtering module 102 is used to determine the schedule window based on the time points of bed-lying events and bed-getting events in the daily sleep behavior data within the observation period.

[0028] If rest and activity suggestions are generated arbitrarily within a 24-hour period, it is easy to produce "outrageous" suggestions that are detached from the user's actual lifestyle. Therefore, the core of this module is to determine a reasonable search space and generate a series of candidate rest and activity suggestions, i.e., rest and activity windows, within this space. This provides a preliminary screening scheme for the subsequent analysis process, while ensuring that sleep suggestions are based on the user's actual rest and activity patterns.

[0029] Preferably, in one embodiment of the present invention, the method for obtaining the schedule window includes: In the last observation period, the mean of the start time of bedtime in all daily sleep behavior data is used as the bedtime anchor point, and the mean of the start time of the out-of-bed event in all daily sleep behavior data is used as the out-of-bed anchor point. Using the mean to determine the bedtime anchor point and the out-of-bed anchor point can avoid the interference of abnormal daily routines and accurately capture the user's core routine phase.

[0030] Given that Cognitive Behavioral Therapy for Insomnia (CBT-I) emphasizes gradual adjustment and discourages sudden changes in sleep patterns beyond a certain range, separate search periods are constructed within a preset time coordinate system, centered on the bed-staying anchor point and the bed-getting anchor point. These search periods limit the range of subsequent sleep recommendations, preventing the generation of "overly aggressive" or "unconventional" suggestions. After obtaining the corresponding search periods, the search periods for the bed-staying anchor point are divided with a preset step size to obtain a set of bed-staying time points. Similarly, the search periods for the bed-getting anchor point are divided with a preset step size to obtain a set of bed-getting time points. In this embodiment of the invention, the length of the search period is set to 3 hours, and the preset step size is set to 0.25 hours.

[0031] Then, in the set of bed rest time points and the set of bed alighting time points, time points are matched across sets to obtain all non-repeating matching point pairs. In this embodiment of the invention, the matching point pair is in the form of (bed rest time point, bed alighting time point).

[0032] To ensure physiological safety, strict constraints need to be imposed on each matching point pair to filter the rest window. Within each matching point pair, the difference between the time of getting out of bed and the time of going to bed is calculated as the rest duration. Too short a rest duration may lead to severe sleep deprivation, causing excessive fatigue or even accidental risks. Conversely, an excessive rest duration will reduce sleep drive, leading to more awakenings in bed. Therefore, only when the rest duration of a matching point pair is within a preset rest range is the period between the time of going to bed and the time of getting out of bed corresponding to that matching point considered as a rest window. In this embodiment of the invention, the preset rest range is set between the minimum physiological maintenance duration (4.5 hours) and the maximum bed rest duration (9.0 hours).

[0033] The multi-objective constraint cost calculation module 103 is used to extract effective sleep segments within all observation periods based on sleep events and match them with each sleep window to determine the matching cost; based on the distribution of wakefulness events on the time axis within all observation periods, the wakefulness interference value of each sleep window is calculated in conjunction with the time period of the sleep window; the cumulative deviation between the duration of sleep events and the preset required duration in the daily sleep behavior data within the observation period is analyzed and combined with the length characteristics of the sleep window to calculate the duration compression penalty coefficient.

[0034] In the aforementioned module, all sleep windows that conform to the user's lifestyle can be initially identified. In this module, the advantages and disadvantages of each sleep window can be quantitatively evaluated from multiple aspects. Since the traditional CBT-I algorithm only looks at the total duration, it is easy to shift the user's sleep events to periods that they are not used to, resulting in time differences that do not conform to the user's lifestyle. Therefore, in this module, effective sleep segments within all observation periods are first extracted based on sleep events, and then matched with each sleep window to determine the matching cost, which is used to quantify the overlap between sleep segments and sleep windows on the time axis.

[0035] Preferably, in one embodiment of the present invention, the method for obtaining the matching cost includes: Insomnia sufferers' sleep is typically fragmented, containing many very short light sleep segments. These segments do not represent steady-state sleep capacity. Therefore, in the daily sleep behavior data within each observation period, if the duration of a sleep event is less than a preset effective sleep duration threshold, the sleep event is considered an invalid sleep event. If the duration of a sleep event is greater than or equal to the preset effective sleep threshold, the sleep event is considered a valid sleep event, and the time period corresponding to the valid sleep event is considered a valid sleep segment. In this embodiment of the invention, the preset effective sleep duration threshold is 0.5 hours. The specific value can be adjusted according to the implementation scenario and is not limited here.

[0036] Because effective sleep segments vary in length, but the length of the sleep-wake window is fixed, direct matching can easily lead to information loss. Therefore, each effective sleep segment is divided into several sleep slices according to a preset length, and the midpoint of each sleep slice is used as the central phase. The central phase reflects the center of gravity of sleep occurrence in each sleep slice and can represent the user's circadian rhythm phase. Simultaneously, within each sleep-wake window, the time period is also divided into several time slices according to a preset length, and the midpoint of each time slice is used as the central time. In this embodiment of the invention, the preset length is set to 1.5 hours. The specific value can be adjusted according to the implementation scenario and is not limited here. If there is a remaining portion that is less than one preset length during the division process, it is retained if it exceeds half of the preset length; otherwise, it is discarded.

[0037] Then, dimension completion can be performed to construct a matching weight matrix: sleep slices are used as source nodes, time slices as target nodes, and the total number of sleep slices is compared with the total number of time slices for each sleep window. If the numbers match, the matching weight matrix can be directly constructed; otherwise, virtual nodes need to be added until the numbers are the same before constructing the matching weight matrix. For example: number of source nodes. With the target number of nodes Inconsistency issues, build a The square matrix is ​​used as the cost matrix, where, .like System Add A virtual source node; if System Add A virtual target node.

[0038] In the matching weight matrix, for any position, if neither the source node nor the target node corresponding to that position is a virtual node, it means that both are real slices. Then, the absolute value of the difference between the center phase of the source node and the center time of the target node corresponding to that position is calculated as the element value of that position, which is used to characterize the cost of matching the source node to the target node. The smaller the value, the smaller the deviation of the center phase and the center time in the preset time coordinate system, the higher the phase matching degree, and the lower the cost.

[0039] If the source node corresponding to this position is a virtual node, it means that the number of sleep slices is less than the number of time slices, which means that there are blank periods in the schedule window that are not filled by effective sleep segments. In this case, the element value at this position is set to the null cost constant (set to 0.25 hours in this embodiment of the invention). If the target node corresponding to this position is a virtual node, it means that the schedule window is too short to accommodate effective sleep segments, resulting in some sleep slices being discarded. Therefore, the element value at this position is set to the discard penalty constant (set to 4 hours in this embodiment of the invention).

[0040] At this point, the matching weight matrix can be constructed, where each element represents the cost of matching the source node to the target node; a larger value indicates a higher matching cost. Finally, the KM algorithm is used to solve for the matching weight matrix corresponding to each sleep window. The normalized minimum total weight value is used as the matching cost for each sleep window. The matching cost comprehensively reflects the sleep window's ability to retain effective sleep segment phases; a smaller value indicates a higher degree of matching and a lower matching cost. The normalization process here can use a maximum-minimum normalization method, where the maximum value is the maximum of the minimum total weight values ​​for all sleep windows, and the minimum value is determined similarly.

[0041] It should be noted that the KM algorithm is a well-known technique, and the specific process will not be described in detail here.

[0042] Insomnia sufferers not only have difficulty falling asleep, but also often have difficulty maintaining sleep, frequently experiencing nighttime awakenings and difficulty falling back asleep. Therefore, by statistically analyzing the distribution of awakening times on the timeline across all observation periods and calculating the awakening interference value for each sleep window in conjunction with the time periods of the sleep window, we can determine the probability that the sleep window covers a high-risk period for awakening, which can be used to characterize the potential risk level of unexpected awakening events occurring within that sleep window.

[0043] Preferably, in one embodiment of the present invention, the method for obtaining the arousal interference value includes: Based on the temporal distribution of wakefulness times across all observation periods on a preset time coordinate system, the wakefulness probability density function is calculated: the preset time coordinate system is divided into multiple time grids according to a preset time step (e.g., 0.25 hours). Then, the wakefulness events of daily sleep behavior data within all observation periods are traversed, and the frequency of wakefulness events entering each time grid is counted to obtain the original frequency sequence. The higher the frequency of wakefulness events within a certain time grid, the more likely the corresponding time period is the user's most awake time. A Gaussian smoothing algorithm is used to smooth and normalize the original frequency sequence to obtain the wakefulness probability density function, the domain of which is... The range is The larger the function value, the higher the statistical probability of awakening at the corresponding moment.

[0044] Definite integral operations can calculate the area of ​​the arousal probability density function over each corresponding time period of the sleep-wake cycle. This area represents the cumulative probability of an arousal event occurring within that sleep-wake cycle. By calculating this cumulative value, the overall likelihood of an arousal event occurring within that sleep-wake cycle can be quantified. Therefore, the arousal probability density function is calculated by performing a definite integral over each corresponding time period of the sleep-wake cycle. The normalized value is then used as the arousal interference value for each sleep-wake cycle. The larger the arousal interference value, the higher the probability of arousal within that sleep-wake cycle, and the greater the degree of interference with sleep. The normalization process here can use the maximum-minimum normalization method. The maximum value is the maximum value of the definite integral values ​​for all sleep-wake cycles, and the minimum value is calculated similarly.

[0045] It should be noted that the Gaussian smoothing algorithm is a well-known technique, and the specific process will not be described in detail here.

[0046] The physical condition of insomnia users is not only affected by their sleep status on a single night, but also by long-term sleep deprivation. Therefore, in order to accurately reflect the impact of accumulated sleep debt on the user's sleep quality, in this embodiment of the invention, the cumulative deviation between the duration of sleep events and the preset required duration in the sleep behavior data within the observation period was analyzed and combined with the length feature of the sleep schedule window to calculate the duration compression penalty coefficient.

[0047] Preferably, in one embodiment of the present invention, the method for obtaining the duration compression penalty coefficient includes: The cumulative deviation between the duration of sleep events and the preset required duration in the daily sleep behavior data during the observation period is analyzed to determine the cumulative sleep deficit value for the next observation period. First, for each observation period, the length and value of all sleep events in the daily sleep behavior data are taken as the daily sleep duration, and the average of the daily sleep duration of all days is taken as the average daily sleep duration. The average daily sleep duration is used to macroscopically assess the sleep ability of insomnia users in each observation period.

[0048] Then, the difference between the preset required sleep duration and the average daily sleep duration for each observation period is calculated. If the difference is negative or 0, it indicates that the actual sleep duration has reached or exceeded the preset required sleep duration, and there is no sleep deficit. Therefore, the sleep deficit factor for each observation period is recorded as 0. Conversely, if the difference is positive, it indicates that the actual sleep duration is insufficient, and there is a sleep deficit. Therefore, the difference is recorded as the sleep deficit factor for each observation period. The larger the sleep deficit factor, the more severe the sleep insufficiency and the higher the degree of deficit. In this embodiment of the invention, the preset required sleep duration is set to 6 hours. The specific value can be adjusted according to the user's age group and is not limited here.

[0049] In terms of time sequence, the sum of the sleep deficit factors of all observation periods is used as the cumulative sleep deficit value of the next observation period. The cumulative sleep deficit value integrates the sleep deficit situation of multiple observation periods and can reflect the long-term cumulative degree of sleep deficit of users over a period of time. The larger the value, the more severe the sleep insufficiency.

[0050] The difference between the length of each sleep window and a preset critical length is calculated. The preset critical length represents a reasonable lower limit for sleep duration. The smaller the difference, the closer the sleep window length is to the critical value, and the higher the risk of compressing sleep duration. Therefore, this difference is negatively correlated to correct the logical relationship and serve as a duration penalty compression factor for each sleep window. The larger the duration penalty compression factor, the greater the degree of compression of the user's sleep duration by that sleep window, and the higher the negative impact. This negative correlation mapping can be in the form of a ratio, such as... , where x represents the independent variable.

[0051] Finally, the normalized value of the product of the duration penalty compression factor and the cumulative sleep deficit for each sleep window is used as the duration compression penalty coefficient for each sleep window. This coefficient comprehensively considers both the user's long-term sleep deficit and the specific duration of each sleep window. It reflects both the individual's past sleep debt and the potential impact of the current sleep window on sleep duration. A larger value indicates lower effectiveness of the sleep recommendations for that sleep window. The normalization process here can use a maximum-minimum normalization method. The maximum value is the maximum product of the duration penalty compression factor and the cumulative sleep deficit for all sleep windows, and the minimum value is calculated similarly.

[0052] It should be noted that in this embodiment of the present invention, the preset critical length is set to 4 hours, which can be adjusted according to the implementation scenario, but should be strictly less than the lower limit of the preset rest range.

[0053] The sleep suggestion generation module 104 is used to select the optimal window by comprehensively considering the matching cost, arousal interference value and duration compression penalty coefficient of each sleep window; and adjust the bed rest events and bed out events in the next observation period by using the difference between the optimal window and the daily sleep behavior data in the latest observation period, thereby generating sleep suggestions.

[0054] The matching cost of the sleep window reflects the degree to which the sleep window adapts to an individual's daily activities and circadian rhythms; the arousal interference value measures the potential arousal interference within the sleep window; and the duration compression penalty coefficient reflects an individual's long-term sleep deficit and the potential impact of the sleep window duration on sleep. Therefore, by comprehensively evaluating these three indicators, the merits of each sleep window can be measured from different perspectives, thereby selecting the truly optimal sleep window.

[0055] Preferably, in one embodiment of the present invention, the method for obtaining the optimal window includes: The higher the matching cost of a sleep schedule window, the greater the conflict between that window and the user's normal life rhythm, which may cause discomfort or difficulty in adhering to the schedule. The higher the arousal interference value, the more likely the user is to wake up during the corresponding time period of the sleep schedule window, with more interfering factors and a greater negative impact on sleep quality. The higher the duration compression penalty coefficient, the more likely the sleep schedule window may not meet the user's sleep needs and is not conducive to recovering from sleep debt. Therefore, the above three indicators are negatively correlated with the probability of the sleep schedule window being the optimal window. Therefore, we use the preset weights of matching cost, arousal interference value, and duration compression penalty coefficient to weight the matching cost, arousal interference value, and duration compression penalty coefficient of each sleep schedule window, and the weighted result is used as the comprehensive cost value of each sleep schedule window. Based on the above analysis, it can be seen that the higher the comprehensive cost value, the lower the probability that the sleep schedule window is the final optimal window. The weighted fusion process here is explained as follows: The matching cost of each rest window is multiplied by the preset weight corresponding to the matching cost, and this multiplication is used as a weighting index. The same applies to the arousal interference value and the duration compression penalty coefficient. The sum of the three weighted indices is used as the comprehensive cost of the rest window. Finally, the rest window with the minimum comprehensive cost is taken as the optimal window.

[0056] It should be noted that in this embodiment of the present invention, the preset percentage weight of the matching cost is set to 0.4, the preset percentage weight of the awakening interference value is set to 0.3, and the preset percentage weight of the duration compression penalty coefficient is also set to 0.3. The specific values ​​can be adjusted according to the implementation scenario and are not limited here.

[0057] Since each user's sleep habits and behavior patterns are different, and the daily sleep behavior data in the latest observation period reflects the individual's current sleep status and habits, after selecting the optimal window, the difference between the optimal window and the daily sleep behavior data in the latest observation period can be analyzed. This difference can then be used to adjust the bed-staying and bed-getting events in the next observation period, thereby generating sleep suggestions that are more in line with the individual user's actual situation.

[0058] Preferably, in one embodiment of the present invention, the difference between the optimal window and the daily sleep behavior data in the latest observation period is used to adjust the bed rest events and bed exit events in the next observation period, thereby generating sleep suggestions, including: The starting coordinates are formed by the bed rest anchor point and the bed exit anchor point, and the ending coordinates are formed by the start and end times of the optimal window. The starting coordinates represent the user's current sleep habits, and the ending coordinates represent the sleep habits that the user is expected to achieve.

[0059] However, in the actual process of adjusting sleep habits, it is also necessary to consider the inertial influence of the human body's biological clock. Therefore, a safe and smooth transition path needs to be planned. Thus, the difference between the start time of the optimal window and the bed rest anchor point was calculated as the bed rest anchor point adjustment component, and the difference between the end time of the optimal window and the get-out anchor point was calculated as the get-out anchor point adjustment component. These two adjustment components reflect the difference between the actual bed rest time and the optimal bed rest time, and the difference between the actual get-out time and the optimal get-out time, respectively. When the value is positive and the larger it is, it indicates that the actual time is earlier than the optimal time, and the degree of delay is greater. When the value is negative and the smaller it is, it indicates that the actual time is later than the optimal time, and the degree of advancement is greater. The sign represents the adjustment direction.

[0060] The bed rest anchor point adjustment component and the bed exit anchor point adjustment component are collectively referred to as the component to be adjusted. For any component to be adjusted, if the absolute value of the component to be adjusted is greater than the preset adjustment duration, it indicates that the theoretically obtained adjustment degree of the component to be adjusted may exceed the physiological tolerance limit. In this case, the adjustment direction needs to be kept unchanged, but the adjustment degree needs to be limited to the maximum range. Therefore, the component to be adjusted is processed by a sign function and multiplied by the preset adjustment duration, and the product is used as the actual adjustment component. Conversely, if the absolute value of the component to be adjusted is less than or equal to the preset adjustment duration, it indicates that the adjustment degree of the component to be adjusted is within the safe range, so the component to be adjusted is directly used as the actual adjustment component. The preset adjustment duration is set to 0.25 hours. This value is based on the natural reset capability of the suprachiasmatic nucleus (SCN) of the human body for the light cycle. The specific value can also be adjusted according to the implementation scenario, and is not limited here.

[0061] Finally, the sum of the bed rest anchor point and its corresponding actual adjustment component is used as the suggested bed rest time, and the sum of the bed exit anchor point and its corresponding actual adjustment component is used as the suggested bed exit time. Since the suggested bed rest time and suggested bed exit time are values ​​in a preset time coordinate system, they need to be converted to 24-hour format when displayed through the client interface. The specific conversion logic is as follows: A modulo operation is performed on 24. This operation restores values ​​greater than 24.0 (next day's time) to values ​​between 0 and 12, while values ​​less than 24.0 remain unchanged. Then, formatting is performed: the integer part of the time is used as the hour, and the decimal part is multiplied by 60 to obtain the minute. For example, if the suggested bed rest time is 25.25, then 25.25mod|24.0=1.25, the integer part is 1, and the decimal part is 0.25×60=15. The final displayed time will be 01:15 of the next day.

[0062] In summary, the data acquisition module obtains daily sleep behavior data for each observation period within a preset time coordinate system, covering events such as lying in bed, waking up, sleeping, and getting out of bed. The sleep schedule window selection module determines the sleep schedule window based on the time points of lying in bed and getting out of bed events within the daily sleep behavior data within the observation period. This method, based on actual sleep behavior data, can more accurately identify the user's possible sleep schedule time periods, allowing sleep recommendations to be tailored to the user's actual sleep patterns. Furthermore, the multi-objective constraint cost calculation module accurately assesses the degree of fit between the user's actual effective sleep and the sleep schedule window, obtaining the matching cost; it analyzes the distribution of waking events on the time axis, calculating waking interference in conjunction with the time periods of the sleep schedule window; simultaneously, it analyzes the cumulative deviation between the duration of sleep events and the preset required duration within the daily sleep behavior data within the observation period, calculating the duration compression penalty coefficient. Through this quantitative evaluation, we can clearly understand the user's sleep matching situation and the degree of waking interference under different sleep schedule windows, providing an important basis for selecting the optimal window. Finally, in the sleep suggestion generation module, by integrating the aforementioned multiple indicators, the advantages and disadvantages of each sleep window can be comprehensively evaluated, thereby selecting the optimal window. The differences between the optimal window and the daily sleep behavior data in the latest observation period are then used to adjust the bedtime and out-of-bed events for the next observation period. This allows for dynamic generation of sleep suggestions based on real-time changes in the user's sleep status. This dynamic adjustment mechanism can promptly adapt to the impact of changes in the user's lifestyle and health status on sleep, helping users maintain good sleep habits and continuously improve sleep quality.

[0063] Please see Figure 2 This diagram illustrates a system architecture of a personalized sleep suggestion generation system based on long-term sleep diary data according to an embodiment of the present invention. The system includes a processor 200, a memory 201, a bus 202, and a communication interface 203. The processor 200, communication interface 203, and memory 201 are connected via the bus 202. The memory 201 may contain high-speed random access memory, and the bus 202 may be an ISA bus, PCI bus, or EISA bus, etc. The processor 200 may be an integrated circuit chip with signal processing capabilities. The memory 201 stores at least one instruction, at least one program, code set, or instruction set. When the processor loads and executes the at least one instruction, at least one program, code set, or instruction set, it implements the steps in the aforementioned modules.

[0064] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0065] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0066] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A personalized sleep suggestion generation system based on long-term sleep diary data, characterized in that, The system includes: The data acquisition module is used to acquire daily sleep behavior data within each observation period of a preset time coordinate system; the daily sleep behavior data includes bed rest events, awakening events, sleep events, and getting out of bed events; The sleep schedule window filtering module is used to determine the sleep schedule window based on the time points of bed-lying events and out-of-bed events in the daily sleep behavior data within the observation period; The multi-objective constraint cost calculation module is used to extract effective sleep segments from all observation periods based on sleep events and match them with each sleep window to determine the matching cost; based on the distribution of wakefulness events on the time axis in all observation periods, the module calculates the wakefulness interference value of each sleep window in conjunction with the time period of the sleep window; it analyzes the cumulative deviation between the duration of sleep events and the preset required duration in the daily sleep behavior data within the observation period, and combines it with the length characteristics of the sleep window to calculate the duration compression penalty coefficient; The sleep suggestion generation module is used to select the optimal window by comprehensively considering the matching cost, arousal interference value and duration compression penalty coefficient of each sleep window; and adjust the bed rest events and out-of-bed events in the next observation period by using the difference between the optimal window and the daily sleep behavior data in the latest observation period, thereby generating sleep suggestions.

2. The personalized sleep suggestion generation system based on long-term sleep diary data according to claim 1, characterized in that, The methods for obtaining the schedule window include: In the last observation period, the mean of the start time of bedtime in all daily sleep behavior data was used as the bedtime anchor point, and the mean of the start time of the out-of-bed event in all daily sleep behavior data was used as the out-of-bed anchor point. Each search period is constructed in a preset time coordinate system with the bed rest anchor point and the bed leave anchor point as the center. The search period of the bed rest anchor point is divided with a preset step size to obtain the set of bed rest time points. The search period of the bed leave anchor point is divided with a preset step size to obtain the set of bed leave time points. In the set of bed rest time points and the set of bed alighting time points, time points are matched across sets to obtain all unique matching point pairs; In each matching point pair, the difference between the time point of getting out of bed and the time point of going to bed is calculated as the rest duration. When the rest duration of a certain matching point pair is within the preset rest range, the time period between the time point of going to bed and the time point of getting out of bed corresponding to the matching point pair is taken as a rest window.

3. The personalized sleep suggestion generation system based on long-term sleep diary data according to claim 1, characterized in that, The method for obtaining the effective sleep segments includes: In the daily sleep behavior data within each observation period, if the duration of a certain sleep event is greater than or equal to the preset effective sleep duration threshold, then the sleep event is considered a valid sleep event, and the time period corresponding to the valid sleep event is considered a valid sleep segment.

4. A personalized sleep suggestion generation system based on long-term sleep diary data according to claim 1, characterized in that, The method for obtaining the matching cost includes: Each effective sleep segment is divided into several sleep slices according to a preset length, and the midpoint time in each sleep slice is taken as the central phase. In each work and rest window, the time period of the work and rest window is divided into several time slices according to a preset length, and the midpoint time in each time slice is used as the center time of each time slice; The sleep slice is used as the source node and the time slice is used as the target node. The total number of sleep slices and the total number of time slices in each sleep window are compared. If the number is the same, a matching weight matrix is ​​constructed. If the number is not the same, virtual nodes are added until the number is the same and then a matching weight matrix is ​​constructed. In the matching weight matrix, for any position, if neither the source node nor the target node corresponding to that position is a virtual node, then the absolute value of the difference between the center phase of the source node and the center time of the target node corresponding to that position is used as the element value of that position. If the source node corresponding to this position is a virtual node, then the element value at this position is set to the null cost constant; if the target node corresponding to this position is a virtual node, then the element value at this position is set to the discard penalty constant. The KM algorithm is used to solve the matching weight matrix corresponding to each rest window, and the normalized value of the minimum total weight is used as the matching cost of each rest window.

5. A personalized sleep suggestion generation system based on long-term sleep diary data according to claim 1, characterized in that, The method for obtaining the arousal interference value includes: Based on the temporal distribution of awakening time in a preset time coordinate system within all observation periods, the awakening probability density function is calculated. The arousal probability density function is used to calculate the definite integral over the corresponding time period of each sleep window, and the normalized value is used as the arousal interference value for each sleep window.

6. A personalized sleep suggestion generation system based on long-term sleep diary data according to claim 5, characterized in that, The method for obtaining the arousal probability density function includes: The preset time coordinate system is divided into multiple time grids according to the preset time step. The awakening events of daily sleep behavior data in all observation periods are traversed, and the frequency of awakening events entering each time grid is counted to obtain the original frequency sequence. The original frequency sequence is smoothed and normalized to obtain the arousal probability density function.

7. A personalized sleep suggestion generation system based on long-term sleep diary data according to claim 1, characterized in that, The method for obtaining the duration compression penalty coefficient includes: Analyze the cumulative deviation between the duration of sleep events and the preset required duration in the daily sleep behavior data within the observation period, and determine the cumulative sleep deficit value corresponding to the next observation period; The value obtained by negatively mapping the difference between the length of each rest window and the preset critical length is used as the duration penalty compression factor for each rest window; The normalized value of the product of the duration penalty compression factor of each sleep window and the cumulative sleep deficit is used as the duration compression penalty coefficient of each sleep window.

8. A personalized sleep suggestion generation system based on long-term sleep diary data according to claim 7, characterized in that, The method for obtaining the cumulative sleep deficit includes: For each observation period, the length and value of all sleep events in the daily sleep behavior data are taken as the daily sleep duration, and the average of the daily sleep durations of all days is taken as the average daily sleep duration. Calculate the difference between the preset required duration and the average daily sleep duration for each observation period. If the difference is not positive, record the sleep deficit factor for each observation period as 0; otherwise, record the difference as the sleep deficit factor for each observation period. In terms of time sequence, the sum of the sleep deficit factors of all observation periods is used as the cumulative sleep deficit value for the next observation period.

9. A personalized sleep suggestion generation system based on long-term sleep diary data according to claim 1, characterized in that, The method for obtaining the optimal window includes: The matching cost, arousal interference value, and duration compression penalty coefficient of each rest window are weighted using the preset proportion weights corresponding to the matching cost, arousal interference value, and duration compression penalty coefficient. The weighted result is used as the comprehensive cost value of each rest window. The work and rest window corresponding to the minimum comprehensive cost is taken as the optimal window.

10. A personalized sleep suggestion generation system based on long-term sleep diary data according to claim 2, characterized in that, The method involves adjusting bed rest and out-of-bed events in the next observation period based on the differences between the optimal window and the daily sleep behavior data in the latest observation period, thereby generating sleep recommendations, including: The starting coordinates are formed by the bed rest anchor point and the bed exit anchor point, and the ending coordinates are formed by the start time and end time of the optimal window. The difference between the start time of the optimal window and the bed rest anchor point is used as the bed rest anchor point adjustment component, and the difference between the end time of the optimal window and the bed leave anchor point is used as the bed leave anchor point adjustment component. The bed rest anchor point adjustment component and the bed exit anchor point adjustment component are collectively referred to as the component to be adjusted. For any component to be adjusted, if the absolute value of the component to be adjusted is greater than the preset adjustment time, the component to be adjusted is processed by the sign function and multiplied by the preset adjustment time. The product is used as the actual adjustment component. If the absolute value of the component to be adjusted is less than or equal to the preset adjustment time, the component to be adjusted is used as the actual adjustment component. The sum of the bed rest anchor point and the corresponding actual adjustment component is used as the suggested bed rest time, and the sum of the bed exit anchor point and the corresponding actual adjustment component is used as the suggested bed exit time.