Multi-attribute track traffic statistical method based on Mongo database

Through the multi-attribute dynamic grouping and traffic statistics method based on Mongo database, the problem of inaccurate multi-attribute track traffic statistics in the existing technology is solved, and more accurate and efficient traffic characteristic analysis is achieved.

CN120371867APending Publication Date: 2025-07-25NANJING RES INST OF ELECTRONICS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510536364.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The prior art cannot perform multi-attribute grouping and precise statistics of historical track flow, resulting in statistical deviations and inaccurate flow characteristics analysis.

Method used

The multi-attribute dynamic grouping and traffic statistics method based on Mongo database is used to obtain historical track information through query conditions, dynamically divide the time period, and count the track flow of each sub-time period, and finally integrate it into the traffic statistics results within the total time period.

Benefits of technology

The track flow characteristic analysis based on different attributes is realized, which improves the accuracy and efficiency of flow statistics and reduces statistical deviation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371867A_ABST
    Figure CN120371867A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-attribute track traffic statistical method based on a Mongo database, and belongs to the technical field of data statistical analysis, and the method comprises a multi-attribute dynamic grouping step and a traffic statistical step, and specifically comprises the following steps: 1, determining a query condition, and obtaining historical track information in the Mongo database through the query condition; 2, dividing the inquired historical track information according to time periods; the flow statistical step comprises the following steps: step 3, dynamically dividing a statistical time period into a plurality of sub-time periods based on a query result of historical track data; 4, counting the track traffic of each sub-time period; 5, integrating the track traffic of all the sub-time periods into a traffic statistical result in the total time period; according to the method, the track data can be dynamically grouped based on different attributes, and feature analysis of track traffic of different attribute combinations is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data statistical analysis, and particularly relates to a multi-attribute track traffic statistical method based on a Mongo database. Background Art

[0002] In the review analysis, it is often necessary to statistically analyze the characteristics of historical track data. Among them, the data traffic represents the change in the number of tracks and is one of the common characteristics of historical track data; and the traffic statistical analysis can reflect the change trend of the data traffic, so it is extremely important in the review analysis.

[0003] The common method for traffic statistics is segmented statistics, that is, the statistical time period is divided into several sub-time periods, the number of tracks in each sub-time period is queried based on the Golden real-time database, and then the track traffic map within the statistical time period is integrated. This calculation method depends on the Golden database, and its provided historical data service focuses on the storage and efficient retrieval of historical data, which is stable and reliable. However, only the number of tracks is configured for historical tracks, and multi-attribute grouping cannot be performed, so more detailed multi-attribute track traffic information cannot be statistically analyzed; the division of sub-time periods in segmented statistics is static, and tracks that do not completely exist in the entire sub-time period will still be counted in the traffic data of this sub-time period, resulting in statistical deviation. Therefore, this method cannot accurately reflect the change characteristics of track traffic. Summary of the Invention

[0004] Aiming at the above problems, the object of the present invention is to adopt a traffic statistical method based on a Mongo database, and utilize the advantages of multi-attribute recording and fast query efficiency of the Mongo database, so as to not only statistically analyze multi-attribute track traffic information, but also dynamically divide sub-time periods to generate more accurate track traffic data.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is: a multi-attribute track traffic statistical method based on a Mongo database, including a multi-attribute dynamic grouping step and a traffic statistical step. The multi-attribute dynamic grouping step includes: Step 1: Determine the query conditions, and obtain historical track information in the Mongo database through the query conditions; Step 2: Divide the obtained historical track information according to the time sequence; The traffic statistical step includes: Step 3: Dynamically divide the statistical time period into several sub-time periods based on the query results of the historical track data; Step 4: Statistically analyze the track traffic in each sub-time period; Step 5: Integrate the track traffic in all sub-time periods into the traffic statistical result within the total time period.

[0006] The query conditions include start time, end time, friend-or-foe attribute, country attribute, type attribute, and information source, where the start time and end time are necessary conditions.

[0007] The query conditions need to be judged for legality. If the end time is later than the start time, the query conditions are considered legal and a correct code is output; if the end time is earlier than the start time, the query conditions are considered illegal, the illegal operation conditions are removed, and an error code is set.

