Minute-level offline driver electronic fence out-of-car time length calculation method based on ODPS
The use of ODPS to calculate the minute-level offline driver outing time within the geofence solves the problem of inaccurate driver outing time within the geofence in existing technologies. The use of SQL and custom functions to process driver location data ensures the accuracy and completeness of the calculation.
Patent Information
- Application Number
- CN202410179536.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-18
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2044-02-18
AI Technical Summary
In existing technologies, by acquiring the driver's dispatch time at the start of the current 5-minute time slice and the driver's mode change log within the current 5 minutes and splicing it with the driver's location log data, the dispatch time within the driver's fence becomes inaccurate, especially when the driver has not changed their order-taking mode, resulting in the loss of a large amount of trajectory data.
This system calculates minute-level offline driver trip duration within electronic fences using ODPS. It constructs a detailed dataset, populates location data status, associates electronic fences, calculates driver location data and duration within the window, and summarizes trip duration. It employs SQL's FULL JOIN and custom UDTF functions, and uses the EXPLODE function and lateral view for column-to-row conversion to ensure the accuracy of the on/off status and duration calculation for each driver location.
It enables accurate calculation of vehicle dispatch time within the fence even when the driver does not change the order-listening mode for a long period of time, ensuring the accuracy and integrity of the calculation and avoiding data loss.
Smart Images

