Data analysis method and device, related equipment and computer program product
By converting the time field in data analysis requests into structured aggregated key values, the problem of multi-dimensional time semantic mismatch in existing technologies is solved, and the accuracy and reliability of multi-level and multi-granular data analysis are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FAN RUAN SOFTWARE CO LTD
- Filing Date
- 2026-01-28
- Publication Date
- 2026-05-08
AI Technical Summary
Existing data storage and computing systems cannot directly support multi-dimensional and complex time semantics, resulting in a mismatch between time representation and business analysis logic, making it difficult to perform accurate multi-level and multi-granular data analysis.
By extracting the aggregation granularity from data analysis requests, the time field of the raw data is transformed into a structured aggregation key value, which contains a combination of time units and time values, and aggregation operations and data analysis are performed according to the aggregation granularity.
It improves the accuracy and reliability of data analysis results, ensures the logical consistency and semantic integrity of multidimensional data analysis, and avoids analysis errors.
Smart Images

Figure CN121997010A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a data analysis method, apparatus, related equipment, and computer program product. Background Technology
[0002] In the field of data analytics, multi-level and multi-granular data analysis from a time perspective has become a core requirement. For example, business analysis frequently involves time concepts such as "year and month" (e.g., May 2024) and "week number in a year" (e.g., the 20th week of 2024). These time concepts are essentially composite values defined by multiple related and interconnected numerical values. However, current mainstream data storage and computing systems are generally built on data types represented by single numerical values (or text), such as integers, floating-point numbers, and strings, like "20251206" or "2025-12-16". However, this representation cannot directly carry the multi-dimensional and composite time semantics of "year and month" and "week number in a year," inevitably leading to a mismatch between the underlying data's time representation and the time logic required for business analysis. This makes accurate, coherent, and business-compliant time-dimensional analysis difficult. Summary of the Invention
[0003] In view of the above problems, this application is made to provide a data analysis method, apparatus, related equipment, and computer program product to improve the accuracy of multidimensional data analysis. The specific solution is as follows:
[0004] Firstly, this application provides a data analysis method, including:
[0005] Obtain a data analysis request for raw data, which includes multiple data points to be analyzed and a time field corresponding to each data point;
[0006] Extract the aggregation granularity of the data analysis from the data analysis request, wherein the aggregation granularity includes at least one time unit;
[0007] The time field corresponding to each piece of data to be analyzed in the original data is converted into an aggregation key value corresponding to the aggregation granularity. The aggregation key value contains at least one composite field, and each composite field is a combination of a time unit and the time value corresponding to the time unit.
[0008] Based on the aggregation key value corresponding to each of the data to be analyzed, an aggregation operation is performed on all the data to be analyzed in the original data according to the aggregation granularity to obtain the aggregation result corresponding to each aggregation key value;
[0009] Based on the data analysis request, data analysis is performed on the aggregation results corresponding to all the aggregation key values to obtain the data analysis results.
[0010] In one possible design, in another implementation of the first aspect of this application, the process of performing data analysis on the aggregation results corresponding to all the aggregation key values according to the data analysis request to obtain the data analysis results includes:
[0011] Based on the hierarchical relationship between the various time units contained in the aggregate key value, the priority of each time unit is determined, and the priority of the time unit is proportional to the corresponding unit hierarchy.
[0012] Based on the priority order of the time units in the aggregated key values, starting from the highest priority time unit, the time values corresponding to the same time unit in all the aggregated key values are compared level by level to obtain the time ordering result of the aggregated key values;
[0013] Based on the time-series sorting results, data analysis is performed on the aggregation results corresponding to all the aggregation key values to obtain data analysis results.
[0014] In one possible design, in another implementation of the first aspect of the embodiments of this application, the data analysis includes: concurrent data analysis;
[0015] The process of performing data analysis on the aggregation results corresponding to all the aggregation key values based on the time-series sorting results to obtain the data analysis results includes:
[0016] Extract the analysis step size of the concurrent data analysis from the data analysis request, wherein the time unit of the analysis step size is the same as at least one of the time units in the aggregate key values;
[0017] In each aggregation result, the time value of the same time unit corresponding to the analysis step size in the aggregation key value is shifted according to the analysis step size to obtain the concurrent aggregation result corresponding to each aggregation result;
[0018] Based on each aggregation result and the corresponding concurrent aggregation results, concurrent data analysis is performed to obtain the data analysis results.
[0019] In one possible design, in another implementation of the first aspect of this application, the process of converting the time field corresponding to each piece of data to be analyzed in the original data into an aggregate key value corresponding to the aggregation granularity includes:
[0020] A conversion function matching the type of the time field corresponding to the data to be analyzed and the aggregation granularity is invoked to map the original value of the time field corresponding to each piece of data to be analyzed to the structured aggregation key value.
[0021] In one possible design, another implementation of the first aspect of the embodiments of this application further includes:
[0022] The aggregated key value is stored in correspondence with the data to be analyzed.
[0023] Secondly, this application provides a data analysis apparatus, comprising:
[0024] The request acquisition unit is used to acquire a data analysis request for raw data, wherein the raw data includes multiple data to be analyzed and a time field corresponding to each data to be analyzed;
[0025] A granularity extraction unit is used to extract the aggregate granularity of data analysis from the data analysis request, wherein the aggregate granularity includes at least one time unit.
[0026] The field conversion unit is used to convert the time field corresponding to each piece of data to be analyzed in the original data into an aggregation key value corresponding to the aggregation granularity. The aggregation key value contains at least one composite field, and each composite field is a combination of a time unit and the time value corresponding to the time unit.
[0027] The data aggregation unit is used to perform an aggregation operation on all the data to be analyzed in the original data according to the aggregation granularity based on the aggregation key value corresponding to each of the data to be analyzed, so as to obtain the aggregation result corresponding to each aggregation key value;
[0028] The data analysis unit is used to perform data analysis on the aggregation results corresponding to all the aggregation key values according to the data analysis request, and obtain the data analysis results.
[0029] In one possible design, in another implementation of the first aspect of the embodiments of this application, the data analysis unit includes:
[0030] The priority marking subunit is used to determine the priority of each time unit according to the unit hierarchy relationship between the time units contained in the aggregate key value, wherein the priority of the time unit is proportional to the corresponding unit hierarchy.
[0031] The key value sorting subunit is used to compare the time values corresponding to the same time unit in all the aggregated key values level by level, starting from the highest priority time unit, according to the priority order of the time units in the aggregated key values from high to low, to obtain the time order sorting result of the aggregated key values;
[0032] The data analysis subunit is used to perform data analysis on the aggregation results corresponding to all the aggregation key values based on the time-series sorting results, and obtain data analysis results.
[0033] Thirdly, this application provides an electronic device, including: a memory and a processor;
[0034] The memory is used to store programs;
[0035] The processor is configured to execute the program to implement the data analysis method described in any of the first aspects of this application.
[0036] Fourthly, this application provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data analysis method described in any of the preceding first aspects of this application.
[0037] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the data analysis method described in any of the first aspects of this application.
[0038] By employing the aforementioned technical solution, this application first extracts the aggregation granularity from the data analysis request, clarifying the analytical scale of the data analysis and ensuring that subsequent operations revolve around a unified semantic framework, thus avoiding the introduction of logical biases. Furthermore, from a time dimension perspective, the time field corresponding to the data to be analyzed is converted into a structured aggregation key value. This aggregation key value not only contains the time value but also retains its corresponding time unit, enabling the aggregation key value to fully embody the complex temporal semantics and hierarchical relationships described by multi-dimensional numerical values. Based on this, aggregation key values with clear structure and semantics serve as the basis for logically grouping the data to be analyzed in the original data. During the aggregation operation, it is ensured that the data to be analyzed belonging to the same logical time range can be collected without omission or confusion. Finally, by performing data analysis operations on data that is semantically complete, logically consistent, and accurately grouped, the accuracy and reliability of the data analysis results are significantly improved. Attached Figure Description
[0039] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0040] Figure 1 A schematic diagram of an implementation system architecture for the interactive teaching method provided in this application embodiment;
[0041] Figure 2 A flowchart illustrating a data analysis method provided in an embodiment of this application;
[0042] Figure 3 This is a schematic diagram of the structure of a data analysis device provided in an embodiment of this application;
[0043] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0044] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0045] Understandably, in scenarios requiring time-series data analysis, the representation and processing of timestamps directly impact the feasibility and accuracy of the analysis. Firstly, when the smallest unit of timestamps in the database does not match the scale required for the analysis—for example, when timestamps are accurate to the day, but the analysis demands aggregation by month or week—daily-level data cannot be directly and accurately mapped to natural weeks or cross-month cycles. This can easily lead to boundary biases or information loss during aggregation, making key time-series insights such as weekly / monthly trend judgments and year-on-year / monthly comparisons unreliable, thus affecting the accuracy of the analysis results.
[0046] Secondly, different systems use inconsistent storage formats and parsing rules for timestamps, creating semantic barriers during cross-system or cross-platform collaborative analysis. This prevents other platforms from accurately recognizing the time meaning represented by the strings, leading to errors in data clustering, sorting, or time-series alignment. This semantic incompatibility not only hinders efficient data integration and sharing but also makes it difficult for cross-platform analytical models to establish a unified time benchmark. Ultimately, this causes data analysis to deviate from the real business context and fail to support accurate decision-making.
[0047] To address the aforementioned technical problems, this application provides a data analysis method. The data analysis method of this application embodiment will be described in detail below with reference to the accompanying drawings.
[0048] This application provides a data analysis method that can be applied to, for example... Figure 1 The system architecture shown includes a terminal 10 and a server 20. Server 20 may include one or more servers (…). Figure 1 (This example uses a server as an illustration).
[0049] Either terminal 10 or server 20 can be used independently to execute the data analysis methods provided in the embodiments of this application. For example, an enterprise server can perform time-series data analysis on its stored enterprise sales figures. Alternatively, terminal 10 and server 20 can also work together to execute the data analysis methods provided in the embodiments of this application. For example, a user terminal can report raw data generated this year in a target app to a platform (such as music, video, or social apps), and the platform server can perform time-series data analysis on the raw data to generate an annual report for the user terminal. It should be noted that before using the technical solutions disclosed in the embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner, in accordance with relevant laws and regulations, and their authorization should be obtained.
[0050] In this application embodiment, the terminal 100 can be a mobile phone, tablet computer, teaching large screen, wearable device, vehicle-mounted device, conference terminal, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc., and this application embodiment does not impose any restrictions on it.
[0051] The product form of server 200 in this application embodiment may include, but is not limited to, cloud server (running as a virtual server instance on a physical server), micro server (suitable for small office or home environments), storage server (focused on data storage and management), GPU server (equipped with a graphics processing unit, suitable for high-performance computing and graphics processing tasks), and modular server (allowing flexible configuration and expansion of hardware components according to needs), etc., and this application embodiment does not impose any restrictions on this.
[0052] This application provides a data analysis method, illustrated by applying the method to a computer device, which can specifically be... Figure 1 The system consists of terminal 10 or terminal 10 and server 20. (Refer to...) Figure 2 The present application provides a flowchart of a data analysis method, which may include steps S110 to S150, and these steps are described in detail below.
[0053] Step S110: Obtain a data analysis request for the raw data.
[0054] In this application embodiment, the data analysis request typically refers to a time-series data analysis request, that is, a request to process and analyze data arranged in chronological order to discover hidden trends, periodicities, and other characteristics in the original data, thereby providing a basis for decision-making, prediction, and anomaly detection. The original data is an initial data set that has not been processed or analyzed, containing multiple data points to be analyzed, as well as a time field corresponding to each data point, which indicates the time when the data record occurred.
[0055] In one possible implementation, the computer device can receive raw data uploaded by the user and a data analysis request filled in at the same time through a user interface, or it can receive request messages from other applications through an API interface, which contain requests for analysis of the raw data.
[0056] Step S120: Extract the aggregation granularity of data analysis from the data analysis request.
[0057] Extract key information from the acquired data analysis request; this is the aggregation granularity of the data analysis. The aggregation granularity consists of at least one time unit, such as a single time unit like "day," "week," "month," "quarter," or "year," or a combination of composite time units like "year-month" or "year-quarter." In essence, the aggregation granularity is the time dimension standard used to divide and aggregate the raw data, specifying which time unit the raw data will be combined and analyzed.
[0058] When the data analysis request is described in natural language, natural language processing (NLP) techniques can be used to parse the text of the request, identify the time units in the request, and establish them as the aggregation granularity. For example, for a data analysis request that reads "Please analyze the sales growth rate of sales data for the past two years by week," a large language model can be called to perform text analysis and identify "year" and "week" as the two time units for aggregation.
[0059] When data analysis requests are transmitted in a structured data format, aggregation granularity information can be extracted from the corresponding fields in the request. For example, a JSON request might contain a field like "aggregation Granularity":"month" indicating that the data analysis needs to be aggregated by month, thus determining the aggregation granularity to be "month".
[0060] Understandably, different data analysis scenarios may require aggregated data of different granularities. By extracting the aggregation granularity, it can be ensured that the subsequent data analysis results meet the actual needs of users, thereby satisfying diverse data analysis requests.
[0061] Step S130: Convert the time field corresponding to each piece of data to be analyzed in the original data into an aggregation key value corresponding to the aggregation granularity.
[0062] The time field corresponding to each piece of data to be analyzed in the original data is transformed according to the aggregation granularity extracted in step S120 to generate an aggregation key value corresponding to the aggregation granularity. The aggregation key value contains at least one composite field, and each composite field is a combination of a time unit and the time value corresponding to the time unit. For example, for the time field "20230103", if the aggregation granularity is "year", the time field can be converted into a composite field form such as "2023 year" as the aggregation key value; if the aggregation granularity is "year-week", then the aggregation key value is a composite field combination form of "2023 year 01 week".
[0063] In one possible implementation, the execution system checks the time field of each piece of data to be analyzed based on the composite field type definition (such as year / week, year / month, etc.) corresponding to the aggregation granularity and the preset format recognition rules. It marks the original field as the label of the corresponding composite field type and performs type conversion logic on the marked original field to convert it into a structured format of "numerical value + unit", thereby obtaining structured intermediate data marked with the correct composite semantic label, i.e., aggregated key value.
[0064] For example, based on the type of the time field stored in the original data, such as the date format "2023-12-10 (December 10, 2023)," and the aggregation granularity extracted in step S120 being "year-quarter," the execution system first identifies "2023-12-10" from the time field according to preset format recognition rules, confirming that it conforms to the date specification format "xxxx-xx-xx," and marks it as a "year-month-day" composite field type label. Further, the system executes type conversion logic: for the "year" part, it directly extracts the value "2023," with the unit being "year"; for the "quarter" determination, since December is in the 4th quarter, the quarter is converted to the value "4," with the unit being "quarter." Ultimately, the original time field "2023-12-10" is converted into a structured format of "numerical value + unit" such as {year=2023, quarter=4}, which is an aggregated key value. This achieves atomic and multidimensional representation of composite values. When the upper-level analysis module initiates a query, the system extracts and outputs data records with native composite semantics, ensuring that subsequent calculations can directly manipulate the structured multidimensional information and perform corresponding aggregation operations on the data to be analyzed.
[0065] In one possible implementation, the process of converting the time field corresponding to each piece of data to be analyzed in the original data into an aggregated key value corresponding to the aggregation granularity includes: calling a conversion function that matches the type of the time field corresponding to the data to be analyzed and the aggregation granularity, and mapping the original value of the time field corresponding to each piece of data to be analyzed into a structured aggregated key value.
[0066] In another possible implementation, the transformed aggregated key values can be stored in correspondence with the data to be analyzed. Optionally, the aggregated key values can be stored as complete correspondences with the data to be analyzed, or each composite field in the aggregated key value can be stored as two independent fields, making it convenient for users to directly query the aggregated results. When each composite field in the aggregated key value is stored as two independent fields, the composite fields are dynamically combined into an aggregated key value at the user query granularity during querying, thereby optimizing the query.
[0067] Based on this, the embodiments of this application convert the time field in the original data into a unified aggregate key-value format. Furthermore, the semantic information of the numerical value is explicitly marked in the aggregate key-value, which facilitates subsequent data aggregation operations and comparative analysis, and avoids analysis errors caused by inconsistent time field formats.
[0068] Step S140: Based on the aggregation key value corresponding to each data to be analyzed, perform aggregation operation on all the data to be analyzed in the original data according to the aggregation granularity to obtain the aggregation result corresponding to each aggregation key value.
[0069] Based on the aggregation key value corresponding to each piece of data to be analyzed generated in step S130, the data records to be analyzed with the same aggregation key value in the original data are grouped together, and then the corresponding aggregation operation is performed on each group of data to finally obtain the aggregation result corresponding to each aggregation key value.
[0070] Aggregation operations refer to statistical calculations performed on a set of data to obtain a summary result. Common aggregation operations include SUM, AVG, COUNT, MAX, and MIN. For example, aggregating sales data by "year-quarter" might sum the sales amount for each quarter of each year to obtain the total sales amount for each quarter. In another possible example, the aggregation result can also be a subset of data, that is, a collection of data to be analyzed that belongs to the same aggregation key value.
[0071] In one possible implementation, all aggregate key values and the corresponding aggregate results for each aggregate key value can be mapped into charts, dashboards, or other forms through a visualization component in the user interface. This ensures that the aggregate key values are displayed correctly in their logical order on the chart axis, thereby outputting visualized aggregate results for user analysis.
[0072] Understandably, aggregation transforms a large amount of raw data into fewer data entries, each representing a summary of the data at a specific aggregation level, making the results more concise and clear. The significantly reduced data volume after aggregation also reduces computational load during subsequent data analysis, thus improving efficiency.
[0073] Step S150: Based on the data analysis request, perform data analysis on the aggregation results corresponding to all aggregation key values to obtain the data analysis results.
[0074] Based on the initially acquired data analysis requests, such as trend analysis, percentage analysis, and comparative analysis, the aggregation results corresponding to all aggregation key values obtained in step S140 are analyzed to ultimately obtain data analysis results that meet user needs, thereby providing valuable decision-making information for users. For example, using data visualization libraries (such as Matplotlib and Seaborn in Python), the trend of total sales revenue for each year and quarter over time can be plotted into a chart, and the sales trend of the company's products can be analyzed based on the chart.
[0075] In summary, this application first extracts the aggregation granularity from the data analysis request, clarifying the analytical scale of the data analysis and ensuring that subsequent operations revolve around a unified semantic framework, avoiding the introduction of logical biases. Furthermore, from a time dimension perspective, the time fields corresponding to the data to be analyzed are converted into structured aggregation keys. These aggregation keys not only contain the time value but also retain its corresponding time unit, thus enabling them to fully embody the complex temporal semantics and hierarchical relationships described by multi-dimensional numerical values. Based on this, aggregation keys with clear structure and semantics serve as the basis for logically grouping the data to be analyzed in the original data. During aggregation operations, it is ensured that data belonging to the same logical time range are grouped together without omission or confusion. Finally, by performing data analysis operations on data that is semantically complete, logically consistent, and accurately grouped, the accuracy and reliability of the data analysis results are significantly improved.
[0076] Next, we will describe in detail other possible implementations of the data analysis method provided in the above application.
[0077] In one possible implementation, step S150, the process of performing data analysis on the aggregation results corresponding to all aggregation key values according to the data analysis request, and obtaining the data analysis results, includes: determining the priority of each time unit according to the unit hierarchy relationship between the various time units contained in the aggregation key values, wherein the priority of the time unit is proportional to the corresponding unit hierarchy; comparing the time values corresponding to the same time unit in all aggregation key values level by level according to the priority order of the time units in the aggregation key values, starting from the highest priority time unit, to obtain the time sequence sorting result of the aggregation key values; and performing data analysis on the aggregation results corresponding to all aggregation key values according to the time sequence sorting result to obtain the data analysis results.
[0078] When an aggregated key contains at least two time units, the priority of each time unit is determined based on their position within the time hierarchy, with higher-level time units having higher priority. Then, following this predetermined priority order, starting with the highest-priority time unit, the time values corresponding to the same time unit across all aggregated key values are compared.
[0079] For example, if all the aggregated key values of the data to be analyzed are {year=xxxx, quarter=xx}, in the "year-quarter" time hierarchy, "year" has a higher level than "quarter," so "year" has higher priority than "quarter." First, compare the time values of "year" in all aggregated key values, grouping those with the same "year" value together, and then sorting each group according to the "year" value. Further, compare the time values of "quarter" within each group to further refine the sorting, ultimately obtaining the time-series ranking result for all aggregated key values.
[0080] When the aggregate key value contains only one time unit, it is only necessary to compare the size of the time value corresponding to that time unit to obtain the time order result of all aggregate key values.
[0081] Based on the time-series sorting results of all aggregate key values, the aggregate results corresponding to the aggregate key values can also be sorted according to the time-series sorting results to obtain time-series aggregate results, thereby enabling data analysis of all aggregate results.
[0082] Data analysis can be further divided into contemporaneous data analysis and cyclical data analysis. Contemporaneous data analysis compares data from the current point in time with data from the same point in the previous timeframe or within the same period. For example, comparing sales data from Q4 2023 with sales data from Q4 2024 is contemporaneous data analysis. Cyclic data analysis, on the other hand, compares data from the current point in time with data from the preceding period. For example, calculating the sales growth rate from Q4 2023 to Q3 2023 is cyclical data analysis.
[0083] Therefore, if the data analysis request includes cyclic data analysis, the aggregation result corresponding to the previous aggregation key value adjacent to the aggregation key value of the currently processed aggregation result can be found based on the aggregation key value, and this aggregation result can be used as the current cyclic aggregation result to continue the cyclic data analysis.
[0084] If the data analysis request includes contemporaneous data analysis, the process of performing data analysis on the aggregation results corresponding to all aggregation key values based on the time-series sorting results to obtain the data analysis results includes: extracting the analysis step size of the contemporaneous data analysis from the data analysis request, wherein the time unit of the analysis step size is the same as at least one time unit in the aggregation key value; shifting the time values of the same time unit corresponding to the analysis step size in the aggregation key value corresponding to each aggregation result according to the analysis step size to obtain the contemporaneous aggregation result corresponding to each aggregation result; and performing contemporaneous data analysis based on each aggregation result and the corresponding contemporaneous aggregation result to obtain the data analysis results.
[0085] Based on the aggregated key value, the corresponding data points of the same period are found through four-dimensional shifts. Then, the two data points of the same period are compared and calculated to obtain the data analysis results of the data of the same period.
[0086] Understandably, different data analysis requests may have different definitions of "contemporary" timeframes. Therefore, to meet users' personalized needs, the first step is to parse the contemporary comparison step size for "contemporary data analysis" from the user's data analysis request. This step size may be "one year," "one month," or "one quarter." The time unit of this step size must match the time unit in the aggregation key value. For example, if the aggregation key value is "year-quarter," then the step size could be "1 year," "4 quarters," or "1 year 1 quarter," etc.
[0087] For each calculated aggregation result and its corresponding aggregation key value, a time value with the same step size is shifted forward by the same step size to obtain a new aggregation key value. For example, shifting "Q4 2023" forward by "2 quarters" yields "Q2 2023". The aggregation result of "Q2 2023" is then used as the contemporaneous aggregation result of "Q4 2023". The two aggregation results are compared and calculated to obtain the contemporaneous data analysis result for "Q4 2023".
[0088] Finally, based on the comparison and calculation results of each aggregation result with its contemporaneous aggregation results, a data analysis result is generated for all the data to be analyzed in the original data, which satisfies the data analysis request.
[0089] To facilitate understanding, the actual implementation process of the above data analysis method is illustrated below using an example. In this example, the data analysis method is deployed on the enterprise's server. The enterprise's data analysts can enter data analysis requests through text editing in the user interface of the enterprise server, such as "Analyze product sales data over the past two years based on 'year and week number', and calculate the year-on-year sales growth rate for each 'year and week number'."
[0090] In response to the data analysis request, the enterprise server first identifies the analysis object, namely "sales data for the past two years," such as sales data for 2024-2025, and retrieves the 2024-2025 sales data from the server's local storage or the cloud. Simultaneously, it extracts the aggregation granularity of the data analysis requested, namely "year / week." Each sales data entry in the 2024-2025 sales data includes a standard time field (Sale_Date) and a sales amount field (Amount).
[0091] Based on the aggregation granularity, the conversion logic for the time field is determined, and the aggregation key value Sale_Week is structured in a "number + unit" format at the underlying level. Then, Sale_Date is converted to the Sale_Week format. For example, the aggregation key value Sale_Week corresponding to "2024-01-01" is $\text{\{year=2023, week=01\}}$. This structure ensures the unit priority between "year" and "week".
[0092] Based on this, sales data belonging to the same aggregation key are aggregated to obtain the aggregation result for each aggregation key "Year / Week". Further, all Sale_Week fields are sorted in ascending order, first comparing higher priority time units (years, with 2025 preceding 2024), then comparing smaller units (weeks if years are the same). Finally, the logical order of 2025-52 preceding 2024-01 is accurately output.
[0093] Following the correct logical order, the system performs year-on-year and week-on-week sales comparison calculations and year-on-year and week-on-week sales growth rate calculations on the aggregation results of all aggregated key values. For example, when performing year-on-year and week-on-week sales comparison calculations, the system identifies the larger unit (year) of each aggregated key value, Sale_Week, and shifts it back one period while keeping the smaller unit (week) unchanged. It then finds the corresponding year-on-year aggregated result for each aggregated key value and performs a year-on-year data comparison calculation. Finally, it obtains the year-on-year and week-on-week sales comparison results for these two years and visualizes the results to the user through the enterprise server's user interface.
[0094] In summary, the data analysis method provided in this application firstly uses a composite field of "numerical value + unit" to semantically represent the time field, so that the multidimensional time information of each piece of data to be analyzed has an indivisible and clear semantics and hierarchical structure, eliminating the ambiguity and errors that may be caused by subsequent reliance on text parsing, and ensuring the accuracy of the source data for analysis.
[0095] Furthermore, this application standardizes the core computational logic, abstracting complex cross-dimensional comparisons and periodic operations into a unified time conversion, supporting alignment calculations based on large-unit finite sorting and custom compensation, significantly improving computational performance, and freeing the application layer from cumbersome and error-prone script logic, making the processing of non-standard periodic analysis simple and reliable, and achieving a double leap in the efficiency and flexibility of data analysis.
[0096] Ultimately, this application, by strictly defining type conversion rules and ensuring computational reliability, natively integrates the capabilities of composite fields into every analytical step, including data identification, filtering, pivoting, and formula calculation. Users can directly perform intuitive operations that conform to semantics without any format conversion or intermediate calculations, thereby greatly simplifying the complexity of multidimensional data analysis and making the acquisition of in-depth insights efficient and natural.
[0097] The data analysis apparatus provided in the embodiments of this application is described below. The text processing apparatus described below and the data analysis method described above can be referred to in correspondence.
[0098] See Figure 3 , Figure 3 This is a schematic diagram of a data analysis device disclosed in an embodiment of this application. The device may include:
[0099] The request acquisition unit 100 is used to acquire a data analysis request for raw data, wherein the raw data includes multiple data to be analyzed and a time field corresponding to each data to be analyzed;
[0100] Granularity extraction unit 200 is used to extract the aggregation granularity of data analysis from the data analysis request, the aggregation granularity containing at least one time unit;
[0101] The field conversion unit 300 is used to convert the time field corresponding to each piece of data to be analyzed in the original data into an aggregation key value corresponding to the aggregation granularity. The aggregation key value contains at least one composite field, and each composite field is a combination of a time unit and the time value corresponding to the time unit.
[0102] The data aggregation unit 400 is used to perform an aggregation operation on all the data to be analyzed in the original data according to the aggregation granularity based on the aggregation key value corresponding to each of the data to be analyzed, so as to obtain the aggregation result corresponding to each aggregation key value;
[0103] The data analysis unit 500 is used to perform data analysis on the aggregation results corresponding to all the aggregation key values according to the data analysis request, and obtain the data analysis results.
[0104] In one possible implementation, the data analysis unit 500 includes:
[0105] The priority marking subunit is used to determine the priority of each time unit according to the unit hierarchy relationship between the time units contained in the aggregate key value, wherein the priority of the time unit is proportional to the corresponding unit hierarchy.
[0106] The key value sorting subunit is used to compare the time values corresponding to the same time unit in all the aggregated key values level by level, starting from the highest priority time unit, according to the priority order of the time units in the aggregated key values from high to low, to obtain the time order sorting result of the aggregated key values;
[0107] The data analysis subunit is used to perform data analysis on the aggregation results corresponding to all the aggregation key values based on the time-series sorting results, and obtain data analysis results.
[0108] In one possible implementation, the data analysis includes: concurrent data analysis; and a data analysis subunit, including:
[0109] A step size extraction subunit is used to extract the analysis step size of the concurrent data analysis from the data analysis request, wherein the time unit of the analysis step size is the same as at least one of the time units in the aggregate key values.
[0110] The time shift subunit is used to shift the time value of the same time unit corresponding to the analysis step size in the aggregation key value corresponding to each aggregation result according to the analysis step size, so as to obtain the same-time aggregation result corresponding to each aggregation result;
[0111] The concurrent data analysis subunit is used to perform concurrent data analysis based on each aggregation result and the corresponding concurrent aggregation result to obtain data analysis results.
[0112] In one possible implementation, the field conversion unit 300 includes:
[0113] The function call subunit is used to call a conversion function that matches the type of the time field corresponding to the data to be analyzed and the aggregation granularity, and to map the original value of the time field corresponding to each piece of data to be analyzed to the structured aggregation key value.
[0114] In one possible implementation, the apparatus further includes a storage unit for storing the aggregated key value in correspondence with the data to be analyzed.
[0115] In summary, this application first extracts the aggregation granularity from the data analysis request, clarifying the analytical scale of the data analysis and ensuring that subsequent operations revolve around a unified semantic framework, avoiding the introduction of logical biases. Furthermore, from a time dimension perspective, the time fields corresponding to the data to be analyzed are converted into structured aggregation keys. These aggregation keys not only contain the time value but also retain its corresponding time unit, thus enabling them to fully embody the complex temporal semantics and hierarchical relationships described by multi-dimensional numerical values. Based on this, aggregation keys with clear structure and semantics serve as the basis for logically grouping the data to be analyzed in the original data. During aggregation operations, it is ensured that data belonging to the same logical time range are grouped together without omission or confusion. Finally, by performing data analysis operations on data that is semantically complete, logically consistent, and accurately grouped, the accuracy and reliability of the data analysis results are significantly improved.
[0116] This application also provides an electronic device in its embodiments. (See reference...) Figure 4 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, tablets, large-screen teaching displays, wearable devices, etc. Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0117] like Figure 4 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 1, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 2 or a program loaded from a storage device 8 into a random access memory (RAM) 3, to implement the data analysis method of the foregoing embodiments of this application. When the electronic device is powered on, the RAM 3 also stores various programs and data required for the operation of the electronic device. The processing unit 1, ROM 2, and RAM 3 are interconnected via a bus 4. An input / output (I / O) interface 5 is also connected to the bus 4.
[0118] Typically, the following devices can be connected to I / O interface 5: input devices 6 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 7 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 8 including, for example, memory cards, hard drives, etc.; and communication devices 9. Communication device 9 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0119] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the data analysis methods provided in this application.
[0120] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the data analysis methods provided in this application.
[0121] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0122] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0123] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0124] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
[0125] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.
Claims
1. A data analysis method, characterized in that, include: Obtain a data analysis request for raw data, which includes multiple data points to be analyzed and a time field corresponding to each data point; Extract the aggregation granularity of the data analysis from the data analysis request, wherein the aggregation granularity includes at least one time unit; The time field corresponding to each piece of data to be analyzed in the original data is converted into an aggregation key value corresponding to the aggregation granularity. The aggregation key value contains at least one composite field, and each composite field is a combination of a time unit and the time value corresponding to the time unit. Based on the aggregation key value corresponding to each of the data to be analyzed, an aggregation operation is performed on all the data to be analyzed in the original data according to the aggregation granularity to obtain the aggregation result corresponding to each aggregation key value; Based on the data analysis request, data analysis is performed on the aggregation results corresponding to all the aggregation key values to obtain the data analysis results.
2. The data analysis method according to claim 1, characterized in that, The process of performing data analysis on the aggregation results corresponding to all the aggregation key values according to the data analysis request, and obtaining the data analysis results, includes: Based on the hierarchical relationship between the various time units contained in the aggregate key value, the priority of each time unit is determined, and the priority of the time unit is proportional to the corresponding unit hierarchy. Based on the priority order of the time units in the aggregated key values, starting from the highest priority time unit, the time values corresponding to the same time unit in all the aggregated key values are compared level by level to obtain the time ordering result of the aggregated key values; Based on the time-series sorting results, data analysis is performed on the aggregation results corresponding to all the aggregation key values to obtain data analysis results.
3. The data analysis method according to claim 2, characterized in that, The data analysis includes: contemporaneous data analysis; The process of performing data analysis on the aggregation results corresponding to all the aggregation key values based on the time-series sorting results to obtain the data analysis results includes: Extract the analysis step size of the concurrent data analysis from the data analysis request, wherein the time unit of the analysis step size is the same as at least one of the time units in the aggregate key values; In each aggregation result, the time value of the same time unit corresponding to the analysis step size in the aggregation key value is shifted according to the analysis step size to obtain the concurrent aggregation result corresponding to each aggregation result; Based on each aggregation result and the corresponding concurrent aggregation results, concurrent data analysis is performed to obtain the data analysis results.
4. The data analysis method according to any one of claims 1-3, characterized in that, The process of converting the time field corresponding to each piece of data to be analyzed in the original data into an aggregation key value corresponding to the aggregation granularity includes: A conversion function matching the type of the time field corresponding to the data to be analyzed and the aggregation granularity is invoked to map the original value of the time field corresponding to each piece of data to be analyzed to the structured aggregation key value.
5. The data analysis method according to any one of claims 1-3, characterized in that, Also includes: The aggregated key value is stored in correspondence with the data to be analyzed.
6. A data analysis device, characterized in that, include: The request acquisition unit is used to acquire a data analysis request for raw data, wherein the raw data includes multiple data to be analyzed and a time field corresponding to each data to be analyzed; A granularity extraction unit is used to extract the aggregate granularity of data analysis from the data analysis request, wherein the aggregate granularity includes at least one time unit. The field conversion unit is used to convert the time field corresponding to each piece of data to be analyzed in the original data into an aggregation key value corresponding to the aggregation granularity. The aggregation key value contains at least one composite field, and each composite field is a combination of a time unit and the time value corresponding to the time unit. The data aggregation unit is used to perform an aggregation operation on all the data to be analyzed in the original data according to the aggregation granularity based on the aggregation key value corresponding to each of the data to be analyzed, so as to obtain the aggregation result corresponding to each aggregation key value; The data analysis unit is used to perform data analysis on the aggregation results corresponding to all the aggregation key values according to the data analysis request, and obtain the data analysis results.
7. The data analysis device according to claim 6, characterized in that, The data analysis unit includes: The priority marking subunit is used to determine the priority of each time unit according to the unit hierarchy relationship between the time units contained in the aggregate key value, wherein the priority of the time unit is proportional to the corresponding unit hierarchy. The key value sorting subunit is used to compare the time values corresponding to the same time unit in all the aggregated key values level by level, starting from the highest priority time unit, according to the priority order of the time units in the aggregated key values from high to low, to obtain the time order sorting result of the aggregated key values; The data analysis subunit is used to perform data analysis on the aggregation results corresponding to all the aggregation key values based on the time-series sorting results, and obtain data analysis results.
8. An electronic device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the data analysis method as described in any one of claims 1 to 7.
9. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements each step of the data analysis method as described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the various steps of the data analysis method as described in any one of claims 1 to 7.