Business index calculation method and device, medium and product
By disassembling business indicators into semantic units and generating a computing logic tree, combining data acquisition and computing logic, the problem of low flexibility in computing indicators in the existing technology is solved, and business indicator calculations are realized for flexible configuration and efficient query.
Patent Information
- Application Number
- CN202510572254.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-26
AI Technical Summary
The existing technology is difficult to flexibly allocate calculation indicators based on different business needs, resulting in low flexibility in calculation of business indicators and difficult for the indicator system to respond agilely to market changes and business needs.
By breaking down business indicators into independent semantic units, generating a computing logic tree, using pre-configured data acquisition models, computing logic and aggregation logic to calculate target indicators, and configuring a computing indicator query interface to support queries of different time granularity, classification dimensions, and computing indicator types.
It realizes the rapid configuration of calculation indicators according to business needs, improves the flexibility and query efficiency of indicator calculation, and supports multi-dimensional indicator query and visual presentation.
Smart Images

Figure CN120540647A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of business data processing technology, and in particular to a business indicator calculation method, device, medium and product. Background Art
[0002] Amidst the booming digital business landscape, business metric calculation, a core component of enterprise data-driven decision-making, faces numerous technical challenges. Currently, business metric calculations largely rely on pre-set, fixed formulas and rule systems. This design exhibits significant flexibility and scalability shortcomings in practical applications. When business scenarios change or new business requirements are introduced, fixed calculation logic is difficult to quickly adapt, often requiring significant development resources for code modifications and system refactoring. Furthermore, the definition of business metrics is deeply coupled with the underlying business logic, making adjustments to the metric system challenging. With the rapid evolution of the market environment and the continuous innovation and iteration of business models, enterprises are increasingly demanding adjustments to the statistical scope and calculation logic of their business metrics. However, due to the strong correlation between the two, any slight change in business logic can trigger a chain reaction in metric calculations, making it difficult for the metric system to agilely respond to business development needs. Summary of the Invention
[0003] The embodiments of the present invention provide a business indicator calculation method, device, medium and product, which aim to solve the problem that the existing technology is difficult to configure calculation indicators according to different business needs, resulting in low flexibility in business indicator calculation.
[0004] In order to achieve the above objectives, in a first aspect, the present invention provides a method for calculating a business indicator, comprising the following steps:
[0005] Define the required calculation indicators based on business needs;
[0006] Decomposing the calculation indicator content into several independent semantic units;
[0007] Obtaining the semantic unit type mapped to each semantic unit by matching a pre-established semantic unit mapping table, wherein the semantic unit type includes: time granularity type, classification dimension type, value object type, and target calculation indicator type;
[0008] Taking each semantic unit as a node, generating a computational logic tree according to the relationship between predetermined semantic unit types;
[0009] According to the decomposition order of the computation logic tree and the semantic unit type of each node, the result of the target computation indicator is calculated using the pre-configured data acquisition model, computation logic and / or aggregation logic, wherein:
[0010] The data acquisition model is used to obtain a business data table from a predetermined plurality of data sources, extract relevant data fields of the target calculation index from the business data table, and the relevant data fields are pre-mapped with the corresponding calculation index;
[0011] The calculation logic is used to calculate the target calculation indicator using the relevant data fields through a pre-configured calculation formula, calculation rules and / or calculation sequence;
[0012] The aggregation logic is used to input the calculated target calculation indicator results into the calculation logic tree through a preset aggregation method, and gradually perform aggregation evaluation according to the semantic unit type from the opposite direction of the calculation logic tree node decomposition order.
[0013] Furthermore, the root node of the calculation logic tree is a semantic unit of the target calculation indicator type, and the child nodes are, in order of decomposition, semantic units of the value object type, semantic units of the classification dimension type, and semantic units of the time granularity type.
[0014] Furthermore, the aggregation method includes summing, averaging, taking the maximum value and / or taking the minimum value.
[0015] Furthermore, it also includes configuring a calculation indicator query interface, and the indicator query interface includes: a time granularity query unit, a classification dimension query unit and / or a calculation indicator type query unit, wherein the time granularity query unit provides the function of querying calculation indicators by time range, the classification dimension query unit provides the function of querying calculation indicators according to different classification dimensions, and the calculation indicator type query unit provides the function of querying calculation indicators according to different calculation indicator types.
[0016] Furthermore, the different classification dimensions include: region, product category and / or customer type; the different calculation indicator types include: sales, profit margin and / or sales volume.
[0017] Furthermore, it also includes: visually presenting the query results in charts and providing a file export function; the charts include: bar charts, line charts and / or pie charts.
[0018] In a second aspect, the present invention provides a business indicator calculation device, comprising a memory and a processor, wherein the memory stores at least one program, and the at least one program is executed by the processor to implement the business indicator calculation method described above.
[0019] In a third aspect, the present invention provides a computer-readable storage medium, wherein at least one program is stored in the storage medium, and the at least one program is executed by a processor to implement the business indicator calculation method as described above.
[0020] In a fourth aspect, the present invention provides a computer program product, comprising a computer program, characterized in that when the computer program is executed by a processor, the steps of the business indicator calculation method described above are implemented.
[0021] The above technical solution has the following technical effects:
[0022] The present invention defines the required calculation indicator content according to business requirements; decomposes the calculation indicator content into several independent semantic units; obtains the semantic unit type mapped by each semantic unit by matching a pre-established semantic unit mapping table; uses the semantic units as nodes, determines the decomposition sequence structure according to the semantic unit type, and generates a calculation logic tree; and uses the pre-configured data acquisition model, calculation logic, and / or aggregation logic to calculate the target calculation indicator based on the structure and semantics of the calculation logic tree. By parsing the semantic content of the calculation indicators defined by business requirements, the present invention solves the problem that the existing technology makes it difficult to configure calculation indicators according to different business requirements, resulting in low flexibility in business indicator calculation.
[0023] In a further embodiment, the present invention is also configured with a calculation indicator query interface, which can query the calculation indicators according to different time granularities, classification dimensions and / or calculation indicator types, thereby improving the query efficiency and flexibility of the calculation indicators while realizing the configuration of calculation indicators according to different business needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A flowchart of a method for calculating a business indicator according to an embodiment of the present invention is shown;
[0025] Figure 2 FIG. 4 is a schematic diagram of the structure of a business indicator calculation device in one embodiment of the present invention. DETAILED DESCRIPTION
[0026] To further illustrate various embodiments, the present invention is provided with accompanying drawings. These drawings form part of the present disclosure and are primarily used to illustrate the embodiments and, in conjunction with the relevant description in the specification, to explain the operating principles of the embodiments. By referring to these drawings, one of ordinary skill in the art will understand other possible embodiments and the advantages of the present invention. The components in the figures are not drawn to scale, and similar reference numerals are generally used to represent similar components.
[0027] The present invention will now be further described with reference to the accompanying drawings and specific embodiments.
[0028] Example 1:
[0029] Figure 1 1 is a flow chart of a method for calculating a business indicator according to an embodiment of the present invention. The method according to this embodiment includes the following steps:
[0030] Define the required calculation indicators based on business needs;
[0031] The calculation indicator content is decomposed into several independent semantic units. In a specific implementation, after the user inputs the defined calculation indicator content, the text parsing algorithm is used to semantically decompose the calculation indicator content. For example, if the calculation indicator content is "the total output of unit B in year A", it is decomposed into "year A", "unit B", and "total output".
[0032] The semantic unit type mapped by each semantic unit is obtained by matching the pre-established semantic unit mapping table, including: time granularity type, classification dimension type, value object type and target calculation indicator type; for example, for the calculation indicator content of "the total output of product C of unit B in year A", "year A" represents the semantic unit of the time granularity type, "unit B" represents the semantic unit of the classification dimension type, "product C" represents the semantic unit of the value object type, and "total output" represents the semantic unit of the target calculation indicator type; wherein, the semantic unit mapping table pre-stores the mapping relationship between semantic units and semantic unit types. Furthermore, in determining the fluency of semantic unit types, it also includes: determining the relationship between these semantic units; for example, the time range limits the statistical period of the data, the dimension determines the grouping method of the data, the value field clarifies the data source based on which the calculation is based, and the aggregation logic determines the calculation method of the final indicator, etc.;
[0033] Taking semantic units as nodes, generating a computational logic tree based on the relationship between predetermined semantic unit types;
[0034] In a specific implementation, a tree structure generation algorithm is developed by constructing a semantic relationship graph, with each semantic unit as a node and the relationships between them, such as the time range that limits the data statistical period and the dimension that determines the data grouping method, as edges; the semantic unit of the final indicator, that is, the target calculation indicator type (such as "total output") is used as the root node, and the other semantic units are all the next-level child nodes of the root node. According to the hierarchical relationship and dependency relationship between the semantic units, the semantic units such as time granularity, classification dimension, and value object are used as child nodes to construct an indicator calculation logic tree.
[0035] In a specific implementation, the decomposition order of each child node is pre-determined according to the semantic unit type. For example, the decomposition order is the semantic unit of the value object type, the semantic unit of the classification dimension type, and the semantic unit of the time granularity type. For example, the final indicator "total sales" has the following next-level child nodes: "time range such as the past year", "dimensions such as cities", and "value objects such as the sales amount field of product A". This tree structure clearly displays the logical process of indicator calculation and the hierarchical relationship of each semantic unit.
[0036] Based on the decomposition order and semantic unit type of the calculation logic tree, the results of the target calculation indicators are calculated using the pre-configured data acquisition model, calculation logic and / or aggregation logic, where:
[0037] The data acquisition model is used to obtain business data tables from predetermined multiple data sources and extract relevant data fields of target calculation indicators from the business data tables. In a specific implementation, the relevant data fields are pre-mapped with corresponding calculation indicators.
[0038] In a specific implementation, a data source connection configuration entry is provided in the system interface or configuration file, and the user enters the connection address, user name, password and other information of the relational database. The system performs a connection test through the ODBC driver to ensure the validity of the connection. For the big data storage platform, the corresponding connection parameters are also configured. For the connected data source, the system automatically obtains the data table structure information and displays it to the user. The user edits the numeric field, specifies the data field as the field for a specific calculation indicator, and completes the field mapping operation. For example, when configuring the e-commerce sales data model, the "mat_wt" field of the steel coil material file table in the Oracle database is mapped to the "total_mat_wt" field used to calculate the production indicator within the system. For another example: when obtaining sales data from an e-commerce database, the "order amount" field of the "order table" in the database is mapped to the field required to calculate the "total sales" indicator.
[0039] The calculation logic is used to calculate the target calculation indicator using relevant data fields using pre-configured calculation formulas, calculation rules, and / or calculation sequences. In one specific implementation, a visual calculation logic editing interface is provided to the user, allowing the user to construct the calculation formula through operations such as dragging and selecting. For example, when calculating the yield rate indicator, the user can select the output and parent material input fields from the field list in the pre-configured calculation logic, and select the " / " and "×" operators in the operator list to construct the calculation formula "yield rate = (output / total output) × 100%."
[0040] Calculation rule options are set in the configuration interface. For example, for missing data values, users can choose to "fill with default value," "skip the data row," or "estimate missing values using a specific algorithm." For complex calculations involving multiple steps, users can set the order of the steps to determine the calculation sequence.
[0041] The aggregation logic is used to input the calculated target calculation indicator results into the calculation logic tree through a preset aggregation method, and gradually perform aggregation evaluation according to the semantic unit type from the opposite direction of the calculation logic tree node decomposition order.
[0042] In one specific implementation, in the aggregation logic configuration interface, the user selects an aggregation method from a drop-down menu, such as sum, average, maximum, minimum, etc. The user can specify aggregation dimensions, such as region, product category, time granularity, etc., by checking or entering. In one specific implementation, the aggregation logic uses the semantic unit type of the calculation logic tree node as the aggregation dimension and aggregates the calculation indicators in the opposite direction of the tree node decomposition order. For example, in the opposite direction of the decomposition order, first aggregate according to the time granularity, then aggregate according to the classification dimension, and finally aggregate the corresponding value objects to obtain the calculation indicator content defined by the business requirements.
[0043] In a specific implementation, the result of the target calculation indicator is calculated by an indicator calculation engine, and the indicator calculation engine includes:
[0044] (1) Code generation unit
[0045] Based on the generated computational logic tree, it is converted into executable code. Based on different data sources and computational requirements, adaptive code languages are generated, such as SQL-based querying and computing data from relational databases. For example, if a requirement exists to calculate regional product sales from a MySQL database, the corresponding SQL query and computation code is generated.
[0046] (2) Data source connection unit
[0047] This unit is responsible for connecting to various data sources. It supports a variety of data source connection methods, such as JDBC (Java Database Connectivity) to relational databases, Hive JDBC to Hive data warehouses, and RESTful APIs to some cloud service data sources. This unit ensures that the system can accurately obtain the required data from various data sources, providing data input for indicator calculations.
[0048] (3) Code execution unit
[0049] Responsible for executing the code generated by the code generation unit and efficiently calculating indicator values. During execution, operations are performed based on the data obtained by the data source connection unit according to the calculation logic and rules defined by the code. For example, a code execution environment is established and the generated SQL code is sent to the corresponding database management system for execution. For example, executing SQL code can query product sales data from the database and calculate indicators such as sales volume and profit margin based on calculation formulas. In another example, the generated SQL statement can be sent to an Oracle database using Java's ODBC API for execution, obtaining a query result set.
[0050] In a specific implementation, a calculation index query interface is further configured, including a time granularity query unit, a classification dimension query unit and / or a calculation index type query unit, wherein:
[0051] The time granularity query unit provides the function of querying calculation indicators by time range, the classification dimension query unit provides the function of querying calculation indicators according to different classification dimensions, and the calculation indicator type query unit provides the function of querying calculation indicators according to different calculation indicator types.
[0052] In one implementation, a time range selection control, such as a date picker, is provided in the query interface. After the user selects the start and end dates, the system converts them into time range conditions in the SQL query statement. For example, to query the total production of each unit over the past month, an SQL statement similar to "SELECT unit_code, SUM(mat_wt) FROM table WHERE prod_time BETWEEN 'start_date' AND 'end_date' GROUP BY unit_code" is generated and sent to the indicator library for execution. The query results are returned to the user interface, presenting the indicator data within the time range in a table format.
[0053] The time-granularity query unit allows users to flexibly specify time intervals, such as querying indicator values for the past week, this month, or this quarter. The system quickly retrieves and returns matching indicator data from the indicator database based on the user's entered time range. For example, if a user queries the sales figures for each product over the past month, the system will filter the sales data for the corresponding time range from the indicator database and present it to the user.
[0054] In a specific implementation, the classification dimensions include region, product category and / or customer type; and the calculation indicator types include sales, profit margin and / or sales volume.
[0055] In one implementation, a dimension selection drop-down menu is provided on the query interface. After the user selects a query dimension (such as "unit" or "brand"), the system generates a corresponding query statement based on the selection. For example, if the user queries the comprehensive yield rate of each unit, the system generates an SQL statement similar to "SELECT unit_code, (sum(mat_wt) / sum(mc_mat_wt)) * 100) AS prod_rate FROM table GROUP BY unit_code", performs grouping calculations by region in the indicator library, and returns the results. The query results are presented to the user in the form of a table or chart. The above chart, such as a bar chart, has different bars representing the comprehensive yield rate of different units.
[0056] Using the categorized dimension query unit, users can select different dimensions for querying, such as region, product category, and customer type. The system groups and filters the data in the indicator library based on the selected dimension and returns the statistical results for the corresponding dimension. For example, if a user queries product sales profit margins by region, the system will group and calculate the sales data in the indicator library based on the regional dimension and return the profit margin data for each region.
[0057] In one implementation, a list of indicator type selections is provided on the query interface. After the user selects a specific indicator type (such as "yield rate" or "profit rate"), the system queries the corresponding data in the indicator library. For example, if a user queries the profit rate indicators of all products, the system generates an SQL statement similar to "SELECT mat_no, (mat_wt / mc_mat_wt)*100AS prod_rate FROMtable", extracts data related to the yield rate from the indicator library and returns it. The query results are presented to the user in a suitable format, such as a table or a line chart showing the changes in profit rate over time. By calculating the indicator type query unit, the user can specify to query specific types of indicators such as sales, profit rate, and sales volume. The system locates the data of the corresponding indicator type in the indicator library and presents it to the user. For example, if a user queries the profit rate indicators of all products, the system extracts all data related to the profit rate from the indicator library and displays it.
[0058] In one specific implementation, query results are visualized as charts, including bar charts, line charts, and / or pie charts, and a file export function is provided. For example, users can export query results to common file formats such as Excel and CSV for further analysis and processing. For example, a user can visualize the sales data for each quarter in the form of a bar chart and export it to an Excel file for use in creating a report.
[0059] In one specific implementation, a data visualization library is integrated to generate visualization charts based on the query result data type and user needs. For example, for time-series sales data, a line chart is generated to display sales trends; for regional sales comparison data, a bar chart is generated. An export button is provided. When the user clicks it, the system converts the query result data into an Excel or CSV format file and sends it to the user via HTTP response for download, facilitating further analysis and processing of the data.
[0060] In one specific implementation, the system's hardware environment is configured with servers with sufficient computing resources and storage capacity. Hardware parameters such as CPU, memory, and disk are appropriately selected based on the data volume and computational complexity. For example, for processing large-scale e-commerce data, a multi-core, high-speed CPU, large-capacity memory, and high-speed solid-state drives can be selected. The system software environment installs an operating system such as Linux, deploys various database management systems such as MySQL and MongoDB, installs appropriate drivers such as JDBC drivers based on data source connection requirements, establishes the operating environment required for the big data processing framework, and ensures that the development environment for programming languages such as Python and Java is fully configured.
[0061] Example 2:
[0062] Figure 2 FIG. 1 is a schematic diagram of a business indicator calculation device according to an embodiment of the present invention. Figure 2 As shown, the device includes a processor 201, a memory 202, a bus 203, and a computer program stored in the memory 202 and executable on the processor 201. The processor 201 includes one or more processing cores. The memory 202 is connected to the processor 201 via the bus 203. The memory 202 is used to store program instructions. When the processor executes the computer program, the steps in the above-mentioned method embodiment of the first embodiment of the present invention are implemented.
[0063] Furthermore, as an executable solution, the online car-hailing passenger parking space allocation device can be a computer unit, which can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The computer unit may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that the composition structure of the above-mentioned computer unit is only an example of a computer unit and does not constitute a limitation of the computer unit. It can include more or fewer components than the above-mentioned, or a combination of certain components, or different components. For example, the computer unit may also include input and output devices, network access devices, buses, etc., which are not limited in the embodiments of the present invention.
[0064] Furthermore, as an executable solution, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the computer unit and connects various parts of the entire computer unit using various interfaces and lines.
[0065] The memory can be used to store the computer programs and / or modules, and the processor implements the various functions of the computer unit by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function; the data storage area can store data created based on the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0066] Example 3:
[0067] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method in the embodiment of the present invention are implemented.
[0068] If the module / unit integrated in the computer unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM) and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
[0069] Example 4:
[0070] The present invention also provides a computer program product, comprising a computer program, which implements the steps of the business indicator calculation method described above when executed by a processor.
[0071] Although the present invention has been particularly shown and described in conjunction with preferred embodiments, it will be understood by those skilled in the art that various changes in form and details may be made to the present invention without departing from the spirit and scope of the invention as defined in the appended claims, and all such changes are within the scope of protection of the present invention.
Claims
1. A method for calculating business indicators, characterized in that: The following steps are involved: Define the required calculation indicators based on business needs; Decomposing the calculation indicator content into several independent semantic units; Obtaining the semantic unit type mapped to each semantic unit by matching a pre-established semantic unit mapping table, wherein the semantic unit type includes: time granularity type, classification dimension type, value object type, and target calculation indicator type; Taking each semantic unit as a node, generating a computational logic tree according to the relationship between predetermined semantic unit types; According to the decomposition order of the computation logic tree and the semantic unit type of each node, the result of the target computation indicator is calculated using the pre-configured data acquisition model, computation logic and / or aggregation logic, wherein: The data acquisition model is used to obtain a business data table from a predetermined plurality of data sources, extract relevant data fields of the target calculation index from the business data table, and the relevant data fields are pre-mapped with the corresponding calculation index; The calculation logic is used to calculate the target calculation indicator using the relevant data fields through a pre-configured calculation formula, calculation rules and / or calculation sequence; The aggregation logic is used to input the calculated target calculation indicator results into the calculation logic tree through a preset aggregation method, and gradually perform aggregation evaluation according to the semantic unit type from the opposite direction of the calculation logic tree node decomposition order.
2. The business indicator calculation method according to claim 1, characterized in that: The root node of the calculation logic tree is a semantic unit of the target calculation indicator type, and the child nodes are, in order of decomposition, semantic units of the value object type, semantic units of the classification dimension type, and semantic units of the time granularity type.
3. The business indicator calculation method according to claim 1, characterized in that: The aggregation method includes summing, averaging, taking the maximum value and / or taking the minimum value.
4. The business indicator calculation method according to claim 1, characterized in that: It also includes configuring a calculation indicator query interface, and the indicator query interface includes: a time granularity query unit, a classification dimension query unit and / or a calculation indicator type query unit, wherein the time granularity query unit provides a function of querying calculation indicators by time range, the classification dimension query unit provides a function of querying calculation indicators according to different classification dimensions, and the calculation indicator type query unit provides a function of querying calculation indicators according to different calculation indicator types.
5. The business indicator calculation method according to claim 4, characterized in that: The different classification dimensions include: region, product category and / or customer type; the different calculation indicator types include: sales, profit margin and / or sales volume.
6. The business indicator calculation method according to claim 4, characterized in that: Also includes: Visualize query results in charts and provide file export function; The charts include: bar charts, line charts and / or pie charts.
7. A business indicator calculation device, characterized in that: It includes a memory and a processor, the memory stores at least one program, and the at least one program is executed by the processor to implement the business indicator calculation method according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that The storage medium stores at least one program, and the at least one program is executed by a processor to implement the business indicator calculation method according to any one of claims 1 to 6.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the business indicator calculation method according to any one of claims 1 to 6 are implemented.