[0008] In step two, the processing logic for judging the chronological order of the query results is as follows: Let the time periods be P1 and P2. First, judge whether the start time of time period P1 is equal to the start time of time period P2. If so, continue to judge whether the end time of time period P1 is earlier than the end time of time period P2; if not, continue to judge whether the start time of time period P1 is earlier than the start time of time period P2. When the end time of time period P1 is earlier than the end time of time period P2, it is determined that time period P1 is before time period P2. When the end time of time period P1 is later than the end time of time period P2 or the start time of time period P1 is earlier than the start time of time period P2, it is determined that time period P1 is after time period P2.

[0009] The specific content of step three is as follows: Step 3.1: Organize the start time and end time of the track data obtained by the query to obtain a start time set and an end time set respectively, and then merge the two time sets to obtain a set S0 that contains both the start time and the end time. Step 3.2: Sort the time set S0 from earliest to latest to obtain a new time set S1. Step 3.3: Traverse the time set S1, use the i-th element of S1 as the start time and the (i + 1)-th element as the end time to obtain the time period Pi, where i = 0, 1, 2... n - 1. Step 3.4: The time period set composed of P0 - P1 -... - Pn - 1 is the dynamically divided sub-time period set.

[0010] The specific content of step four is as follows: Step 4.1: Traverse the track query result information and a certain sub-time. Step 4.2: If there is an intersection between the sub-time period and the start and end time periods of the track data, the number of tracks in this sub-time period is incremented by 1. Step 4.3: Traverse the sub-time period set obtained in step three, repeat the operations of step 4.1 and step 4.2, and finally obtain the track traffic of all sub-time periods.

[0011] The specific content of step five is as follows: Step 5.1: Use the traffic statistics result of the first sub - time period as the starting traffic volume. Step 5.2: Compare the starting traffic volume with the traffic volume of the next sub - time period. Step 5.3: If they are equal, remove the traffic statistics results of the starting traffic volume and the next sub - time period, merge the time periods and traffic volumes of both to generate a new traffic statistics result for the sub - time period, and use the new traffic statistics result for the sub - time period as the starting traffic volume. Step 5.4: If they are not equal, use the traffic statistics result of the next sub - time period as the calculated traffic volume. Step 5.5: Repeat the operations from Step 5.2 to Step 5.4 until all sub - time periods in Step 4 are traversed. The finally obtained result is the accurate traffic statistics result of the track.

[0012] The present invention uses a Mongo database to perform traffic statistics on historical track data through two steps: multi - attribute dynamic grouping and traffic statistics. Among them, the main purpose of multi - attribute dynamic grouping is to dynamically combine historical track information based on multiple track attributes, realize the dynamic division of historical track information, and provide basic data for the next - stage traffic statistics; the main purpose of traffic statistics is to dynamically divide the statistical time period into several sub - time periods based on the time information of historical tracks, and dynamically count the traffic volume of each sub - time period, and finally integrate it into the traffic statistics result within the total time period.

[0013] Compared with the prior art, the technical solution adopted by the present invention has the following beneficial effects: 1. The present invention uses a Mongo database, which has the advantages of high - efficiency storage, fast query, and multi - attribute recording.

[0014] 2. The present invention can perform dynamic grouping on track data based on different attributes, which is more conducive to the feature analysis of track traffic with different attribute combinations.

[0015] 3. The present invention can dynamically divide the sub - time periods of the traffic statistics result, so the traffic statistics result is more accurate.

[0016] Figure 1 It is the flow chart of the multi - attribute track traffic statistics method based on the Mongo database in the present invention.

[0017] Figure 2 It is the flow chart of the legal determination processing logic of the query conditions in the present invention.

[0018] Figure 3 It is the flow chart of the determination logic of the time sequence of the query results in the present invention.

[0019] Figure 4 It is the flow chart of the dynamic generation processing logic of sub - time periods in the present invention.

[0020] Figure 5 It is the flowchart of traffic statistics processing for a single sub - time period in the present invention.

[0021] Figure 6 It is the flowchart of combined processing for all sub - time periods in the present invention. Detailed implementation manners

[0022] The technical solution of the present invention will be further explained below in conjunction with the accompanying drawings of the specification and specific embodiments.