Figure CN118170854B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method for calculating minute-level offline driver vehicle dispatch time within an electronic fence based on ODPS. Background Technology
[0002] The existing offline batch calculation logic is as follows: It obtains the driver's dispatch log at the start of the current 5-minute time slice and the driver's mode change log within the current 5 minutes, then concatenates it with the driver's location log data. The driver's location status change data is then filled into the driver's order-taking mode change data, and the time difference of the order-taking mode change event is calculated to determine the driver's dispatch time within the fenced area.
[0003] By stitching driver location data to the driver's order-listening mode change, a significant amount of driver location data is lost, resulting in inaccurate departure time within the driver's geofence. If the driver does not click to change the order-listening mode within N minutes, the corresponding driver location and geofence data cannot be retrieved. Calculating the time within the geofence will result in the loss of a large portion of the driver's trajectory data within the geofence. Therefore, a minute-level offline method for calculating the departure time within the driver's geofence based on ODPS is proposed. Summary of the Invention
[0004] In view of this, the embodiments of the present invention aim to provide a method for calculating the minute-level offline driver vehicle dispatch time within the electronic fence based on ODPS, so as to solve or alleviate the technical problems existing in the prior art, and at least provide a beneficial option.
[0005] The technical solution of this invention is implemented as follows: a method for calculating minute-level offline driver vehicle departure time within an electronic fence based on ODPS, including the following steps:
[0006] S1. Construct a detailed dataset;
[0007] S2, Fill in the status of point data;
[0008] S3, Associated electronic fence;
[0009] S4. Calculate the driver location data and duration within the window for every five minutes when the driver terminal switch status is on.
[0010] S5. Calculate the driving time of each driver within each electronic fence within five minutes;
[0011] S6. Summarize the driving time of each driver within each electronic fence within five minutes.
[0012] In some embodiments, in S1, constructing a detailed dataset involves taking a data log in which driver location data is reported every 2-15 seconds from the driver's end, then extracting one record from the data log every minute through ODPS, and then using SQL FULL JOIN to join the record extracted by ODPS from the data log with the data on the driver's end vehicle departure / return switch changes.
[0013] In some embodiments, in S2, the location data status filling is achieved by developing a custom UDTF function to fill the switch status and the event time of the next location data reported by the current driver into the location data of each driver every minute, and to record the location latitude and longitude, event time, current departure and arrival switch status, and the time of the next location report status being off for each driver every minute.
[0014] If the driver's terminal does not change the switch status within five minutes, the driver's location and departure / return switch status from the previous five-minute time segment will be retrieved and inherited to ensure that the switch status of each driver's location is present and correct.
[0015] Within the past five minutes, a driver reported their location, but the "stop driving" button was not clicked, even though it must have been clicked in the past.
[0016] In some embodiments, in S3, associating the electronic fence involves taking the Cartesian product of the latitude and longitude X of the driver's location when the driver presses the stop button every minute with the electronic fence Y.
[0017] If the latitude and longitude of the driver's location X = {a,b} and the electronic fence Y = {0,1}, then the Cartesian product of the latitude and longitude X = {a,b} and the electronic fence Y is {(a,0),(a,1),(b,0),(b,1)}.
[0018] This is used to stitch together the electronic fence Y that matches the latitude and longitude X of the driver's location; if no match is found, the value is assigned to 0.
[0019] In some embodiments, the Cartesian product calculation does not take into account the statistical driver time in the electronic fence scenario.
[0020] In some embodiments, in S4, the driver location data with the driver's terminal switch status on every five minutes is calculated, and the duration within the window is calculated. If there is a next event time for the current location data, then the next event time minus the current event time is taken as the vehicle departure time within the fence.
[0021] In some embodiments, in S4, the driver location data with the driver's terminal switch status on is calculated every five minutes, and the duration within the window is calculated. If there is no next event time for the current location data, it means that the driver has not switched to stopping the vehicle after this location event within the current five-minute segment. Then, the time of the end of this five-minute window is taken and the current event time is subtracted.
[0022] In some embodiments, in S4, the driver location data whose driver terminal switch status is on every five minutes is calculated, and the duration in the window is calculated. If the first location data of the current point is closed and the departure time indicates that it was previously on, then the start time of the current window is subtracted from the event time.
[0023] In some embodiments, in S5, the calculation of the driving time of each driver within each electronic fence within five minutes is performed by using the EXPLODE function and lateral view to convert the driver's location data into columns and rows, with one record per driver per fence ID within five minutes;
[0024] If there is no fence ID, assign a value of 0.
[0025] The embodiments of the present invention have the following advantages due to the adoption of the above technical solutions:
[0026] I. This invention uses the driver location data extracted at the minute level from the full amount of data to ensure that even if the driver does not change their order-listening mode for a long period of time, the order-listening duration within the fence can still be calculated relatively accurately.
[0027] Second, by filling each driver's trajectory point record with the current departure and arrival status, this invention can effectively determine and isolate the driver's point reporting order for each departure. It excludes the time interval between the last reported point before the previous arrival and the first reported point of the current departure, ensuring the accuracy of the calculation.
[0028] The above overview is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, further aspects, embodiments, and features of the invention will become readily apparent from the accompanying drawings and the following detailed description. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of this application 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 this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is a flowchart of the present invention;
[0031] Figure 2 This is a schematic diagram of the vehicle dispatch time according to the present invention. Detailed Implementation
[0032] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the spirit or scope of the invention. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.
[0033] It is important to note that terms such as "first," "second," "symmetric," and "array" are used only to distinguish between descriptive and positional descriptions and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, features specified with terms such as "first" or "symmetric" may explicitly or implicitly include one or more of that feature; similarly, when the quantity of certain features is not limited by words such as "two" or "three," it should be noted that such features also explicitly or implicitly include one or more features.
[0034] In this invention, unless otherwise explicitly specified and limited, terms such as "installation," "connection," and "fixation" should be interpreted broadly; for example, they can refer to a fixed connection, a detachable connection, or an integral molding; they can refer to a mechanical connection, a direct connection, a welding connection, or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the accompanying drawings and specific circumstances.
[0035] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0036] Example 1
[0037] like Figure 1 As shown, this embodiment of the invention provides a method for calculating minute-level offline driver vehicle dispatch time within an electronic fence based on ODPS, including the following steps:
[0038] S1. Construct a detailed dataset;
[0039] S2, Fill in the status of point data;
[0040] S3, Associated electronic fence;
[0041] S4. Calculate the driver location data and duration within the window for every five minutes when the driver terminal switch status is on.
[0042] S5. Calculate the driving time of each driver within each electronic fence within five minutes;
[0043] S6. Summarize the driving time of each driver within each electronic fence within five minutes.
[0044] In this embodiment, specifically in S1, constructing the detailed dataset involves taking a data log of driver location data reported by the driver's end every 2 seconds, then extracting one record from the data log every minute through ODPS for minute-level extraction, and then using SQL FULL JOIN to connect the record extracted by minute-level extraction from the data log through ODPS with the data of the driver's end vehicle departure and arrival switch changes.
[0045] In this embodiment, specifically in S2, the location data status is filled by developing a custom UDTF function to fill the switch status and the event time of the next location data reported by the current driver into the location data of each driver every minute, and to record the location latitude and longitude, event time, current departure and arrival switch status, and the time of the next location report status being off for each driver every minute.
[0046] If the driver's terminal does not change the switch status within five minutes, the driver's location and departure / return switch status from the previous five-minute time segment will be retrieved and inherited to ensure that the switch status of each driver's location is present and correct.
[0047] Within the past five minutes, a driver reported their location, but the "stop driving" button was not clicked, even though it must have been clicked in the past.
[0048] In this embodiment, specifically in S3, associating the electronic fence involves performing a Cartesian product of the latitude and longitude X of the driver's location when the driver presses the stop button every minute with the electronic fence Y.
[0049] If the latitude and longitude of the driver's location X = {a,b} and the electronic fence Y = {0,1}, then the Cartesian product of the latitude and longitude X = {a,b} and the electronic fence Y is {(a,0),(a,1),(b,0),(b,1)}.
[0050] This is used to stitch together the electronic fence Y that matches the latitude and longitude X of the driver's location; if no match is found, the value is assigned to 0.
[0051] In this embodiment, the Cartesian product calculation does not consider the driver's time in the electronic fence scenario.
[0052] In this embodiment, specifically in S4, the driver location data with the driver's terminal switch status on every five minutes is calculated, and the duration within the window is calculated. If there is a next event time for the current location data, then the next event time minus the current event time is taken as the vehicle departure time within the fence. Figure 2 Scenario 1 is shown.
[0053] In this embodiment, specifically in S5, the calculation of the driving time of each driver within each electronic fence within five minutes uses the EXPLODE function and lateral view to convert the driver's location data from column to row, with one record for each driver and each fence ID within five minutes;
[0054] If there is no fence ID, assign a value of 0.
[0055] Example 2
[0056] like Figure 1 As shown, this embodiment of the invention provides a method for calculating minute-level offline driver vehicle dispatch time within an electronic fence based on ODPS, including the following steps:
[0057] S1. Construct a detailed dataset;
[0058] S2, Fill in the status of point data;
[0059] S3, Associated electronic fence;
[0060] S4. Calculate the driver location data and duration within the window for every five minutes when the driver terminal switch status is on.
[0061] S5. Calculate the driving time of each driver within each electronic fence within five minutes;
[0062] S6. Summarize the driving time of each driver within each electronic fence within five minutes.
[0063] In this embodiment, specifically in S1, constructing the detailed dataset involves taking a data log of driver location data reported by the driver's end every 2 seconds, then extracting one record from the data log every minute through ODPS for minute-level extraction, and then using SQL FULL JOIN to connect the record extracted by minute-level extraction from the data log through ODPS with the data of the driver's end vehicle departure and arrival switch changes.
[0064] In this embodiment, specifically in S2, the location data status is filled by developing a custom UDTF function to fill the switch status and the event time of the next location data reported by the current driver into the location data of each driver every minute, and to record the location latitude and longitude, event time, current departure and arrival switch status, and the time of the next location report status being off for each driver every minute.
[0065] If the driver's terminal does not change the switch status within five minutes, the driver's location and departure / return switch status from the previous five-minute time segment will be retrieved and inherited to ensure that the switch status of each driver's location is present and correct.
[0066] Within the past five minutes, a driver reported their location, but the "stop driving" button was not clicked, even though it must have been clicked in the past.
[0067] In this embodiment, specifically in S3, associating the electronic fence involves performing a Cartesian product of the latitude and longitude X of the driver's location when the driver presses the stop button every minute with the electronic fence Y.
[0068] If the latitude and longitude of the driver's location X = {a,b} and the electronic fence Y = {0,1}, then the Cartesian product of the latitude and longitude X = {a,b} and the electronic fence Y is {(a,0),(a,1),(b,0),(b,1)}.
[0069] This is used to stitch together the electronic fence Y that matches the latitude and longitude X of the driver's location; if no match is found, the value is assigned to 0.
[0070] In this embodiment, the Cartesian product calculation does not consider the driver's time in the electronic fence scenario.
[0071] In this embodiment, specifically in S4, the driver location data with the driver's terminal on / off status within each five-minute period is calculated, and the duration within the window is calculated. If there is no next event time for the current location data, it means that the driver has not switched to stopping the vehicle after this location event within the current five-minute segment. In this case, the end time of this five-minute window is subtracted from the current event time. Figure 2 Scenario 2 is shown.
[0072] In this embodiment, specifically in S5, the calculation of the driving time of each driver within each electronic fence within five minutes uses the EXPLODE function and lateral view to convert the driver's location data from column to row, with one record for each driver and each fence ID within five minutes;
[0073] If there is no fence ID, assign a value of 0.
[0074] Example 3
[0075] like Figure 1 As shown, this embodiment of the invention provides a method for calculating minute-level offline driver vehicle dispatch time within an electronic fence based on ODPS, including the following steps:
[0076] S1. Construct a detailed dataset;
[0077] S2, Fill in the status of point data;
[0078] S3, Associated electronic fence;
[0079] S4. Calculate the driver location data and duration within the window for every five minutes when the driver terminal switch status is on.
[0080] S5. Calculate the driving time of each driver within each electronic fence within five minutes;
[0081] S6. Summarize the driving time of each driver within each electronic fence within five minutes.
[0082] In this embodiment, specifically in S1, constructing the detailed dataset involves taking a data log of driver location data reported by the driver's end every 2 seconds, then extracting one record from the data log every minute through ODPS for minute-level extraction, and then using SQL FULL JOIN to connect the record extracted by minute-level extraction from the data log through ODPS with the data of the driver's end vehicle departure and arrival switch changes.
[0083] In this embodiment, specifically in S2, the location data status is filled by developing a custom UDTF function to fill the switch status and the event time of the next location data reported by the current driver into the location data of each driver every minute, and to record the location latitude and longitude, event time, current departure and arrival switch status, and the time of the next location report status being off for each driver every minute.
[0084] If the driver's terminal does not change the switch status within five minutes, the driver's location and departure / return switch status from the previous five-minute time segment will be retrieved and inherited to ensure that the switch status of each driver's location is present and correct.
[0085] Within the past five minutes, a driver reported their location, but the "stop driving" button was not clicked, even though it must have been clicked in the past.
[0086] In this embodiment, specifically in S3, associating the electronic fence involves performing a Cartesian product of the latitude and longitude X of the driver's location when the driver presses the stop button every minute with the electronic fence Y.
[0087] If the latitude and longitude of the driver's location X = {a,b} and the electronic fence Y = {0,1}, then the Cartesian product of the latitude and longitude X = {a,b} and the electronic fence Y is {(a,0),(a,1),(b,0),(b,1)}.
[0088] This is used to stitch together the electronic fence Y that matches the latitude and longitude X of the driver's location; if no match is found, the value is assigned to 0.
[0089] In this embodiment, the Cartesian product calculation does not consider the driver's time in the electronic fence scenario.
[0090] In this embodiment, specifically in S4, the driver terminal switch status data for drivers that are on within every five minutes is calculated, and the duration within the window is calculated. If the first data point in the current segment is off, the departure time indicates it was previously on. Therefore, the start time of the current window is subtracted from the duration of this event. Figure 2 Scenario 3 is shown.
[0091] In this embodiment, specifically in S5, the calculation of the driving time of each driver within each electronic fence within five minutes uses the EXPLODE function and lateral view to convert the driver's location data from column to row, with one record for each driver and each fence ID within five minutes;
[0092] If there is no fence ID, assign a value of 0.
[0093] Example 4
[0094] like Figure 1 As shown, this embodiment of the invention provides a method for calculating minute-level offline driver vehicle dispatch time within an electronic fence based on ODPS, including the following steps:
[0095] S1. Construct a detailed dataset;
[0096] S2, Fill in the status of point data;
[0097] S3, Associated electronic fence;
[0098] S4. Calculate the driver location data and duration within the window for every five minutes when the driver terminal switch status is on.
[0099] S5. Calculate the driving time of each driver within each electronic fence within five minutes;
[0100] S6. Summarize the driving time of each driver within each electronic fence within five minutes.
[0101] In this embodiment, specifically in S1, constructing the detailed dataset involves taking a data log of driver location data reported by the driver's end every 15 seconds, then extracting one record from the data log every minute through ODPS for minute-level extraction, and then using SQL FULL JOIN to connect the record extracted by minute-level extraction from the data log through ODPS with the data of the driver's end vehicle departure and arrival switch changes.
[0102] In this embodiment, specifically in S2, the location data status is filled by developing a custom UDTF function to fill the switch status and the event time of the next location data reported by the current driver into the location data of each driver every minute, and to record the location latitude and longitude, event time, current departure and arrival switch status, and the time of the next location report status being off for each driver every minute.
[0103] If the driver's terminal does not change the switch status within five minutes, the driver's location and departure / return switch status from the previous five-minute time segment will be retrieved and inherited to ensure that the switch status of each driver's location is present and correct.
[0104] Within the past five minutes, a driver reported their location, but the "stop driving" button was not clicked, even though it must have been clicked in the past.
[0105] In this embodiment, specifically in S3, associating the electronic fence involves performing a Cartesian product of the latitude and longitude X of the driver's location when the driver presses the stop button every minute with the electronic fence Y.
[0106] If the latitude and longitude of the driver's location X = {a,b} and the electronic fence Y = {0,1}, then the Cartesian product of the latitude and longitude X = {a,b} and the electronic fence Y is {(a,0),(a,1),(b,0),(b,1)}.
[0107] This is used to stitch together the electronic fence Y that matches the latitude and longitude X of the driver's location; if no match is found, the value is assigned to 0.
[0108] In this embodiment, the Cartesian product calculation does not consider the driver's time in the electronic fence scenario.
[0109] In this embodiment, specifically in S4, the driver location data with the driver's terminal switch status on every five minutes is calculated, and the duration within the window is calculated. If there is a next event time for the current location data, then the next event time minus the current event time is taken as the vehicle departure time within the fence. Figure 2 Scenario 1 is shown.
[0110] In this embodiment, specifically in S5, the calculation of the driving time of each driver within each electronic fence within five minutes uses the EXPLODE function and lateral view to convert the driver's location data from column to row, with one record for each driver and each fence ID within five minutes;
[0111] If there is no fence ID, assign a value of 0.
[0112] Example 5
[0113] like Figure 1As shown, this embodiment of the invention provides a method for calculating minute-level offline driver vehicle dispatch time within an electronic fence based on ODPS, including the following steps:
[0114] S1. Construct a detailed dataset;
[0115] S2, Fill in the status of point data;
[0116] S3, Associated electronic fence;
[0117] S4. Calculate the driver location data and duration within the window for every five minutes when the driver terminal switch status is on.
[0118] S5. Calculate the driving time of each driver within each electronic fence within five minutes;
[0119] S6. Summarize the driving time of each driver within each electronic fence within five minutes.
[0120] In this embodiment, specifically in S1, constructing the detailed dataset involves taking a data log of driver location data reported by the driver's end every 15 seconds, then extracting one record from the data log every minute through ODPS for minute-level extraction, and then using SQL FULL JOIN to connect the record extracted by minute-level extraction from the data log through ODPS with the data of the driver's end vehicle departure and arrival switch changes.
[0121] In this embodiment, specifically in S2, the location data status is filled by developing a custom UDTF function to fill the switch status and the event time of the next location data reported by the current driver into the location data of each driver every minute, and to record the location latitude and longitude, event time, current departure and arrival switch status, and the time of the next location report status being off for each driver every minute.
[0122] If the driver's terminal does not change the switch status within five minutes, the driver's location and departure / return switch status from the previous five-minute time segment will be retrieved and inherited to ensure that the switch status of each driver's location is present and correct.
[0123] Within the past five minutes, a driver reported their location, but the "stop driving" button was not clicked, even though it must have been clicked in the past.
[0124] In this embodiment, specifically in S3, associating the electronic fence involves performing a Cartesian product of the latitude and longitude X of the driver's location when the driver presses the stop button every minute with the electronic fence Y.
[0125] If the latitude and longitude of the driver's location X = {a,b} and the electronic fence Y = {0,1}, then the Cartesian product of the latitude and longitude X = {a,b} and the electronic fence Y is {(a,0),(a,1),(b,0),(b,1)}.
[0126] This is used to stitch together the electronic fence Y that matches the latitude and longitude X of the driver's location; if no match is found, the value is assigned to 0.
[0127] In this embodiment, the Cartesian product calculation does not consider the driver's time in the electronic fence scenario.
[0128] In this embodiment, specifically in S4, the driver location data with the driver's terminal on / off status within each five-minute period is calculated, and the duration within the window is calculated. If there is no next event time for the current location data, it means that the driver has not switched to stopping the vehicle after this location event within the current five-minute segment. In this case, the end time of this five-minute window is subtracted from the current event time. Figure 2 Scenario 2 is shown.
[0129] In this embodiment, specifically in S5, the calculation of the driving time of each driver within each electronic fence within five minutes uses the EXPLODE function and lateral view to convert the driver's location data from column to row, with one record for each driver and each fence ID within five minutes;
[0130] If there is no fence ID, assign a value of 0.
[0131] Example 6
[0132] like Figure 1 As shown, this embodiment of the invention provides a method for calculating minute-level offline driver vehicle dispatch time within an electronic fence based on ODPS, including the following steps:
[0133] S1. Construct a detailed dataset;
[0134] S2, Fill in the status of point data;
[0135] S3, Associated electronic fence;
[0136] S4. Calculate the driver location data and duration within the window for every five minutes when the driver terminal switch status is on.
[0137] S5. Calculate the driving time of each driver within each electronic fence within five minutes;
[0138] S6. Summarize the driving time of each driver within each electronic fence within five minutes.
[0139] In this embodiment, specifically in S1, constructing the detailed dataset involves taking a data log of driver location data reported by the driver's end every 15 seconds, then extracting one record from the data log every minute through ODPS for minute-level extraction, and then using SQL FULL JOIN to connect the record extracted by minute-level extraction from the data log through ODPS with the data of the driver's end vehicle departure and arrival switch changes.
[0140] In this embodiment, specifically in S2, the location data status is filled by developing a custom UDTF function to fill the switch status and the event time of the next location data reported by the current driver into the location data of each driver every minute, and to record the location latitude and longitude, event time, current departure and arrival switch status, and the time of the next location report status being off for each driver every minute.
[0141] If the driver's terminal does not change the switch status within five minutes, the driver's location and departure / return switch status from the previous five-minute time segment will be retrieved and inherited to ensure that the switch status of each driver's location is present and correct.
[0142] Within the past five minutes, a driver reported their location, but the "stop driving" button was not clicked, even though it must have been clicked in the past.
[0143] In this embodiment, specifically in S3, associating the electronic fence involves performing a Cartesian product of the latitude and longitude X of the driver's location when the driver presses the stop button every minute with the electronic fence Y.
[0144] If the latitude and longitude of the driver's location X = {a,b} and the electronic fence Y = {0,1}, then the Cartesian product of the latitude and longitude X = {a,b} and the electronic fence Y is {(a,0),(a,1),(b,0),(b,1)}.
[0145] This is used to stitch together the electronic fence Y that matches the latitude and longitude X of the driver's location; if no match is found, the value is assigned to 0.
[0146] In this embodiment, the Cartesian product calculation does not consider the driver's time in the electronic fence scenario.
[0147] In this embodiment, specifically in S4, the driver terminal switch status data for drivers that are on within every five minutes is calculated, and the duration within the window is calculated. If the first data point in the current segment is off, the departure time indicates it was previously on. Therefore, the start time of the current window is subtracted from the duration of this event. Figure 2 Scenario 3 is shown.
[0148] In this embodiment, specifically in S5, the calculation of the driving time of each driver within each electronic fence within five minutes uses the EXPLODE function and lateral view to convert the driver's location data from column to row, with one record for each driver and each fence ID within five minutes;
[0149] If there is no fence ID, assign a value of 0.
[0150] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope disclosed in the present invention, and these should all be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for calculating minute-level offline driver vehicle dispatch time within an electronic fence based on ODPS, characterized in that, Including Next steps: S1. Construct a detailed dataset; S2, Fill in the status of point data; S3, Associated electronic fence; S4. Calculate the driver location data and duration within the window for every five minutes when the driver terminal switch status is on. S5. Calculate the driving time of each driver within each electronic fence within five minutes; S6. Summarize the driving time of each driver within each electronic fence within five minutes; In S1, constructing a detailed dataset involves taking a data log from which the driver reports driver location data every 2-15 seconds, extracting one record from the data log every minute using ODPS, and then using SQL FULL JOIN to connect the extracted record from the data log with the data on the driver's departure and arrival switch changes. In S2, the location data status is filled by developing a custom UDTF function to fill the switch status and the event time of the next location data reported by the current driver into the location data of each driver every minute, and to record the location latitude and longitude, event time, current departure and arrival switch status, and the time of the next location report status being off for each driver every minute. If the driver's terminal does not change the switch status within five minutes, the driver's location and departure / return switch status from the previous five-minute time segment will be retrieved and inherited to ensure that the switch status of each driver's location is present and correct. Within the past five minutes, a driver reported a location, but the "Return to Work" button was not clicked, even though it was clicked in the past. In S3, the associated electronic fence is the Cartesian product of the latitude and longitude X of the driver's location when the driver presses the stop button every minute with the electronic fence Y. If the latitude and longitude of the driver's location X = {a, b} and the electronic fence Y = {0, 1}, then the Cartesian product of the latitude and longitude X = {a, b} and the electronic fence Y is {(a, 0), (a, 1), (b, 0), (b, 1)}. Used to stitch together the electronic fence Y that matches the latitude and longitude X of the driver's location; if no match is found, the value is assigned to 0. The Cartesian product calculation does not consider the driver's time in the electronic fence scenario.
2. The method for calculating minute-level offline driver vehicle departure time within an electronic fence based on ODPS according to claim 1, characterized in that: In S4, the driver location data with the driver terminal switch status on is calculated every five minutes, and the duration within the window is calculated. If there is a next event time for the current location data, then the next event time minus the current event time is used as the vehicle departure time within the fence.
3. The method for calculating minute-level offline driver vehicle departure time within an electronic fence based on ODPS according to claim 1, characterized in that: In S4, the driver location data with the driver terminal switch status on is calculated every five minutes, and the duration within the window is calculated. If there is no next event time for the current location data, it means that the driver has not switched to stopping the vehicle after this location event within the current five-minute segment. Then, the end time of this five-minute window is subtracted from the current event time.
4. The method for calculating minute-level offline driver vehicle departure time within an electronic fence based on ODPS according to claim 1, characterized in that: In S4, the driver location data and window status of the driver end switch being on are calculated every five minutes. The duration calculation within the passage is based on the first data point of the current entry point. If the exit time was closed, it indicates that the previous state was open; therefore, the current time is used. The window's start time minus the duration of this event.
5. The method for calculating minute-level offline driver vehicle departure time within an electronic fence based on ODPS according to claim 1, characterized in that: In S5, the calculation of the driving time of each driver within each electronic fence within five minutes uses the EXPLODE function and lateral view to transform the driver's location data into columns and rows, with one record per driver per fence ID within five minutes; If there is no fence ID, assign a value of 0.
Citation Information
Patent Citations
Activity duration calculation method and device, electronic equipment and storage medium
CN115640469A
