A method and system for identifying a continuous work period of a platform flow practitioner based on a dynamic threshold
By using a dynamic threshold method to identify the continuous working time of mobile practitioners on the platform, the problem of misjudgment and missed judgment in the existing technology is solved, and higher recognition accuracy and data utilization integrity are achieved, which can meet the needs of multiple types of practitioners.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU UNIVERSITY
- Filing Date
- 2025-09-12
- Publication Date
- 2026-07-21
AI Technical Summary
Existing methods suffer from misjudgment and omission when identifying continuous working periods of mobile practitioners on platforms. They cannot adapt to the working interval characteristics of different users and different time periods, cannot identify continuous working behavior across dates, have a lot of noise in trajectory data and scattered effective information, lack data preprocessing mechanisms, and cannot flexibly adapt to multiple types of practitioners, resulting in low identification accuracy and high development costs.
A dynamic threshold-based approach is adopted, which involves sorting all intervals in descending order within a group, extracting the interval difference breakpoint, and iteratively filtering by combining the maximum dynamic threshold limit to identify dense areas and make special proximity judgments. Dense areas are divided into complete, head-truncated, and tail-truncated areas, and cross-date analysis is performed by combining user identifiers and date segments.
It significantly improves the matching degree between dense area division and actual working status, reduces the misjudgment rate and missed judgment rate, fully captures the work rhythm across dates, improves the integrity of data utilization and recognition accuracy, and meets the needs of unified management for multiple types of practitioners.
Smart Images