[0023] Embodiment 1: As Figure 1 shown, the flowchart of a multi - attribute track traffic statistics method based on Mongo database in this embodiment includes: a multi - attribute dynamic grouping step and a traffic statistics step. The multi - attribute dynamic grouping step includes: Step 1: Determine the query conditions and obtain the historical track information in the Mongo database through the query conditions; Step 2: Divide the obtained historical track information according to the time sequence; The traffic statistics step includes: Step 3: Dynamically divide the statistical time period into several sub - time periods based on the query result of the historical track data; Step 4: Statistic the track traffic of each sub - time period; Step 5: Integrate the track traffic of all sub - time periods into the traffic statistics result within the total time period.

[0024] After setting the query conditions (i.e., calling the function setCondidtion), the software will perform traffic statistics analysis on the historical track data, and the main processing flow is completed in this function. The algorithm involves conditionIsValid (judgment of the legality of query conditions), isNextPeriod (judgment of the time period before and after), getSubPeriod (dynamically generate sub - time periods), calTraffic (traffic statistics of sub - time periods), and joinPeriod (merging of sub - time periods). The query conditions include start time, end time, friend - enemy attribute, country attribute, type attribute, and information source, where the start time and end time are necessary conditions; the remaining conditions can be set according to business needs.

[0025] The processing logic flowchart of the legality judgment of the query conditions is as Figure 2 shown. The query conditions need to be judged for legality. If the end time is later than the start time, the query conditions are considered legal and a correct code is output; if the end time is earlier than the start time, the query conditions are considered illegal, the illegal operation conditions are excluded, and an error code is set.

[0026] The processing logic flow chart for determining the chronological order of query results is as follows Figure 3 shown. Let the time period P1 and the time period P2. First, determine whether the start time of the time period P1 is equal to the start time of the time period P2. If so, continue to determine whether the end time of the time period P1 is earlier than the end time of the time period P2; if not, continue to determine whether the start time of the time period P1 is earlier than the start time of the time period P2; When the end time of the time period P1 is earlier than the end time of the time period P2, it is determined that the time period P1 is before the time period P2; When the end time of the time period P1 is later than the end time of the time period P2 or the start time of the time period P1 is earlier than the start time of the time period P2, it is determined that the time period P1 is after the time period P2.

[0027] The processing logic flow of dynamic generation of sub-time periods is as follows Figure 4 shown, specifically including: Step 3.1: Organize the start time and end time of the track data obtained by the query to obtain a start time set and an end time set respectively, and then merge the two time sets to obtain a set S0 that contains both the start time and the end time; Step 3.2: Sort the time set S0 from the earliest time to the latest time to obtain a new time set S1; Step 3.3: Traverse the time set S1, use the i-th element of S1 as the start time and the (i + 1)-th element as the end time to obtain the time period Pi, where i = 0, 1, 2... n - 1; Step 3.4: The time period set formed by P0 - P1 -... - Pn - 1 is the dynamically divided sub-time period set.

[0028] The processing flow of traffic statistics for a single sub-time period is as follows Figure 5 shown, specifically including: Step 4.1: Traverse the track query result information and a certain sub-time; Step 4.2: If there is an intersection between the sub-time period and the start and end time periods of the track data, the number of tracks in this sub-time period is incremented by 1; Step 4.3: Traverse the sub-time period set obtained in step three, repeat the operations of step 4.1 and step 4.2, and finally obtain the track traffic of all sub-time periods.

[0029] The processing flow of merging all sub-time periods is as follows Figure 6 shown, specifically including: Step 5.1: Use the traffic statistics result of the first sub-time period as the starting traffic; Step 5.2: Compare the starting traffic with the traffic of the next sub-time period; Step 5.3: If they are equal, remove the starting flow rate and the flow rate statistical result of the next sub-time period, merge the time periods and flow rates of the two to generate a new sub-time period flow rate statistical result, and use the new sub-time period flow rate statistical result as the starting flow rate; Step 5.4: If they are not equal, use the flow rate statistical result of the next sub-time period as the calculated flow rate; Step 5.5: Repeat the operations in Step 5.2 to Step 5.4 until all sub-time periods in Step 4 are traversed. What is finally obtained is the accurate track flow rate statistical result.

[0030] Embodiment 2 In order to improve the efficiency of data processing and calculation, it is preferably to use an independent thread to calculate the track flow rate, which specifically includes the following steps: Step 1, start a thread for algorithm data processing; Step 2, set the query conditions and pass them to this thread; Step 3, start the thread; Step 4, obtain the query result; Step 5, sort the query results; Step 6, generate sub-time periods; Step 7, calculate the flow rate of each sub-time period; Step 8, merge the flow rates of all sub-time periods and store them; Step 9, set the completion flag and send a signal to the main thread.

