Flexible multi-dimensional multi-cycle data comparative analysis method and device
Through flexible multi-dimensional multi-period data comparison and analysis methods, the limitations of fixed cycles in traditional data analysis are solved, customized cycle selection and efficient data processing are realized, customized ratio calculation is supported, and the flexibility and depth of data analysis is improved. Adapt to a variety of business scenarios, improving user experience and analysis quality.
Patent Information
- Application Number
- CN202410970769.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-08
AI Technical Summary
Traditional data analysis methods are limited by preset cyclical frameworks, cannot flexibly respond to changing business needs, and are difficult to consider the impact of external events and non-periodic factors, resulting in inefficiency and information omissions.
Provide a flexible multi-dimensional multi-period data comparison and analysis method, which supports highly customized cycle selection. Through parameter definition module, parameter analysis and data query module, periodic data query module and periodic comparison module, SQL query statements are constructed, ratios are calculated and merged. Data, supports custom ratio calculation expressions.
It has achieved accurate capture of business trends in a rapidly changing market environment, improved decision-making timeliness and accuracy, comprehensively evaluated data, revealed causal relationships, efficiently processed large-scale multi-dimensional data, lowered the threshold for use, and improved analysis efficiency and quality.
Smart Images

Figure CN118916396A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data analysis, and in particular to a flexible multi-dimensional and multi-period data comparison and analysis method and device. Background Art
[0002] The current data analysis field faces a series of challenges, especially when dealing with periodic data comparisons. Traditional data analysis methods are mostly limited to a preset periodic framework, such as only supporting year-to-year or month-to-month comparisons. This fixed model is rigid in a rapidly evolving business environment and cannot effectively respond to changing business needs. For example, companies may need to flexibly analyze data by week, ten-day, or even any custom time span in response to specific market changes in order to accurately capture trends.
[0003] In addition, the operating rhythm and business characteristics of each industry vary greatly, and fixed comparison period settings are difficult to meet in-depth and diversified analysis requirements. Taking the retail industry and education industry as examples, the former may pay special attention to sales fluctuations caused by holiday effects, while the latter pays more attention to the performance comparison between the beginning and end of the semester. The needs in these specific situations exceed the coverage of traditional cycle analysis.
[0004] The limitations of data interpretation are also an important issue. Traditional analysis often ignores the impact of external events or non-cyclical factors, such as sudden market changes, abnormal weather phenomena or specific marketing activities. Although these factors are not inherent in the cycle, they may have a significant impact on the data, but traditional analysis is difficult to take them into account.
[0005] With the advent of the big data era, the scale of data has exploded and the data structure has become increasingly complex. Traditional periodic analysis tools are unable to cope with this type of data, especially when flexible comparisons across multiple non-continuous periods are required. They are inefficient and cannot meet users' immediate, multi-dimensional analysis needs.
[0006] On the other hand, many existing analysis tools are too complex to be understood and operated by non-technical users. The lack of intuitive and easy-to-use custom configuration options often makes it difficult and inefficient for users to conduct personalized cycle comparison analysis.
[0007] In view of the above problems, there is an urgent need for a new analysis method and device that can not only support highly flexible cycle selection, but also maintain high efficiency when processing large amounts of data, so as to meet the needs of in-depth data analysis in various business scenarios. Summary of the invention
[0008] In order to solve the limitation problem of fixed period comparison in traditional data analysis, the present invention provides a flexible multi-dimensional and multi-period data comparison and analysis method and device, which supports highly customized period selection, can flexibly adapt to various business scenarios, efficiently processes large amounts of data, and supports the form of configuration parameters, thereby providing more accurate and comprehensive support for enterprise decision-making.
[0009] To achieve the above object, the present invention adopts the following technical solutions:
[0010] In one embodiment of the present invention, a flexible multi-dimensional multi-period data comparison and analysis method is proposed, the method comprising:
[0011] Users define query parameters in a fixed format through the parameter definition module;
[0012] The parameter parsing and data query module parses the query parameters and constructs an SQL query statement, and queries the corresponding basic period data from the data source according to the constructed SQL query statement;
[0013] The periodic data query module traverses the comparison period set in the query parameter, calculates the corresponding comparison period time set based on the basic period time set, and uses the query parameter as the comparison period query parameter, removes the time dimension filter condition, adds the calculated comparison period time set as the new time dimension filter condition, and adds other dimension data sets as filter conditions; the comparison period data is queried through parameter parsing and data query module;
[0014] The cycle comparison module obtains the comparison cycle data and matches it with the basic cycle data based on the time dimension and other dimension fields. The ratio of each indicator of each matching record is calculated according to the ratio calculation expression, and then the comparison cycle data and the calculated ratio are merged with the basic cycle data.
[0015] Furthermore, the query parameters include data source information, query fields, data filtering conditions, sorting and comparison periods. The data filtering conditions include time dimension filtering conditions of the basic period and other dimension filtering conditions. The comparison period includes offset, period granularity and ratio calculation formula.
[0016] Furthermore, the query parameter construction steps for the comparison period are as follows:
[0017] The periodic data query module traverses the comparison period set in the query parameter, traverses each record of the basic periodic data based on each comparison period in the set, and obtains the basic periodic time and other dimension data in the record according to the time dimension and other dimensions in the query field;
[0018] According to the defined offset and cycle granularity of the comparison cycle, the corresponding comparison cycle time is calculated based on the basic cycle time, thereby obtaining a data set of the comparison cycle time corresponding to the time dimension of each record and other dimension data sets;
[0019] Copy the user-defined query parameters into comparison period query parameters. If the comparison period query parameters contain time dimension filter conditions, first delete the original time dimension filter conditions, then add a new time dimension filter condition, with the condition value being the data set of the inferred comparison period time, and at the same time add other dimension filter conditions, with the condition value being other dimension data sets.
[0020] Furthermore, the comparison steps of the cycle comparison module are as follows:
[0021] The cycle comparison module obtains each comparison cycle data and associates it with the basic cycle data according to the time dimension and other dimensions to ensure that each record of the basic cycle data can be matched with the corresponding comparison cycle data;
[0022] For each metric in each matching record, apply the ratio calculation expression for the comparison period to calculate the percentage increase or decrease of the metric.
[0023] In one embodiment of the present invention, a flexible multi-dimensional multi-period data comparison and analysis device is also proposed, the device comprising:
[0024] Parameter definition module, used for users to define query parameters in a fixed format;
[0025] The parameter parsing and data query module is used to parse the query parameters and construct SQL query statements, and query the corresponding data set from the data source according to the constructed SQL query statements;
[0026] The periodic data query module is used to traverse the comparison period set in the query parameter, calculate the corresponding comparison period time set based on the basic period time set, and use the query parameter as the comparison period query parameter, remove the time dimension filter condition, add the calculated comparison period time set as the new time dimension filter condition, and add other dimension data sets as filter conditions;
[0027] The cycle comparison module is used to obtain the comparison cycle data and match it with the basic cycle data based on the time dimension and other dimension fields. The ratio of each indicator of each matching record is calculated according to the ratio calculation expression, and then the comparison cycle data and the calculated ratio are merged with the basic cycle data.
[0028] Furthermore, the query parameters include data source information, query fields, data filtering conditions, sorting and comparison periods. The data filtering conditions include time dimension filtering conditions of the basic period and other dimension filtering conditions. The comparison period includes offset, period granularity and ratio calculation formula.
[0029] Furthermore, the query parameter construction steps for the comparison period are as follows:
[0030] The periodic data query module traverses the comparison period set in the query parameter, traverses each record of the basic periodic data based on each comparison period in the set, and obtains the basic periodic time and other dimension data in the record according to the time dimension and other dimensions in the query field;
[0031] According to the defined offset and cycle granularity of the comparison cycle, the corresponding comparison cycle time is calculated based on the basic cycle time, thereby obtaining a data set of the comparison cycle time corresponding to the time dimension of each record and other dimension data sets;
[0032] Copy the user-defined query parameters into comparison period query parameters. If the comparison period query parameters contain time dimension filter conditions, first delete the original time dimension filter conditions, then add a new time dimension filter condition, with the condition value being the data set of the inferred comparison period time, and at the same time add other dimension filter conditions, with the condition value being other dimension data sets.
[0033] Furthermore, the comparison steps of the cycle comparison module are as follows:
[0034] The cycle comparison module obtains each comparison cycle data and associates it with the basic cycle data according to the time dimension and other dimensions to ensure that each record of the basic cycle data can be matched with the corresponding comparison cycle data;
[0035] For each metric in each matching record, apply the ratio calculation expression for the comparison period to calculate the percentage increase or decrease of the metric.
[0036] In one embodiment of the present invention, a computer device is also proposed, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the aforementioned flexible multi-dimensional and multi-period data comparison and analysis method is implemented.
[0037] In one embodiment of the present invention, a computer-readable storage medium is further proposed, wherein the computer-readable storage medium stores a computer program for executing a flexible multi-dimensional and multi-period data comparison and analysis method.
[0038] Beneficial effects:
[0039] 1. The present invention breaks the cycle limitation of traditional analysis tools and allows users to customize the comparison cycle as needed. Whether it is by week, ten days, any time period or other customized time intervals, data comparison can be easily completed, ensuring that in a rapidly changing market environment, enterprises can accurately capture business trends and improve the timeliness and accuracy of decision-making.
[0040] 2. By considering the impact of extra-cyclical variables such as emergencies, seasonal factors and special market activities, the custom comparison mechanism of the present invention helps to evaluate data more comprehensively, reveal hidden causal relationships and trends, and avoid the omission of important information caused by fixed-cycle analysis.
[0041] 3. Faced with the surge in data volume and structural diversity in the big data era, the solution provided by the present invention can efficiently process large-scale, multi-dimensional data, especially when flexible comparison across discontinuous periods is required. Its efficient data processing capability ensures rapid response and processing of personalized analysis needs, improving the efficiency and quality of data analysis.
[0042] 4. The present invention designs a method and device that supports customized multi-period data comparison analysis, with the focus on allowing users to flexibly configure analysis parameters without having to directly operate complex SQL statements or deeply understand technical details, thereby lowering the usage threshold and improving the convenience and personalization of analysis.
[0043] 5. The present invention can obtain multi-cycle comparison results through one-time parameter transmission. Combined with the support for customized ratio calculation expressions, it not only simplifies the operation process, but also enables enterprises to flexibly design analysis models according to their own business characteristics, obtain more targeted insights, and provide solid data support for strategy adjustment and business optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic flow chart of a flexible multi-dimensional and multi-period data comparison and analysis method according to an embodiment of the present invention;
[0045] Figure 2 This is a diagram of the architecture of a flexible multi-dimensional multi-period data comparison and analysis device according to an embodiment of the present invention;
[0046] Figure 3 It is a schematic diagram of the computer device structure of the present invention. DETAILED DESCRIPTION
[0047] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0048] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a device, apparatus, equipment, method or computer program product. Therefore, the present disclosure may be implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0049] According to an implementation of the present invention, a flexible multi-dimensional and multi-period data comparison and analysis method is proposed, which supports highly customized period selection, can flexibly adapt to various business scenarios, efficiently processes large amounts of data, and supports the form of configuration parameters, thereby providing more accurate and comprehensive support for enterprise decision-making.
[0050] The principle and spirit of the present invention are explained in detail below with reference to several representative embodiments of the present invention.
[0051] The flexible multi-dimensional multi-period data comparison and analysis method of the present invention comprises:
[0052] 1. First, the user needs to provide query parameters in a fixed format, including: data source information, query fields, data filtering conditions, sorting, comparison period and other information. These query parameters are used to guide how to extract and process data from the data source. Among them:
[0053] (1) Data source information: This part of the data must include the database connection parameters, the name of the target database, and the name of the table to be queried, providing the necessary positioning information for data extraction operations.
[0054] (2) The query field needs to specify a field as the time dimension, which is used to define the time base of the comparison period and to calculate the comparison period time. Other fields need to specify dimensions or indicators to facilitate subsequent periodic data analysis.
[0055] (3) Data filtering conditions are not mandatory, and the time dimension filtering conditions of the basic period and other dimension filtering conditions can be set.
[0056] (4) Sorting can be set to sort certain fields of basic periodic data.
[0057] (5) The comparison period includes an offset, period granularity, and a ratio calculation formula (expression). The offset is defined by an integer value. A negative value refers to going back to the corresponding period before the basic period, and a positive value refers to the future period. The period granularity provides a series of enumeration options, such as year, quarter, month, day, etc., to finely control the time range of the comparison. The ratio calculation formula supports user customization, and the default is: (${v1}-${v2}) / ${v2}×100%, where ${v1} represents the basic period indicator value, and ${v2} represents the comparison period indicator value. Based on the specificity of the business scenario, users can freely adjust the offset, select the period granularity, and customize the ratio calculation method to achieve accurate analysis of one or more specific comparison periods.
[0058] 2. The device will then call the parameter parsing and data query module to parse the query parameters, and construct an SQL query statement based on the various attribute information in the query parameters. Then, the corresponding basic cycle data set is queried from the data source based on the constructed SQL query statement. Basic cycle data refers to a data set within a reference time period selected by the user during analysis, which is the basis for data comparison. For example, when analyzing the sales data for May 2024, if May is set as the basic cycle, then the basic cycle data refers to all relevant sales records for this month.
[0059] 3. Next, the periodic data query module will traverse the comparison period set in the query parameters, and then traverse each record of the basic periodic data based on each comparison period in the set, and obtain the basic periodic time and other dimension data in the record according to the time dimension and other dimensions in the query field, and then calculate the comparison period time based on the basic periodic time according to the defined offset and period granularity of the comparison period, so as to obtain a comparison period time data set and other dimension data set corresponding to the time dimension of each record. Then, the query parameters provided by the user are copied into the comparison period query parameters. If the comparison period query parameters contain the time dimension filter condition, the original time dimension filter condition is deleted first, and then a new time dimension filter condition is added, and the condition value is the calculated comparison period time data set. At the same time, other dimension filter conditions are added, and the condition value is the other dimension data set. In this way, the query parameters for a comparison period are constructed, and then the comparison period data is queried by calling the parameter parsing and data query modules, and the comparison period data is handed over to the period comparison module for processing.
[0060] 4. After acquiring each comparison cycle data, the cycle comparison module associates it with the basic cycle data according to the time dimension and other dimension fields, so that each record of the basic cycle data can be matched with a comparison cycle data after association, and then calculates the indicator ratio for each indicator of each record according to the ratio calculation expression, and then adds the comparison cycle data and the calculated indicator ratio to the basic cycle data record. In this way, the original basic cycle data is expanded to include the comparison cycle data and the indicator ratio.
[0061] 5. Finally, we get the comparison period data and index ratio result data. During the whole process, users only need to pass parameters once to get multi-period comparison results, and the comparison ratio calculation expression supports customization, which greatly simplifies user operations.
[0062] It should be noted that, although the operations of the method of the present invention are described in a specific order in the above embodiments and the accompanying drawings, this does not require or imply that the operations must be performed in the specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0063] In order to explain the above-mentioned flexible multi-dimensional and multi-period data comparison and analysis method more clearly, a specific embodiment is used for illustration below. However, it should be noted that this embodiment is only for better illustrating the present invention and does not constitute an improper limitation to the present invention.
[0064] Example:
[0065] In order to achieve flexible multi-dimensional and multi-period data comparison and analysis, the present invention proposes a detailed method flow to ensure that users can flexibly compare data in any period to adapt to changing business needs. Figure 1 As shown, the following are the specific implementation steps of the present invention:
[0066] 1. Parameter definition: First, users need to define query parameters, which include: data source information, query fields, data filtering conditions, sorting, comparison cycle, etc. The following is a detailed description of each parameter:
[0067] (1) Data source definition: including database connection string, database name and table name to be queried. For example, the user can select the company's production database and specify the equipment flow table "dev_flux" as the data source for analysis.
[0068] (2) Dimension and indicator specification: Next, the user defines the query field and selects a field as the time dimension TIME_DIM, such as statistical time (stat_time), which is used for calculations in subsequent cycles. Select the belonging node (s_nodename) as the dimension denoted as DIM, and the inflow (d_influx) and outflow (d_outflux) as the indicator fields denoted as METRIC. The final query parameters are as follows:
[0069]
[0070]
[0071] (3) Data filtering condition definition: If necessary, the user can set the data filtering condition SQL statement. For example, to only analyze the traffic data of the nodes Nanjing and Hangzhou, and the statistical time is from 2024-05-11 to 2024-05-15, set "s_nodename in ('Nanjing', 'Hangzhou') and stat_time>='2024-05-11' and stat_time<='2024-05-15'".
[0072] (4) Sorting requirements: Users can specify sorting SQL statements, such as "order by stat_time desc", to sort in descending order by "stat_time" while maintaining the statistical date order.
[0073] (5) Comparison period: The user defines the comparison period. The comparison period includes offset, period granularity and ratio calculation expression. The offset can be an integer. A negative offset means that the comparison period is calculated based on the basic period time. A positive offset means that the comparison period is calculated based on the basic period time. The period granularity is an enumeration value, including: YEAR, QUARTER, MONTH, DAY, WEEK, HOUR, M30, M15, M10, M5, M. For example, for comparison period 1, set the offset to -1 (to view the data of the previous period), select "MONTH" for the period granularity, and keep the default ratio calculation expression: (${v1}-${v2}) / ${v2}×100%, which is used to calculate the monthly growth rate. The offset is set to -1 (to view the data of the previous cycle), the cycle granularity is selected as "MONTH", and the ratio calculation expression is kept as the default, which is used to calculate the growth rate of the basic cycle compared with the same day of the previous month (daily year-on-year). For comparison cycle 2, the offset is set to -1 (to view the data of the previous cycle), the cycle granularity is selected as "DAY", and the ratio calculation expression is kept as the default, which is used to calculate the growth rate of the basic cycle compared with the previous day (daily year-on-year). Custom ratio calculation expressions are supported, such as calculating the difference: ${v1}-${v2}, where ${v1} represents the basic cycle indicator value, and ${v2} represents the comparison cycle indicator value with the same name as v1. The parameters of the above case are as follows:
[0074]
[0075]
[0076] 2. Parameter parsing and data query module:
[0077] The device obtains the table name from the data source information based on the user's query parameter input and dynamically generates an SQL query statement. Based on the above example, a query can be constructed to extract the flow data from the device flow table "dev_flux" with a statistical time of 2024-05-11 to 2024-05-15, and the inflow and outflow flow data of the nodes in Nanjing and Hangzhou, and arranged in reverse order by statistical date. The system executes the constructed SQL statement to obtain the basic periodic data from the database. The final SQL query statement:
[0078] select stat_time,s_nodename,d_influx,d_outflux from dev_fluxwhere s_nodename in('Nanjing','Hangzhou')
[0079] and stat_time>='2024-05-11'and stat_time<='2024-05-15'order bystat_time desc
[0080] 3. Periodic data query module:
[0081] Next, copy the user query parameters as the comparison period query parameters, and adjust the query parameters - remove the original time dimension filter conditions, replace them with the calculated comparison period time set, and integrate other dimension data sets as filter conditions. At this point, the query parameters for the comparison period are constructed, and then the query task of the comparison period data is completed by calling the parameter parsing and data query module.
[0082] (1) Construction of comparison cycle query parameters: First, traverse the defined comparison cycle set, analyze the basic cycle data for each comparison cycle, and extract the time dimension and other dimension information. Use the offset and cycle granularity of the comparison cycle to infer the corresponding comparison cycle time from the basic cycle time, and form a corresponding data set of the time dimension and other dimensional data. For example, the basic cycle data set is as shown in Table 1:
[0083] Table 1
[0084] stat_time s_nodename d_influx d_outflux 2024-05-21 Nanjing 3742646.99 456373.44 2024-05-21 Hangzhou 4880890.05 285201.58 2024-05-20 Nanjing 3432672.68 472347.85
[0085] Among them, stat_time is the time dimension, the offset of comparison cycle 1 is -1, and the cycle granularity is MONTH. The records in Table 1 can be used to infer the data set of its comparison cycle. After deduplication, the set elements are 2024-04-21 and 2024-04-20. In addition, s_nodename is another dimension. Direct deduplication can obtain a data set, and the set elements are Nanjing and Hangzhou. Then copy the query parameters as the comparison cycle query parameters, delete the original time dimension filter conditions, and then add a new time dimension filter condition stat_time in('2024-04-21','2024-04-20'), and add other dimension filter conditions s_nodename in('Nanjing','Hangzhou'). At this point, the query parameters for this comparison cycle 1 are constructed.
[0086] (2) Periodic data query: Then call the parameter parsing and data query module and pass in the query parameters of comparison period 1 to obtain the data of comparison period 1. See Table 2 below:
[0087] Table 2
[0088] stat_time s_nodename d_influx d_outflux 2024-04-21 Nanjing 2742646.99 356373.44 2024-04-21 Hangzhou 3880890.05 185201.58 2024-04-20 Nanjing 2432672.68 372347.85
[0089] 4. Cycle comparison module:
[0090] (1) Data matching: Obtain the comparison cycle data for association with the basic cycle data. Then match the basic cycle data with the comparison cycle data based on the time dimension (such as "stat_time") and other dimensions (such as "s_nodename") to ensure that each record of the basic cycle data can find the corresponding comparison cycle data.
[0091] (2) Ratio calculation: For each matching record, apply the ratio calculation expression to calculate the growth or decline percentage of the indicator. For example, if the inflow flow of the node Nanjing is 3742646.99 on the basic period 2024-05-21 and 2742646.99 last month, according to the default ratio calculation expression: (${v1}-${v2}) / ${v2}×100%, the growth rate is (3742646.99-2742646.99) / 2742646.99×100%=36.46%.
[0092] (3) Data integration: Combine the comparison period data and the calculated ratio with the basic period data to form a comprehensive data set containing the basic period data, comparison period data and the corresponding indicator ratio. The field names of the comparison period data and the calculated ratio need to be renamed to avoid duplication with the field names of the basic period data. The list code generation rules are as follows:
[0093] Comparison period field name: p_${Comparison period array subscript}_${field name}
[0094] Ratio field name: p_rate_${comparison period array subscript}_${field name}
[0095] At this point, the final query result of the period comparison is generated, as shown in Table 3:
[0096] Table 3
[0097]
[0098] Through the above steps, the present invention realizes flexible comparative analysis of customized multi-period data, which not only improves the flexibility and depth of data analysis, but also greatly enhances the user experience, helping enterprises make more accurate and comprehensive decisions in a complex and changing market environment.
[0099] Based on the same inventive concept, the present invention also proposes a flexible multi-dimensional multi-period data comparison and analysis device. The implementation of the device can refer to the implementation of the above method, and the repetitions are not repeated. The term "module" used below can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or the implementation of a combination of software and hardware is also possible and conceived.
[0100] Figure 2 FIG. 1 is a diagram showing the architecture of a flexible multi-dimensional multi-period data comparison and analysis device according to an embodiment of the present invention. Figure 2 As shown, the device comprises:
[0101] The parameter definition module 101 is used for users to define query parameters in a fixed format; the query parameters include data source information, query fields, data filtering conditions, sorting and comparison periods, etc. The data filtering conditions include the time dimension filtering conditions of the basic period and other dimension filtering conditions. The comparison period includes the offset, period granularity and ratio calculation formula.
[0102] The parameter parsing and data query module 102 is used to parse the query parameters and construct an SQL query statement, and query the corresponding data set from the data source according to the constructed SQL query statement.
[0103] The periodic data query module 103 is used to traverse the comparison period set in the query parameters, traverse each record of the basic periodic data based on each comparison period in the set, and obtain the basic periodic time and other dimension data in the record according to the time dimension and other dimensions in the query field; calculate the corresponding comparison periodic time based on the basic periodic time according to the defined offset and period granularity of the comparison period, so as to obtain a comparison periodic time data set and other dimension data set corresponding to the time dimension of each record; copy the user-defined query parameters into the comparison period query parameters, if the comparison period query parameters contain the time dimension filter condition, first delete the original time dimension filter condition, and then add the new time dimension filter condition, the condition value is the calculated comparison periodic time data set, and at the same time add other dimension filter conditions, the condition value is the other dimension data set.
[0104] The cycle comparison module 104 is used to obtain each comparison cycle data, associate it with the basic cycle data according to the time dimension and other dimensions, and ensure that each record of the basic cycle data can be matched with the corresponding comparison cycle data; for each indicator of each matching record, the ratio calculation expression of the comparison cycle is applied to calculate the growth or decrease percentage of the indicator, and then the comparison cycle data and the calculated ratio are merged with the basic cycle data.
[0105] It should be noted that, although several modules of the flexible multi-dimensional multi-period data comparison and analysis device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules described above can be concretized in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be concretized.
[0106] Based on the above invention concept, Figure 3 As shown, the present invention also proposes a computer device 200, including a memory 210, a processor 220, and a computer program 230 stored in the memory 210 and executable on the processor 220. When the processor 220 executes the computer program 230, the aforementioned flexible multi-dimensional and multi-period data comparison and analysis method is implemented.
[0107] Based on the aforementioned inventive concept, the present invention further proposes a computer-readable storage medium, which stores a computer program for executing the aforementioned flexible multi-dimensional and multi-period data comparison and analysis method.
[0108] The flexible multi-dimensional and multi-period data comparison and analysis method and device proposed in the present invention achieves high flexibility and customization in view of the limitations of fixed-period comparison in traditional data analysis, significantly enhances the depth, breadth and practicality of data analysis, and has the following advantages:
[0109] 1. Improve business adaptability: This invention breaks the cycle limitations of traditional analysis tools and allows users to customize comparison cycles as needed. Whether it is by week, ten days, any time period or other customized time intervals, data comparison can be easily completed, ensuring that in a rapidly changing market environment, enterprises can accurately capture business trends and improve the timeliness and accuracy of decision-making.
[0110] 2. Enhance the depth of data interpretation: By considering the impact of extra-cyclical variables such as emergencies, seasonal factors and special market activities, the custom comparison mechanism of the present invention helps to evaluate data more comprehensively, reveal hidden causal relationships and trends, and avoid the omission of important information caused by fixed-cycle analysis.
[0111] 3. Optimize big data processing efficiency: Faced with the surge in data volume and structural diversity in the big data era, the solution provided by the present invention can efficiently process large-scale, multi-dimensional data, especially when flexible comparison across discontinuous periods is required. Its efficient data processing capabilities ensure rapid response and processing of personalized analysis needs, thereby improving the efficiency and quality of data analysis.
[0112] 4. Enhance user interaction experience: The highly customized parameter setting function significantly improves the user experience. The present invention designs a method and device that supports customized multi-period data comparison analysis, focusing on enabling users to flexibly configure analysis parameters without directly operating complex SQL statements or deeply understanding technical details, thereby lowering the threshold for use and improving the convenience and personalization of analysis.
[0113] 5. Promote intelligent decision-making: Multi-period comparison results can be obtained through a single parameter transfer. Combined with support for custom ratio calculation expressions, it not only simplifies the operation process, but also allows enterprises to flexibly design analysis models according to their own business characteristics, obtain more targeted insights, and provide solid data support for strategy adjustments and business optimization.
[0114] In summary, the introduction of the present invention will greatly improve the flexibility, accuracy and user experience of data analysis, and is a key technological innovation to promote the digital transformation of enterprises and enhance their competitiveness.
[0115] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements contained in the spirit and scope of the attached claims.
[0116] Regarding the limitation of the protection scope of the present invention, those skilled in the art should understand that, based on the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the protection scope of the present invention.
Claims
1. A flexible multi-dimensional and multi-period data comparison and analysis method, characterized in that: The method includes: Users define query parameters in a fixed format through the parameter definition module; The parameter parsing and data query module parses the query parameters and constructs an SQL query statement, and queries the corresponding basic period data from the data source according to the constructed SQL query statement; The periodic data query module traverses the comparison period set in the query parameter, calculates the corresponding comparison period time set based on the basic period time set, and uses the query parameter as the comparison period query parameter, removes the time dimension filter condition, adds the calculated comparison period time set as the new time dimension filter condition, and adds other dimension data sets as filter conditions; the comparison period data is queried through parameter parsing and data query module; The cycle comparison module obtains the comparison cycle data and matches it with the basic cycle data based on the time dimension and other dimension fields. The ratio of each indicator of each matching record is calculated according to the ratio calculation expression, and then the comparison cycle data and the calculated ratio are merged with the basic cycle data.
2. The flexible multi-dimensional multi-period data comparison and analysis method according to claim 1, characterized in that: The query parameters include data source information, query fields, data filtering conditions, sorting and comparison periods. The data filtering conditions include time dimension filtering conditions of the basic period and other dimension filtering conditions. The comparison period includes offset, period granularity and ratio calculation formula.
3. The flexible multi-dimensional multi-period data comparison and analysis method according to claim 1, characterized in that: The query parameter construction steps of the comparison period are as follows: The periodic data query module traverses the comparison period set in the query parameter, traverses each record of the basic periodic data based on each comparison period in the set, and obtains the basic periodic time and other dimension data in the record according to the time dimension and other dimensions in the query field; According to the defined offset and cycle granularity of the comparison cycle, the corresponding comparison cycle time is calculated based on the basic cycle time, thereby obtaining a data set of the comparison cycle time corresponding to the time dimension of each record and other dimension data sets; Copy the user-defined query parameters into comparison period query parameters. If the comparison period query parameters contain time dimension filter conditions, first delete the original time dimension filter conditions, then add a new time dimension filter condition, with the condition value being the data set of the inferred comparison period time, and at the same time add other dimension filter conditions, with the condition value being other dimension data sets.
4. The flexible multi-dimensional multi-period data comparison and analysis method according to claim 1, characterized in that: The comparison steps of the cycle comparison module are as follows: The cycle comparison module obtains each comparison cycle data and associates it with the basic cycle data according to the time dimension and other dimensions to ensure that each record of the basic cycle data can be matched with the corresponding comparison cycle data; For each metric in each matching record, apply the ratio calculation expression for the comparison period to calculate the percentage increase or decrease of the metric.
5. A flexible multi-dimensional and multi-period data comparison and analysis device, characterized in that: The device includes: Parameter definition module, used for users to define query parameters in a fixed format; The parameter parsing and data query module is used to parse the query parameters and construct SQL query statements, and query the corresponding data set from the data source according to the constructed SQL query statements; The periodic data query module is used to traverse the comparison period set in the query parameter, calculate the corresponding comparison period time set based on the basic period time set, and use the query parameter as the comparison period query parameter, remove the time dimension filter condition, add the calculated comparison period time set as the new time dimension filter condition, and add other dimension data sets as filter conditions; The cycle comparison module is used to obtain the comparison cycle data and match it with the basic cycle data based on the time dimension and other dimension fields. The ratio of each indicator of each matching record is calculated according to the ratio calculation expression, and then the comparison cycle data and the calculated ratio are merged with the basic cycle data.
6. The flexible multi-dimensional multi-period data comparison and analysis device according to claim 5, characterized in that: The query parameters include data source information, query fields, data filtering conditions, sorting and comparison periods. The data filtering conditions include time dimension filtering conditions of the basic period and other dimension filtering conditions. The comparison period includes offset, period granularity and ratio calculation formula.
7. The flexible multi-dimensional multi-period data comparison and analysis device according to claim 5, characterized in that: The query parameter construction steps of the comparison period are as follows: The periodic data query module traverses the comparison period set in the query parameter, traverses each record of the basic periodic data based on each comparison period in the set, and obtains the basic periodic time and other dimension data in the record according to the time dimension and other dimensions in the query field; According to the defined offset and cycle granularity of the comparison cycle, the corresponding comparison cycle time is calculated based on the basic cycle time, thereby obtaining a data set of the comparison cycle time corresponding to the time dimension of each record and other dimension data sets; Copy the user-defined query parameters into comparison period query parameters. If the comparison period query parameters contain time dimension filter conditions, first delete the original time dimension filter conditions, then add a new time dimension filter condition, with the condition value being the data set of the inferred comparison period time, and at the same time add other dimension filter conditions, with the condition value being other dimension data sets.
8. The flexible multi-dimensional multi-period data comparison and analysis device according to claim 5, characterized in that: The comparison steps of the cycle comparison module are as follows: The cycle comparison module obtains each comparison cycle data and associates it with the basic cycle data according to the time dimension and other dimensions to ensure that each record of the basic cycle data can be matched with the corresponding comparison cycle data; For each metric in each matching record, apply the ratio calculation expression for the comparison period to calculate the percentage increase or decrease of the metric.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Year-to-year rate and month-to-month rate calculation method based on time dimension
CN104991964A
Expression-based data processing system
CN114490689A
Multi-dimensional data analysis method, device and equipment and readable storage medium
CN114547213A
Method and device for processing data
CN114817297A
Enhanced query performance using fixed length hashing of multidimensional data
US8027983B1