Figure CN121235660B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of continuous working time period identification methods, and particularly relates to a method and system for identifying continuous working time periods of mobile platform workers based on dynamic thresholds. Background Technology
[0002] With the rapid development of the digital economy, the platform economy model has become an important part of the employment market. Fields such as food delivery, express delivery, and ride-hailing services have spawned a large number of mobile platform workers (such as food delivery riders, couriers, and ride-hailing drivers). These workers exhibit significant flexibility in their work patterns—working hours are not fixed, and work locations dynamically change according to service demand. Their work processes are characterized by fragmentation, mobility, and non-standardization, making accurate identification of their continuous working periods a core requirement for platform operation management, labor rights protection, and industry regulation.
[0003] In practical applications, the work status of mobile platform workers is usually indirectly determined through trajectory data (including user identification, recording date, trajectory start / end time, etc.) collected by devices such as mobile phone signaling and GPS positioning. However, existing methods for identifying continuous work periods have the following key technical challenges when adapting to the work characteristics of this group:
[0004] Existing methods often use fixed static thresholds (such as defining a work interruption as a 30-minute interval without tracking) to divide continuous work periods. However, the work intervals of mobile platform workers vary significantly due to factors such as service type (e.g., high order volume during peak hours and longer intervals during off-peak hours), scenario factors (e.g., delivery delays caused by severe weather and increased order intervals due to traffic congestion), and personal work habits (e.g., some riders take long breaks at lunchtime and some drivers take orders at short intervals at night). Static thresholds cannot dynamically match the interval characteristics of different users and different time periods, easily leading to "misjudging continuous work (e.g., misjudging long breaks as work)" or "missing continuous work (e.g., misjudging short order intervals as work interruptions)," resulting in low recognition accuracy.
[0005] Existing methods mostly analyze trajectory data independently on a "single day" basis, failing to consider the potential for continuous work across dates by mobile platform workers (e.g., ride-hailing drivers continuously accepting orders from 2 AM to 5 AM, with trajectory data spanning the current day and the next day), or patterns of "interruption after multiple days of continuous work." This isolated date analysis approach cannot form a holistic perspective of "user identifier + continuous / non-continuous date segments," resulting in incomplete identification of long-term work rhythms and difficulty in supporting application scenarios that require cross-date dimensions, such as fatigue driving warnings and monthly work hour statistics.
[0006] The trajectory data of mobile workers on the platform suffers from the problem of "excessive noise and scattered effective information": on the one hand, some trajectory data has too short an effective time due to equipment failure and signal loss (such as invalid location records within 1 minute); on the other hand, isolated single trajectories (such as short trajectories of workers temporarily picking up goods at stores) are mixed with dense work trajectories. Existing methods lack targeted data preprocessing mechanisms (such as not setting a minimum threshold for the number of daily trajectories, not distinguishing between valid and invalid trajectories), and do not reasonably quantify the "head interval" (the blank period before the first trajectory of the day) and the "tail interval" (the blank period after the last trajectory of the day), resulting in large deviations in subsequent interval calculations and inaccurate division of dense work areas.
[0007] The core of continuous work time segmentation is identifying "dense areas" (i.e., the periods during which practitioners work continuously) in trajectory data. However, existing methods only divide dense areas by simple interval comparison, without considering two special scenarios: first, the validity judgment of the beginning and end of a single trajectory (e.g., if there is only one morning trajectory on a given day, it needs to be determined whether it belongs to the beginning of a complete work session); second, the identification of truncated dense areas (e.g., if there is a long blank period before the head dense area, there may be early work trajectories that have not been collected, which need to be marked as "head truncated dense area" to avoid time extraction bias). This crude approach to dense area processing leads to a significant deviation between the final output "start / end work time" and the actual work status.
[0008] Existing methods often design identification logic for a single type of platform worker (such as only catering to food delivery riders), without providing flexible threshold calculation and dense area division schemes. When the research subjects are expanded to groups with significantly different trajectory behavior patterns (such as long-interval order acceptance by ride-hailing drivers and short-interval delivery by couriers), a complete set of identification algorithms needs to be developed, which is costly, has poor reusability, and is difficult to meet the platform's need for unified management of multiple types of workers. Summary of the Invention
[0009] The purpose of this invention is to address the aforementioned technical problems by providing a method and system for identifying the continuous working time periods of mobile platform workers based on dynamic thresholds.
[0010] In view of this, the present invention provides a method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds, comprising the following steps:
[0011] Step 1: Receive input data and perform preliminary cleaning on the input data;
[0012] Step 2: Group by user identifier and extract a unique date list. After sorting the date list in ascending order, identify continuous and non-continuous date segments to form independent groups for user identifiers and date segments;
[0013] Step 3: For each group, calculate the time interval between adjacent trajectories within the group, the unique head interval, and the tail interval, and calculate all intervals within the group using the time interval between adjacent trajectories within the group, the head interval, and the tail interval.
[0014] Step 4: For each group, sort all intervals in descending order, calculate the difference between adjacent interval values and establish a link between the interval difference and the corresponding smaller interval value. Extract the interval value linked by the largest interval difference as the initial dynamic threshold, and iteratively filter to obtain the final dynamic threshold by combining the user-set maximum dynamic threshold limit.
[0015] Step 5: Compare the time interval between adjacent trajectories within the group with the final dynamic threshold, divide the initial dense area and merge adjacent initial dense areas, and perform special proximity judgment on the single first / last trajectory data that is not merged into the dense area to determine whether it is regarded as the first truncated dense area or the last truncated dense area.
[0016] Step 6: Divide the dense areas into complete dense areas, head-truncated dense areas, and tail-truncated dense areas. Perform proximity judgment on the head-truncated and tail-truncated dense areas to determine their type. Mark the remaining dense areas as complete dense areas.
[0017] Step 7: Extract start and end working times. Extract the corresponding start and end working times according to different types of dense areas. Group and label them by user ID and date segment. Output a result table containing user ID, date, start working time, end working time, final dynamic threshold, whether it is a continuous segment, and the dense area sequence number in the group.
[0018] Preferably, in step one, input data including user identifier, recording date, trajectory start time, end time, and corresponding Unix timestamp is received.
[0019] Preferably, the specific process of data preprocessing in step one is as follows:
[0020] S11: The trajectory information of the input data corresponds to the mobile phone signaling trajectory data of mobile practitioners on the platform, including food delivery riders, couriers, and ride-hailing drivers;
[0021] S12: Preliminary cleaning must meet two conditions: first, each travel record must have a preset validity period; second, each user identifier must have at least 5 daily trajectory data entries.
[0022] S13: The system's data preprocessing unit is also equipped with a data validity verification module, which is used to verify whether the validity time of each travel record and the number of daily trajectory data for each user ID meet the preset conditions.
[0023] Preferably, the specific process for identifying consecutive date segments in step two is as follows:
[0024] S21: After grouping by user identifier, extract all unique record dates corresponding to each user identifier, form a date list, and sort them in ascending order by time;
[0025] S22: Traverse the sorted list of dates. If the difference between two adjacent dates is 1 day, merge the two dates into the same consecutive date segment; if the difference between two adjacent dates is greater than 1 day, divide the two dates into different non-consecutive date segments.
[0026] S23: Each user ID, consecutive date range, or user ID, non-consecutive date range constitutes a separate group;
[0027] S24: The system's date continuum identification unit includes a date sorting module and a continuum judgment module. The date sorting module is used to sort the date list in ascending order, and the continuum judgment module is used to determine continuum / non-continuum segments and form groups based on the difference between adjacent dates.
[0028] Preferably, the specific process for calculating the time interval in step three is as follows:
[0029] S31: The time interval between adjacent trajectories within a group = the start time of the next trajectory - the end time of the current trajectory, in minutes, and establishes a link between this time interval and the corresponding adjacent trajectory;
[0030] S32: Head interval = start time of the first trajectory record in the group, and each group has a unique head interval;
[0031] S33: Tail interval = 24:00 on the day of the last trajectory record in the group - the end time of the last trajectory record, in minutes. Each group has a unique tail interval.
[0032] S34: All intervals within a group are calculated by summing the time intervals between adjacent trajectories within the group, the head interval, and the tail interval, and all intervals within each group are stored in association with the user identifier and date range of that group;
[0033] S35: The system's time interval calculation unit includes an adjacent trajectory interval calculation module, a head and tail interval calculation module, and a total interval integration module, which are used to perform the calculation of adjacent trajectory intervals, head and tail intervals, and the integration of all intervals within a group, respectively.
[0034] Preferably, the specific process of dynamic threshold calculation in step four is as follows:
[0035] S41: Extract all intervals within each group and sort the interval values in descending order from largest to smallest.
[0036] S42: Calculate the difference between two adjacent interval values after descending order, and establish a one-to-one correspondence between the interval difference and the smaller interval value in the calculation process;
[0037] S43: Arrange all interval differences in descending order to form an interval difference set, and extract the interval value linked to the largest interval difference in the set as the initial dynamic threshold.
[0038] S44: Compare the initial dynamic threshold with the user-set maximum dynamic threshold limit: If the initial dynamic threshold is less than the maximum dynamic threshold limit, then determine it as the final dynamic threshold for the group;
[0039] If the initial dynamic threshold is greater than or equal to the maximum dynamic threshold limit, then the maximum interval difference is removed from the interval difference set, and the process returns to step S43 to re-extract the interval value linked to the current maximum interval difference in the set. Step S44 is repeated until an interval value less than the maximum dynamic threshold limit is selected and used as the final dynamic threshold.
[0040] S45: The system's dynamic threshold calculation unit includes an interval sorting module, an interval difference calculation module, an initial threshold extraction module, and a threshold filtering module, which are used to perform interval descending order, interval difference calculation, initial threshold extraction, and threshold iterative filtering combined with the maximum limit, respectively.
[0041] Preferably, the specific process of dividing the dense area in step five is as follows:
[0042] S51: Initial dense area division: Compare the time interval between each adjacent trajectory in the group with the final dynamic threshold. If the time interval is less than the final dynamic threshold, then the pair of adjacent trajectory data linked by the time interval is divided into an initial dense area.
[0043] S52: Dense Area Merging: Merge adjacent initial dense areas within a group into a single dense area to obtain a merged set of dense areas;
[0044] S53: Single First / Last Trajectory Data Detection: Check whether the first and last trajectory data in the group are included in the merged dense area set. If both are included, no further operation is required; if neither trajectory data is included, perform a special proximity judgment.
[0045] S54: Special Proximity Detection:
[0046] S541: Use the final dynamic threshold of the group as the special proximity threshold, and compare the special proximity threshold with the user-set maximum proximity threshold limit: if the special proximity threshold is greater than the maximum proximity threshold limit, then take the maximum proximity threshold limit as the final proximity threshold; if the special proximity threshold is less than or equal to the maximum proximity threshold limit, then take the special proximity threshold as the final proximity threshold.
[0047] S542: If the data not included is the head trajectory data, compare the head interval with the final proximity threshold: if the head interval is greater than the final proximity threshold, then the head trajectory data is not considered a dense area; if the head interval is less than or equal to the final proximity threshold, then the head trajectory data is considered a head truncated dense area.
[0048] S543: If the data not included is tail trajectory data, compare the tail interval with the final proximity threshold: if the tail interval is greater than the final proximity threshold, then the tail trajectory data is not considered a dense area; if the tail interval is less than or equal to the final proximity threshold, then the tail trajectory data is considered a tail truncated dense area.
[0049] S544: Except for the first / last trajectory, other single trajectory data that are not included in the merged dense area set are discarded and not considered as valid dense areas.
[0050] S545: The dense area division unit of the system includes an initial dense area construction module, a dense area merging module, a first and last trajectory detection module, and a special proximity judgment module, which are used to perform initial dense area division, adjacent dense area merging, first and last trajectory attribution detection, and special proximity threshold calculation and truncation dense area judgment, respectively.
[0051] Preferably, the specific process of dividing dense areas in step six is as follows:
[0052] S61: A complete dense area refers to a regular dense area with no risk of data truncation at the beginning and end; a truncated dense area at the beginning refers to a dense area that only contains valid data at the end and may contain invalid data at the beginning; a truncated dense area at the end refers to a dense area that only contains valid data at the beginning and may contain invalid data at the end.
[0053] S62: For the merged set of dense regions, the dense region at the beginning of the time series within the group is marked as the head dense region, and the dense region at the end is marked as the tail dense region.
[0054] If the head truncation dense area or the tail truncation dense area has been marked in step five, then only the unmarked head / tail areas will be marked as dense areas.
[0055] S63: Judgment of proximity between densely populated areas at the beginning and end:
[0056] S631: Calculate the average time interval between all trajectory data in the head dense region as the first nearest threshold; calculate the average time interval between all trajectory data in the tail dense region as the tail nearest threshold.
[0057] S632: Compare the first nearest threshold with the head interval: if the first nearest threshold is less than the head interval, mark the head dense area as a complete dense area; if the first nearest threshold is greater than the head interval, mark the head dense area as a head truncated dense area.
[0058] S633: Compare the tail proximity threshold with the tail interval: If the tail proximity threshold is less than the tail interval, then mark the tail dense region as a complete dense region;
[0059] If the tail proximity threshold is greater than the tail interval, the tail dense region is marked as the tail truncation dense region.
[0060] S64: Except for the already marked first and last dense areas, all other dense areas in the group are marked as complete dense areas;
[0061] S65: The dense area division unit of the system includes a dense area type definition module, a first and last dense area marking module, a proximity threshold calculation module, and a dense area type determination module, which are used to implement the dense area type definition, the initial marking of the first and last dense areas, the calculation of the first / last proximity threshold, and the final determination of the dense area type, respectively.
[0062] Preferably, the specific process for extracting the start and end times in step seven is as follows:
[0063] S71: Complete Dense Area Time Extraction: Extract the start time of the first trajectory within the complete dense area as the start time of the dense area, and extract the end time of the last trajectory within the complete dense area as the end time of the dense area.
[0064] S72: Head-truncation dense region time extraction: Only the end time of the last trajectory in the head-truncation dense region is extracted as the end time of the dense region, and the start time is not extracted.
[0065] S73: Timing extraction of the tail-truncation dense region: Only the start time of the first trajectory in the tail-truncation dense region is extracted as the start time of the dense region, and the end time is not extracted;
[0066] S74: Group the extracted start and end times of work by user ID and date range. If there are multiple dense areas corresponding to the time data in the same group, mark the corresponding dense area number in the group for each time data.
[0067] S75: Result Output: Generate a result table. The table column names include user ID, date, start time, end time, final dynamic threshold, whether it is a continuous segment, and the dense area number within the group. The "whether it is a continuous segment" field is marked as yes or no according to the date segment type in step two.
[0068] S76: The working time extraction unit of the system includes a time extraction module, a grouping and marking module, and a result generation module, which are used to perform time extraction, time data grouping and marking, and result table generation and output for different types of dense areas, respectively.
[0069] A system for identifying the continuous working time period of mobile platform workers based on dynamic thresholds, including a data preprocessing unit for performing data reception and preliminary cleaning in step one;
[0070] The date continuum segment identification unit is used to perform the grouping, date sorting, and group formation operations in step two; the time interval calculation unit is used to perform various interval calculations in step three.
[0071] The dynamic threshold calculation unit is used to perform the dynamic threshold iterative filtering in step four.
[0072] The dense area division unit is used to perform dense area division, merging, and single first / last trajectory detection in step five.
[0073] The dense area is divided into units, which are used to perform the dense area type determination and marking in step six;
[0074] The working time extraction unit is used to perform time extraction, grouping and marking, and result output in step seven.
[0075] The beneficial effects of this invention are:
[0076] This invention employs a dynamic threshold calculation logic of "descending order of all intervals within a group - extraction of interval difference breakpoints - iterative filtering combined with maximum dynamic threshold constraints" to automatically match the work interval characteristics of mobile workers on different platforms (such as food delivery riders, ride-hailing drivers, and couriers), as well as the interval fluctuations of the same worker at different times (peak / off-peak, weekday / weekend). Compared to traditional static thresholds (fixed 30-minute / 60-minute intervals), it effectively avoids the problems of "misjudging long intervals of order taking during off-peak hours as work interruptions" and "misjudging short intervals of rest during peak hours as continuous work," improving the matching degree between dense area division and actual work status by more than 30%, and significantly reducing the misjudgment rate and missed judgment rate.
[0077] By separately calculating the "head interval (blank period before the first trajectory of the day)" and the "tail interval (blank period after the last trajectory of the day)," and performing "special proximity judgment" (combining the final proximity threshold with the interval comparison) on the first / last trajectory that is not merged into the dense area, the problem of traditional methods ignoring "isolated valid trajectories" and "the influence of boundary blank periods" is solved. For example, for riders with only one morning pickup trajectory, the head interval can be compared with the final proximity threshold to accurately determine whether the trajectory belongs to the "head truncated dense area," avoiding the omission of valid work data; for ride-hailing drivers with a short blank period after the last trajectory at night, the tail interval judgment can be used to eliminate the misjudgment of "non-work interruption," keeping the boundary work time extraction error within 10 minutes.
[0078] This invention automatically identifies continuous work periods spanning multiple days (such as a driver's order-taking behavior from 2 AM to 5 AM across the current day and the next day) and interruptions after multiple days of continuous work by using the logic of "grouping by user identifier, sorting by date in ascending order, and judging by the difference between adjacent dates"), forming independent analysis units of "user identifier + date segment (continuous / non-continuous)". Compared to the traditional "isolated single-day analysis" mode, it can fully capture the rhythmic characteristics of practitioners' "multi-day continuous work - single-day interruption - resumed continuous work", providing complete data support for scenarios such as fatigue work early warning (such as identifying more than 10 hours of work for 7 consecutive days) and monthly work duration statistics, increasing the coverage of cross-date work status identification from less than 50% in traditional methods to 100%.
[0079] By calculating "all intervals within a group" (including "intervals between adjacent trajectories within the group + head interval + tail interval"), blank time periods outside of trajectory data are included in the threshold analysis system. This avoids the analytical bias caused by traditional methods that only focus on "intervals between trajectories" while ignoring "blank periods at the beginning and end of time periods." For example, for couriers who only have dense trajectories in the morning and no trajectories in the afternoon, quantifying the tail interval can help determine whether the afternoon period is a "non-work interruption," ensuring a complete assessment of the entire day's work status and improving data utilization completeness by more than 40%.
[0080] By employing preliminary cleaning rules that require each travel record to have a valid time frame and each user identifier to have at least 5 trajectory data points per day, invalid trajectories within one minute caused by equipment malfunction or signal loss, as well as analytical bias data due to insufficient daily trajectories, can be filtered out. Compared to traditional unfiltered processing, this improves the effectiveness of the basic data for subsequent interval calculations and dense area division by 60%, avoiding the problem of "junk data affecting recognition results."
[0081] The dense areas are divided into "complete dense areas, head-truncated dense areas, and tail-truncated dense areas," and differentiated time extraction rules are formulated for each type (e.g., extracting the first and last times for complete dense areas, and extracting only the end time for head-truncated dense areas). This solves the problem of "uniform extraction of the first and last times leading to deviations from actual work" caused by traditional methods. For example, for "head-truncated dense areas" where there are uncaptured trajectories at the head, extracting only the end time avoids the error of "misjudging blank periods as work starts"; for "tail-truncated dense areas" where there are uncaptured trajectories at the tail, extracting only the start time ensures the effective starting point of the work period, improving the consistency between the final output "start / end work times" and the actual work behavior of practitioners by 50%.
[0082] When the research object is singular (such as analyzing only food delivery riders in a certain area) and the trajectory behavior pattern is uniform, the dynamic threshold can be calculated by switching to the "quantile value method" (by locating the corresponding value in the interval descending sequence list through preset quantile values). There is no need to execute the complex logic of "interval difference breakpoint extraction-iterative filtering", which improves the recognition efficiency by 40%, meets the needs of rapid batch data processing, and maintains high recognition accuracy.
[0083] The final output includes a result table containing "user ID, date, start time, end time, final dynamic threshold, whether it is a continuous segment, and dense area sequence number within the group." This not only clearly presents the core information of each user's daily work hours but also includes key intermediate parameters such as "final dynamic threshold" and "whether it is a continuous segment," facilitating subsequent checks on the rationality of the identification logic and the suitability of the threshold settings. This standardized output can directly support multiple application scenarios, including platform operation and management (such as optimizing order dispatch time), worker rights protection (such as calculating actual working hours), and industry supervision (such as checking for excessively long working hours), providing accurate and traceable data for relevant decision-making. Attached Figure Description
[0084] Figure 1 This is a flowchart of the process of the present invention;
[0085] Figure 2 This is a schematic diagram of the extraction logic of the present invention;
[0086] Figure 3 This is a schematic diagram illustrating the continuous and discontinuous groups of the present invention;
[0087] Figure 4 This is a schematic diagram illustrating the unique characteristics of mobile practitioners on the platform of this invention;
[0088] Figure 5 This is a schematic diagram illustrating the dynamic threshold extraction and final dynamic threshold selection of the present invention;
[0089] Figure 6 This is a schematic diagram illustrating the detection of a single first / last trajectory data in this invention. Detailed Implementation
[0090] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0091] It should be noted that all directional and positional terms used in this invention, such as "up," "down," "left," "right," "front," "back," "vertical," "horizontal," "inner," "outer," "top," "lower," "lateral," "longitudinal," and "center," are only used to explain the relative positional relationships and connections between components in a specific state (as shown in the accompanying drawings). They are merely for the convenience of describing the invention and do not require the invention to be constructed and operated in a specific orientation; therefore, they should not be construed as limitations on the invention. Furthermore, descriptions involving "first," "second," etc., are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated.
[0092] In the description of this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0093] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0094] Platform mobile workers: refers to a group of people who work on a platform and whose work time and location are highly mobile, such as food delivery riders, couriers, and ride-hailing drivers.
[0095] User ID: A digital identifier used to distinguish different individuals.
[0096] Trajectory data: refers to mobile phone signaling data that records the user's movement in time and space, usually including data information such as the location code of the place of departure and arrival, and the start and end times.
[0097] Continuous / Discontinuous segments: Used to describe the relationship between dates within the same user identifier.
[0098] Group: Usually refers to a set consisting of user IDs and continuous / discontinuous segments.
[0099] Head / Tail Spacing: These refer to the boundaries of a segment, representing the shortest distance between the effective trajectory data within that segment.
[0100] All intervals within a group: refers to all intervals outside the trajectory within a segment. Calculation formula: time interval between adjacent trajectories within a group, head interval, and tail interval.
[0101] Dynamic threshold: Calculated by breaking points of all interval changes within a group, used to identify dense areas within a segment. Dense area: refers to the range of dense trajectories within a segment.
[0102] Maximum dynamic threshold limit: A user-defined limit used to assist in selecting an appropriate dynamic threshold.
[0103] Final dynamic threshold: The appropriate threshold within the final selected segment.
[0104] Single first / last trajectory data detection: Applied to special cases, used to retain single but valuable data (special). Proximity judgment: Refers to the rules for whether to retain or partially extract value from a single first / last trajectory data or a dense area at the beginning and end in the detection of single first / last trajectory data or the judgment of whether the first / last dense area is truncated.
[0105] Special proximity threshold: In the detection of a single first / last trajectory data, the final dynamic threshold within the segment is used to replace the case where the average interval value cannot be extracted, as a proximity threshold in special circumstances.
[0106] Maximum nearest threshold limit: A user-defined limit used to assist in selecting an appropriate nearest threshold.
[0107] Final proximity threshold: refers to the final proximity threshold obtained in the first and last dense regions, which is used as the threshold to determine whether the first and last dense regions have been truncated.
[0108] First / last truncation dense areas: Special dense areas where more valid data may exist outside the segment, therefore different extraction rules are applied.
[0109] Complete dense region: A relatively common dense region, where the start and end times of the work are extracted from the beginning and end respectively.
[0110] First / last proximity threshold: refers to the threshold calculated by the average interval value in the dense area at the beginning and end, which is controlled by the maximum proximity threshold set by the user.
[0111] The continuous working time period identification method used in this invention includes data preprocessing.
[0112] Receive input data, including user ID, recording date, trajectory start time, end time and its corresponding Unix timestamp.
[0113] Initial cleaning is performed to ensure that each travel record has a certain validity period and that each user identifier has at least 5 trajectory data points per day.
[0114] Date continuum identification;
[0115] Group by user identifier, extract a unique date list, and sort in ascending order.
[0116] Identify consecutive date segments: If the difference between adjacent dates is 1 day, they are merged into consecutive segments; otherwise, they are marked as non-consecutive segments.
[0117] This creates independent groups of users and date ranges (continuous / non-continuous).
[0118] Time interval calculation;
[0119] For each group consisting of a user identifier and a date range, calculate the time interval between adjacent trajectories within the group. The calculation formula is the difference between the start time of the next trajectory and the end time of the current trajectory, in minutes. Simultaneously, link each adjacent trajectory that has this time interval.
[0120] For each group formed by user identifier and date range, extract the unique header interval within the segment. The header interval is calculated as the start time of the first trajectory record within the group, converted to minutes.
[0121] For each group formed by user identifier and date range, extract the unique tail interval within the segment. The formula for calculating the tail interval is the difference between 24:00 on the day of the last trajectory record in the group and the end time of the last trajectory record, in minutes.
[0122] Set a function and name it "All Intervals in the Group". The calculation formula for "All Intervals in the Group" is: the time interval between adjacent trajectories in the group, the head interval, and the tail interval.
[0123] Dynamic threshold calculation;
[0124] For each user identifier and date range, a dynamic threshold is calculated for dense area division. At the same time, the automatically extracted dynamic threshold is controlled according to the maximum dynamic threshold limit input by the user.
[0125] Extract all intervals within each group and then process them in descending order.
[0126] After sorting in descending order, the difference between adjacent interval values is calculated, and a link is established between the calculated adjacent interval difference and the smaller interval value in the calculation that yielded the difference.
[0127] The interval differences are sorted in descending order and placed in a set. The interval value linked by the largest interval difference in the set is then extracted as the dynamic threshold.
[0128] Compare the extracted dynamic threshold with the maximum dynamic threshold limit. If it is less than the maximum dynamic threshold limit, set the interval value as the final dynamic threshold. Otherwise, return to the set in 4.3, delete the maximum interval difference that was just extracted in the set, and then extract the interval value linked to the maximum interval difference (the second largest interval value in the previous step) in the set. Repeat the steps in 4.4 until an interval value less than the maximum dynamic threshold is found through iterative filtering, which is then used as the final dynamic threshold for the group.
[0129] Dense area delineation;
[0130] For each user identifier and date range group, a dense region is defined: the final dynamic threshold of each group is compared with the time interval between adjacent trajectories in the original sorting. If the time interval between adjacent trajectories is less than the final dynamic threshold, the pair of adjacent trajectory data linked by that time interval is defined as a dense region.
[0131] Adjacent dense areas within a group are merged into a single dense area.
[0132] After merging all the dense areas that can be merged within the group, start detecting the first / last trajectory data of a single line.
[0133] If the first and last trajectory data in the detection group have been merged into the dense area, no processing is required. For any first and last trajectory that has not been merged into the dense area, special proximity judgment is required.
[0134] The dynamic threshold within a group is considered as a special proximity threshold. At the same time, the special proximity threshold is compared with the user-set maximum proximity threshold limit. If it is greater than the maximum proximity threshold limit, then the maximum proximity threshold limit is taken as the final proximity threshold.
[0135] If there are unmerged head / tail trajectory data, the head interval / tail interval is compared with the final proximity threshold. If it is greater than the final proximity threshold, the trajectory is not considered a dense area; if it is less than the final proximity threshold, the single head / tail trajectory data is considered a head truncated dense area or a tail truncated dense area.
[0136] Any single trajectory data that is not within a dense area will be discarded and not considered a valid dense area.
[0137] Densely populated areas;
[0138] The dense area is divided into a complete dense area, a head-truncated dense area, and a tail-truncated dense area.
[0139] Identify all dense regions within a group and mark the head and tail dense regions within the group. For groups that have already marked head or tail truncated dense regions through previous detection using single head / tail trajectory data, only the remaining parts of the group need to be identified. (For example, if a tail truncated dense region has already been identified within a group, then only head identification is needed for that group. After head identification and proximity judgment are completed, the remaining dense regions are marked as complete dense regions. If the group already has both head and tail truncated dense regions and there are still unmarked dense regions, then the remaining dense regions are marked as complete dense regions.)
[0140] Proximity judgment is performed on the marked beginning and end dense areas.
[0141] The rule for proximity determination is to calculate the average time interval between trajectory data within the first / last dense region and set it as the first / last proximity threshold. The first / last proximity threshold is then compared with the first / last interval. If it is less than the first / last interval, the first / last dense region is considered a complete dense region; if it is greater than the first / last interval, the first / last dense region is considered a first-truncation dense region or a last-truncation dense region.
[0142] Extract start and end times of the work process;
[0143] Extract the start time of the first trajectory within the complete dense region as the start time, and extract the end time of the last trajectory within the complete dense region as the end time.
[0144] The first part truncates the dense region, extracting only the end time of the last trajectory within the dense region as the end time. The last part truncates the dense region, extracting only the start time of the first trajectory within the dense region as the start time.
[0145] The extracted start and end times need to be grouped according to user ID and date range. For cases where there are multiple start and end times within a group, they need to be marked to distinguish the start and end times extracted from different dense areas within the same group.
[0146] The final results table will output columns such as user ID, date, start time, end time, final dynamic threshold, whether it is a continuous segment, and the sequence number of the dense area within the group, which will facilitate the checking of the results.
[0147] The extraction rule of replacing dynamic thresholds with quantile values means that dynamic thresholds are no longer extracted through breakpoints, but rather through a fixed interval quantile value set by the user, after the interval is sorted in descending order. This quantile value is matched with the corresponding interval value in the descending interval list as the threshold for identifying dense areas.
[0148] This method is more efficient when the research object is singular and the trajectory behavior pattern is uniform. (Simply put, a defined quantile—locating the specific interval of each segment—is used to identify dense areas).
[0149] Core logic for time extraction:
[0150] Continuous date segment identification (identify_continuous_segments): Group dates with combine_id to identify whether the segments are continuous or discontinuous.
[0151] Dynamic threshold calculation (calculate_thresholds and compute_group_threshold): Calculate the dense threshold for each date segment based on the time interval.
[0152] Processing dense segments (process_dense_segments): Identify dense time periods and extract departure and arrival times.
[0153] The embodiments of this application have been described above with reference to the accompanying drawings. Unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other. This application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for identifying the continuous working time period of mobile platform workers based on dynamic thresholds, characterized in that: Includes the following steps: Step 1: Receive input data and perform preliminary cleaning on the input data; Step 2: Group by user identifier and extract a unique date list. After sorting the date list in ascending order, identify continuous and non-continuous date segments to form independent groups for user identifiers and date segments; Step 3: For each group, calculate the time interval between adjacent trajectories within the group, the unique head interval, and the tail interval, and calculate all intervals within the group using the time interval between adjacent trajectories, the head interval, and the tail interval. S32: Head interval = start time of the first trajectory record in the group, and each group has a unique head interval; S33: Tail interval = 24:00 on the day of the last trajectory record in the group - the end time of the last trajectory record, in minutes. Each group has a unique tail interval. Step 4: For each group, sort all intervals in descending order, calculate the difference between adjacent interval values and establish a link between the interval difference and the corresponding smaller interval value. Extract the interval value linked by the largest interval difference as the initial dynamic threshold, and iteratively filter to obtain the final dynamic threshold by combining the user-set maximum dynamic threshold limit. Step 5: Compare the time interval between adjacent trajectories within the group with the final dynamic threshold, divide the initial dense area and merge adjacent initial dense areas, and perform special proximity judgment on the single first / last trajectory data that is not merged into the dense area to determine whether it is regarded as the first truncated dense area or the last truncated dense area. S54: Special Proximity Detection: S541: Use the final dynamic threshold of the group as the special proximity threshold, and compare the special proximity threshold with the user-set maximum proximity threshold limit: if the special proximity threshold is greater than the maximum proximity threshold limit, then take the maximum proximity threshold limit as the final proximity threshold. If the special proximity threshold is less than or equal to the maximum proximity threshold limit, then the special proximity threshold is taken as the final proximity threshold. S542: If the data not included is the head trajectory data, compare the head interval with the final proximity threshold: if the head interval is greater than the final proximity threshold, then the head trajectory data is not considered a dense area; if the head interval is less than or equal to the final proximity threshold, then the head trajectory data is considered a head truncated dense area. S543: If the data not included is tail trajectory data, compare the tail interval with the final proximity threshold: if the tail interval is greater than the final proximity threshold, then the tail trajectory data is not considered a dense area; if the tail interval is less than or equal to the final proximity threshold, then the tail trajectory data is considered a tail truncated dense area. S544: Except for the first / last trajectory, other single trajectory data that are not included in the merged dense area set are discarded and not considered as valid dense areas. S545: The dense area division unit of the system includes an initial dense area construction module, a dense area merging module, a first and last trajectory detection module, and a special proximity judgment module, which are respectively used to perform initial dense area division, adjacent dense area merging, first and last trajectory attribution detection, and special proximity threshold calculation and truncation dense area judgment. Step 6: Divide the dense areas into complete dense areas, head-truncated dense areas, and tail-truncated dense areas. Perform proximity judgment on the head-truncated and tail-truncated dense areas to determine their type. Mark the remaining dense areas as complete dense areas. S63: Judgment of proximity between densely populated areas at the beginning and end: S631: Calculate the average time interval between all trajectory data within the head-dense region, and use it as the first nearest threshold; Calculate the average time interval between all trajectory data within the tail-dense region, and use it as the tail proximity threshold; S632: Compare the first nearest threshold with the head interval: if the first nearest threshold is less than the head interval, mark the head dense area as a complete dense area; if the first nearest threshold is greater than the head interval, mark the head dense area as a head truncated dense area. S633: Compare the tail proximity threshold with the tail interval: If the tail proximity threshold is less than the tail interval, then mark the tail dense region as a complete dense region; If the tail proximity threshold is greater than the tail interval, the tail dense region is marked as the tail truncation dense region. S64: Except for the already marked first and last dense areas, all other dense areas in the group are marked as complete dense areas; S65: The dense area division unit of the system includes a dense area type definition module, a first and last dense area marking module, a proximity threshold calculation module, and a dense area type determination module, which are used to implement the dense area type definition, the initial marking of the first and last dense areas, the calculation of the first / last proximity threshold, and the final determination of the dense area type, respectively. Step 7: Extract start and end working times. Extract the corresponding start and end working times according to different types of dense areas. Group and label them by user ID and date segment. Output a result table containing user ID, date, start working time, end working time, final dynamic threshold, whether it is a continuous segment, and the dense area sequence number in the group.
2. The method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds according to claim 1, characterized in that: In step one, input data containing user ID, recording date, trajectory start time, end time, and corresponding Unix timestamp is received.
3. The method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds according to claim 2, characterized in that: The specific process of data preprocessing in step one is as follows: S11: The trajectory information of the input data corresponds to the mobile phone signaling trajectory data of mobile practitioners on the platform, including food delivery riders, couriers, and ride-hailing drivers; S12: Preliminary cleaning must meet two conditions: first, each travel record must have a preset validity period; second, each user identifier must have at least 5 daily trajectory data entries. S13: The system's data preprocessing unit is also equipped with a data validity verification module, which is used to verify whether the validity time of each travel record and the number of daily trajectory data for each user ID meet the preset conditions.
4. The method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds according to claim 3, characterized in that: The specific process for identifying consecutive date segments in step two is as follows: S21: After grouping by user identifier, extract all unique record dates corresponding to each user identifier, form a date list, and sort them in ascending order by time; S22: Traverse the sorted list of dates. If the difference between two adjacent dates is 1 day, merge the two dates into the same consecutive date segment; if the difference between two adjacent dates is greater than 1 day, divide the two dates into different non-consecutive date segments. S23: Each user ID, consecutive date range, or user ID, non-consecutive date range constitutes a separate group; S24: The system's date continuum identification unit includes a date sorting module and a continuum judgment module. The date sorting module is used to sort the date list in ascending order, and the continuum judgment module is used to determine continuum / non-continuum segments and form groups based on the difference between adjacent dates.
5. The method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds according to claim 1, characterized in that: The specific process for calculating the time interval in step three is as follows: S31: The time interval between adjacent trajectories within a group = the start time of the next trajectory - the end time of the current trajectory, in minutes, and establishes a link between this time interval and the corresponding adjacent trajectory; S32: All intervals within a group are calculated by summing the time intervals between adjacent trajectories within the group, the head interval, and the tail interval, and all intervals within each group are stored in association with the user identifier and date range of that group; S33: The system's time interval calculation unit includes an adjacent trajectory interval calculation module, a head and tail interval calculation module, and a total interval integration module, which are used to perform the calculation of adjacent trajectory intervals, head and tail intervals, and the integration of all intervals within a group, respectively.
6. The method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds according to claim 1, characterized in that: The specific process of dynamic threshold calculation in step four is as follows: S41: Extract all intervals within each group and sort the interval values in descending order from largest to smallest. S42: Calculate the difference between two adjacent interval values after descending order, and establish a one-to-one correspondence between the interval difference and the smaller interval value in the calculation process; S43: Arrange all interval differences in descending order to form an interval difference set, and extract the interval value linked to the largest interval difference in the set as the initial dynamic threshold. S44: Compare the initial dynamic threshold with the user-set maximum dynamic threshold limit: If the initial dynamic threshold is less than the maximum dynamic threshold limit, then determine it as the final dynamic threshold for the group; If the initial dynamic threshold is greater than or equal to the maximum dynamic threshold limit, then the maximum interval difference is removed from the interval difference set, and the process returns to step S43 to re-extract the interval value linked to the current maximum interval difference in the set. Step S44 is repeated until an interval value less than the maximum dynamic threshold limit is selected and used as the final dynamic threshold. S45: The system's dynamic threshold calculation unit includes an interval sorting module, an interval difference calculation module, an initial threshold extraction module, and a threshold filtering module, which are used to perform interval descending order, interval difference calculation, initial threshold extraction, and threshold iterative filtering combined with the maximum limit, respectively.
7. The method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds according to claim 1, characterized in that: The specific process of dividing the dense area in step five is as follows: S51: Initial dense area division: Compare the time interval between each adjacent trajectory in the group with the final dynamic threshold. If the time interval is less than the final dynamic threshold, then the pair of adjacent trajectory data linked by the time interval is divided into an initial dense area. S52: Dense Area Merging: Merge adjacent initial dense areas within a group into a single dense area to obtain a merged set of dense areas; S53: Single first / last trajectory data detection: Check whether the first and last trajectory data in the group are included in the merged dense area set. If both are included, no further operation is required; if neither trajectory data is included, perform a special proximity judgment.
8. The method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds according to claim 1, characterized in that: The specific process of distinguishing dense areas in step six is as follows: S61: A complete dense area refers to a regular dense area with no risk of data truncation at the beginning and end; a truncated dense area at the beginning refers to a dense area containing only valid data at the end and with uncaptured valid data at the beginning; a truncated dense area at the end refers to a dense area containing only valid data at the beginning and with uncaptured valid data at the end. S62: For the merged set of dense regions, the dense region at the beginning of the time series within the group is marked as the head dense region, and the dense region at the end is marked as the tail dense region. If the head truncation dense area or the tail truncation dense area has been marked in step five, then only the unmarked head / tail areas will be marked as dense areas.
9. The method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds according to claim 1, characterized in that: The specific process for extracting the start and end times in step seven is as follows: S71: Complete Dense Area Time Extraction: Extract the start time of the first trajectory within the complete dense area as the start time of the dense area, and extract the end time of the last trajectory within the complete dense area as the end time of the dense area. S72: Head-truncation dense region time extraction: Only the end time of the last trajectory in the head-truncation dense region is extracted as the end time of the dense region, and the start time is not extracted. S73: Timing extraction of the tail-truncation dense region: Only the start time of the first trajectory in the tail-truncation dense region is extracted as the start time of the dense region, and the end time is not extracted; S74: Group the extracted start and end times of work by user ID and date range. If there are multiple dense areas corresponding to the time data in the same group, mark the corresponding dense area number in the group for each time data. S75: Result Output: Generate a result table. The table column names include user ID, date, start time, end time, final dynamic threshold, whether it is a continuous segment, and the dense area number within the group. The "whether it is a continuous segment" field is marked as yes or no according to the date segment type in step two. S76: The system's working time extraction unit includes a time extraction module, a grouping and marking module, and a result generation module, which are used to perform time extraction, time data grouping and marking, and result table generation and output for different types of dense areas, respectively.
10. A system for identifying the continuous working time period of platform mobile workers based on dynamic thresholds, based on the method for identifying the continuous working time period of platform mobile workers based on dynamic thresholds as described in claims 1-9, characterized in that: The data preprocessing unit is used to perform data reception and preliminary cleaning in step one. The date continuum segment identification unit is used to perform the grouping, date sorting, and group formation operations in step two. The time interval calculation unit is used to perform various interval calculations in step three. The dynamic threshold calculation unit is used to perform the dynamic threshold iterative filtering in step four. The dense area division unit is used to perform dense area division, merging, and single first / last trajectory detection in step five. The dense area is divided into units, which are used to perform the dense area type determination and marking in step six; The working time extraction unit is used to perform time extraction, grouping and marking, and result output in step seven.