[0031] Although the present invention has been disclosed above with preferred embodiments, the embodiments and drawings are not used to limit the present invention. Any person skilled in this art can make various changes or modifications without departing from the spirit and scope of the present invention, but they are still within the protection scope of the present invention. Therefore, the protection scope of the present invention should be defined by the protection scope of the claims of this application.

Claims

1. A multi-attribute track traffic statistics method based on Mongo database, characterized in that, including a multi-attribute dynamic grouping step and a traffic statistics step, and the multi-attribute dynamic grouping step includes: Step 1: Determine the query conditions, and obtain the historical track information in the Mongo database through the query conditions; Step 2: Divide the obtained historical track information according to the chronological order of time periods; The traffic statistics step includes: Step 3: Dynamically divide the statistical time period into several sub-time periods based on the query results of the historical track data; Step 4: Count the track traffic in each sub-time period; Step 5: Integrate the track traffic of all sub-time periods into the traffic statistics result within the total time period.

2. The multi-attribute track traffic statistics method based on Mongo database according to claim 1, characterized in that: The query conditions include the start time, end time, friend-or-foe attribute, country attribute, type attribute, and information source, where the start time and end time are necessary conditions.

3. A multi-attribute track traffic statistics method based on a Mongo database according to claim 1, characterized in that: The query conditions need to be judged for legality. If the end time is later than the start time, the query conditions are considered legal and the correct code is output; If the end time is earlier than the start time, the query conditions are considered illegal, the illegal operation conditions are removed, and an error code is set.

4. A multi-attribute track traffic statistics method based on the Mongo database according to claim 1, characterized in that In the above Step 2, the processing logic for judging the chronological order of the query results is: Let the time periods be P1 and P2. First, judge whether the start time of time period P1 is equal to the start time of time period P2. If so, continue to judge whether the end time of time period P1 is earlier than the end time of time period P2; if not, continue to judge whether the start time of time period P1 is earlier than the start time of time period P2; When the end time of time period P1 is earlier than the end time of time period P2, it is determined that time period P1 is before time period P2; When the end time of time period P1 is later than the end time of time period P2 or the start time of time period P1 is earlier than the start time of time period P2, it is determined that time period P1 is after time period P2.

5. A multi-attribute track traffic statistics method based on a Mongo database according to claim 1, characterized in that The specific content of the above Step 3 is: Step 3.1: Organize the start time and end time of the obtained track data to obtain a start time set and an end time set respectively, and then merge the two time sets to obtain a set S0 that contains both the start time and the end time; Step 3.2: Sort the time set S0 from the earliest time to the latest time to obtain a new time set S1; Step 3.3: Traverse the time set S1, use the i-th element of S1 as the start time and the (i + 1)-th element as the end time to obtain the time period Pi, where i = 0, 1, 2... n - 1; Step 3.4: The set of time periods formed by P0 - P1 -... - Pn - 1 is the set of sub-time periods obtained by dynamic division.

6. The multi-attribute track traffic statistics method based on Mongo database according to claim 5, characterized in that The specific content of the above Step 4 is: Step 4.1: Traverse the track query result information and a certain sub-time; Step 4.2: If there is an intersection between the sub-time period and the start and end time periods of the track data, the track count of this sub-time period is incremented by 1; Step 4.3: Traverse the set of sub-time periods obtained in Step 3, and repeat the operations of Step 4.1 and Step 4.

2. Finally, obtain the track traffic of all sub-time periods.

7. A multi-attribute track traffic statistics method based on a Mongo database according to claim 8, characterized in that The specific content of the above Step 5 is: Step 5.1: Use the traffic statistics result of the first sub-time period as the starting traffic; Step 5.2: Compare the starting traffic with the traffic of the next sub-time period; Step 5.3: If they are equal, remove the starting flow and the flow statistics result of the next sub-time period, merge the time periods and flows of both to generate a new sub-time period flow statistics result, and use the new sub-time period flow statistics result as the starting flow; Step 5.4: If they are not equal, use the flow statistics result of the next sub-time period as the calculated flow; Step 5.5: Repeat the operations in Step 5.2 to Step 5.4 until all sub-time periods in Step 4 are traversed, and the finally obtained result is the accurate track flow statistics result.