Index calculation method and device, electronic equipment and storage medium

By storing the indicator calculation rules and dimension data in a second database, and using data picking, association, and classification rules to process the data to be calculated, the problem of insufficient calculation data in the data stream when the monitored indicators are updated is solved, thus achieving the completeness of indicator calculation.

CN117909421BActive Publication Date: 2026-06-26CHONGQING CHANGAN AUTOMOBILE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING CHANGAN AUTOMOBILE CO LTD
Filing Date
2024-01-02
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

If the monitored metric is updated, updating only the data calculation rules may result in the data in the data stream not meeting the metric calculation requirements, thus preventing the metric calculation from being completed.

Method used

The new indicator calculation rules and the dimensional data required for indicator calculation are stored in the second database. The data to be calculated is selected, supplemented, summarized and classified through data selection rules, data association rules, data classification rules and data calculation rules, so as to determine the indicator calculation rules of the target data after summary and classification.

Benefits of technology

When updating indicators, ensure that the data to be calculated meets the requirements for indicator calculation, and then complete the indicator calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117909421B_ABST
    Figure CN117909421B_ABST
Patent Text Reader

Abstract

The application relates to an index calculation method and device, electronic equipment and a storage medium, and relates to the field of big data real-time processing. The method comprises the following steps: obtaining to-be-calculated data from a first database; obtaining a target index calculation rule of the to-be-calculated data from a second database; the target calculation rule comprises a data selection rule, a data association rule, a data classification rule and a data calculation rule; determining first data in the to-be-calculated data based on the data selection rule; obtaining second data from the second database based on the data association rule; determining target data based on the data classification rule; and performing index calculation based on the target data and the data calculation rule. Therefore, when a to-be-monitored index is updated, the to-be-calculated data is processed based on the data selection rule, the data association rule, the data classification rule and the data calculation rule, so that the to-be-calculated data meets the index calculation requirement, and index calculation is completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, and in particular to the field of real-time big data processing, specifically to an indicator calculation method, device, electronic device, and storage medium. Background Technology

[0002] Currently, in scenarios involving the calculation of metrics on data streams, the existing data calculation rules may become inadequate to meet the metric calculation requirements due to updates to the metrics to be monitored. A common solution is to update the data calculation rules based on an open-source stream processing framework, thereby completing the metric calculation even when the metrics to be monitored are updated.

[0003] However, if the monitored metric is updated, updating only the data calculation rules may not meet the calculation requirements of the metric, thus preventing the metric calculation from being completed. Summary of the Invention

[0004] This application provides a method, apparatus, electronic device, and storage medium for calculating an indicator, to at least solve the technical problem in related technologies where, when the indicator to be monitored is updated, only the data calculation rules are updated, and the data to be calculated in the data stream may not meet the indicator calculation requirements, thus causing the indicator calculation to fail. The technical solution of this application is as follows:

[0005] According to a first aspect of this application, a method for calculating an indicator is provided, comprising: obtaining data to be calculated from a first database; the data to be calculated is data used for indicator calculation when the indicator is updated; the first database is an open-source stream processing platform for storing the data to be calculated; obtaining target indicator calculation rules for the data to be calculated from a second database; the target calculation rules include: data selection rules, data association rules, data classification rules, and data calculation rules; the second database is a relational database management system for storing at least one indicator calculation rule determined based on indicator calculation requirements; determining first data in the data to be calculated based on the data selection rules; the first data is used for indicator calculation; obtaining second data from the second database based on the data association rules; the second data is supplementary data that needs to be added when indicator calculation cannot be performed based on the first data;

[0006] The target data is determined based on the data classification rules; the target data is the data after classifying the data in the first data and the second data according to the indicator calculation requirements; the indicator is calculated based on the target data and the data calculation rules.

[0007] Based on the above technical means, this application can save the new indicator calculation rules and the dimension data required for indicator calculation in the second database when the indicator is updated. Based on the data selection rules, data association rules, data classification rules, and data calculation rules, the data to be calculated is selected, supplemented, summarized and classified, and the indicator calculation rules of the target data after summary and classification are determined so that the data to be calculated meets the indicator calculation requirements, thereby completing the indicator calculation.

[0008] In one possible implementation, the above method specifically includes: determining data picking rules based on embedded data in the data to be calculated; obtaining data picking rules from a second database; and determining first data in the data to be calculated based on the data picking rules.

[0009] Based on the above technical means, this application can determine the data selection rules for selecting the data to be calculated based on the embedded data in the data to be calculated, and select the data to be calculated according to the data selection rules to obtain the first data for index calculation.

[0010] In one possible implementation, the second database also includes indicator dimension data; the indicator dimension data is backup data for indicator calculation; the above method specifically includes: determining the corresponding data association rules based on the first data;

[0011] Data association rules are obtained from the second database, and second data in the indicator dimension data are obtained based on the first data and the data association rules.

[0012] According to the above technical means, this application can obtain data association rules from the second database when the first data cannot complete the indicator calculation, and obtain the second data in the indicator dimension data based on the first data and the data association rules, so that the indicator calculation device can perform indicator calculation based on the first data and the second data.

[0013] In one possible implementation, the above method specifically includes: determining the corresponding data classification rules in the second database based on the first data and the second data; obtaining the data classification rules from the second database; and determining the target data based on the first data, the second data, and the data classification rules.

[0014] Based on the above technical means, this application can obtain data classification rules when the first data and the second data need to be classified and summarized, and summarize and classify the first data and the second data so that the indicator calculation device can perform indicator calculation based on the target data after classification and summarization.

[0015] In one possible implementation, the above method specifically includes: determining the corresponding data calculation rules in the second database based on the target data; obtaining the data calculation rules from the second database; and performing indicator calculation based on the target data and the data calculation rules.

[0016] Based on the aforementioned technical means, this application can obtain the data calculation rules corresponding to the target data in the second database, and perform indicator calculations on the target data based on the data calculation rules.

[0017] In one possible implementation, the method further includes: determining the data update cycle based on the indicator calculation requirements; and deleting the data to be calculated in the first database at a preset time point based on the data update cycle.

[0018] Based on the aforementioned technical means, this application can clean up the first data, second data, and target data in the first database that cannot meet the time dimension requirements of the indicators according to a preset time period, based on the time dimension requirements of the indicators.

[0019] According to a second aspect of this application, an indicator calculation apparatus is provided, comprising an acquisition unit and a processing unit. The acquisition unit acquires data to be calculated from a first database; the data to be calculated is data used for indicator calculation when the indicator is updated; the first database is an open-source stream processing platform for storing the data to be calculated. The acquisition unit also acquires target indicator calculation rules for the data to be calculated from a second database; the target calculation rules include: data picking rules, data association rules, data classification rules, and data calculation rules; the second database is a relational database management system for storing at least one indicator calculation rule determined based on indicator calculation requirements. The processing unit determines first data from the data to be calculated based on the data picking rules; the first data is used for indicator calculation. The processing unit acquires second data from the second database based on the data association rules; the second data is data that needs to be supplemented when indicator calculation cannot be performed based on the first data. The processing unit determines target data based on data classification rules; the target data is data after classifying the data in the first data and the second data according to indicator calculation requirements. The processing unit performs indicator calculation based on the target data and the data calculation rules.

[0020] In one possible implementation, the processing unit is specifically used to: determine data picking rules based on the embedded data in the data to be calculated; instruct the acquisition unit to obtain the data picking rules from the second database, and determine the first data in the data to be calculated based on the data picking rules.

[0021] In one possible implementation, the second database further includes indicator dimension data; the indicator dimension data is backup data for indicator calculation; the processing unit is specifically used to: determine the corresponding data association rule based on the first data; instruct the acquisition unit to acquire the data association rule from the second database, and acquire the second data in the indicator dimension data based on the first data and the data association rule.

[0022] In one possible implementation, the processing unit is specifically configured to: determine the corresponding data classification rules in the second database based on the first data and the second data; obtain the data classification rules from the second database; and determine the target data based on the first data, the second data, and the data classification rules.

[0023] In one possible implementation, the processing unit is specifically used for: determining the corresponding data calculation rules in the second database based on the target data; obtaining the data calculation rules from the second database; and performing indicator calculations based on the target data and the data calculation rules.

[0024] In one possible implementation, the processing unit is further configured to determine the data update cycle based on the indicator calculation requirements; and delete the data to be calculated in the first database at a preset time point based on the data update cycle.

[0025] According to a third aspect provided in this application, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the method of the first aspect described above and any possible implementation thereof.

[0026] According to a fourth aspect provided in this application, a computer-readable storage medium is provided that, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the methods described in the first aspect and any possible implementation thereof.

[0027] According to the fifth aspect provided in this application, a computer program product is provided, the computer program product including computer instructions, which, when executed on an electronic device, cause the electronic device to perform the method described in the first aspect and any possible implementation thereof.

[0028] Therefore, the above-mentioned technical features of this application have the following beneficial effects:

[0029] (1) When updating the indicators, the new indicator calculation rules and the dimension data required for indicator calculation are stored in the second database. Based on the data selection rules, data association rules, data classification rules, and data calculation rules, the data to be calculated is selected, supplemented, summarized and classified, and the indicator calculation rules of the target data after summary and classification are determined so that the data to be calculated meets the indicator calculation requirements, thereby completing the indicator calculation.

[0030] (2) Determine the data selection rules for selecting the data to be calculated based on the embedded data in the data to be calculated, and select the data to be calculated according to the data selection rules to obtain the first data for index calculation.

[0031] (3) If the first data cannot complete the indicator calculation, the data association rules are obtained from the second database, and the second data in the indicator dimension data is obtained based on the first data and the data association rules, so that the indicator calculation device can perform indicator calculation based on the first data and the second data.

[0032] (4) When the first data and the second data need to be classified and summarized, the data classification rules are obtained, and the first data and the second data are summarized and classified so that the indicator calculation device can perform indicator calculation based on the target data after classification and summarization.

[0033] (5) Obtain the data calculation rules corresponding to the target data in the second database, and perform indicator calculation on the target data based on the data calculation rules.

[0034] (6) Based on the time dimension requirements of the indicators, clean up the first data, second data and target data in the first database that cannot meet the time dimension requirements of the indicators according to the preset time period.

[0035] It should be noted that the technical effects of any of the implementation methods in aspects two through five can be found in the technical effects of the corresponding implementation methods in aspect one, and will not be repeated here.

[0036] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0037] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application, and do not constitute an undue limitation of this application.

[0038] Figure 1 This is a flowchart illustrating an index calculation method according to an exemplary embodiment;

[0039] Figure 2 This is a data processing flowchart illustrated according to an exemplary embodiment;

[0040] Figure 3 This is a schematic diagram illustrating the structure of an expression parser component according to an exemplary embodiment;

[0041] Figure 4This is a schematic diagram illustrating the process of an expression parser processing a string according to an exemplary embodiment;

[0042] Figure 5 This is a flowchart illustrating how an index calculation device processes data to be processed, according to an exemplary embodiment.

[0043] Figure 6 This is a flowchart illustrating yet another index calculation method according to an exemplary embodiment;

[0044] Figure 7 This is a flowchart illustrating yet another index calculation method according to an exemplary embodiment;

[0045] Figure 8 This is a flowchart illustrating yet another index calculation method according to an exemplary embodiment;

[0046] Figure 9 This is a flowchart illustrating yet another index calculation method according to an exemplary embodiment;

[0047] Figure 10 This is a schematic diagram of a programming language illustrating an index calculation method according to an exemplary embodiment;

[0048] Figure 11 This is a flowchart illustrating an index calculation method according to an exemplary embodiment;

[0049] Figure 12 This is a flowchart illustrating yet another index calculation method according to an exemplary embodiment;

[0050] Figure 13 This is a block diagram illustrating an index calculation device according to an exemplary embodiment;

[0051] Figure 14 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0052] To enable those skilled in the art to better understand the technical solutions of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0053] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0054] Currently, in scenarios involving metric calculations on data streams, updates to the monitored metrics may render existing calculation rules inadequate for the required metrics. A common solution is to update these rules using an open-source stream processing framework to complete the calculation even when the monitored metrics are updated. However, simply updating the calculation rules in the event of a metric update may not be sufficient to meet the calculation requirements, resulting in the inability to complete the metric calculation.

[0055] This invention addresses the problem that, when monitoring indicators are updated, updating only the data calculation rules may fail to meet the calculation requirements, leading to incomplete indicator calculations. It proposes an indicator calculation method that, during indicator updates, stores the new indicator calculation rules and the required dimensional data in a second database. Based on data selection, association, classification, and calculation rules, the method selects, supplements, summarizes, and classifies the data to be calculated, determining the indicator calculation rules for the summarized and classified target data. This ensures that the data meets the indicator calculation requirements, thus completing the indicator calculation. This solves the technical problem that, when monitoring indicators are updated, updating only the data calculation rules may result in insufficient data to meet the calculation requirements, preventing the indicator calculation from being completed.

[0056] To facilitate understanding, the calculation method of the indicators provided in this application will be described in detail below with reference to the accompanying drawings.

[0057] Figure 1 This is a flowchart illustrating an index calculation method according to an exemplary embodiment, such as... Figure 1 As shown, the calculation method for this indicator includes the following steps:

[0058] S101, The index calculation device obtains the data to be calculated from the first database.

[0059] The data to be calculated is the data used to calculate the indicators when the indicators are updated; the first database is an open-source stream processing platform used to store the data to be calculated.

[0060] In one possible implementation, the first database is an open-source stream processing platform used to construct real-time streaming data pipelines to complete data transmission between systems or applications.

[0061] An exemplary metric calculation device obtains the data to be calculated from the open-source stream processing platform Kafka.

[0062] S102, The indicator calculation device obtains the target indicator calculation rules of the data to be calculated from the second database.

[0063] The target calculation rules include: data selection rules, data association rules, data classification rules, and data calculation rules; the second database is a relational database management system used to store at least one indicator calculation rule determined based on the indicator calculation requirements.

[0064] In one possible implementation, the second database is a relational database management system. After the indicator is updated, the indicator calculation rules generated based on the new indicator are stored in the relational database management system. The indicator calculation device obtains the target indicator calculation rules of the corresponding data to be calculated from the relational database management system according to the data to be calculated.

[0065] For example, the indicator calculation device obtains the target indicator calculation rules for the corresponding data to be calculated from MySQL.

[0066] S103, The index calculation device determines the first data in the data to be calculated based on the data selection rules.

[0067] The first data is used for indicator calculation.

[0068] In one possible implementation, after acquiring the data selection rules, the indicator calculation device calls the formula language parsing and execution toolkit in the open-source stream processing framework to convert the data selection rules into class methods, and executes the converted class methods through the virtual machine to determine the first data in the data to be calculated.

[0069] S104. The indicator calculation device obtains the second data from the second database based on the data association rules.

[0070] The second data is the data that needs to be supplemented when the indicator cannot be calculated based on the first data.

[0071] In one possible implementation, if the indicator cannot be calculated based on the first data, the indicator calculation device, after obtaining the data association rules, calls the formula language parsing and execution toolkit in the open-source stream processing framework to convert the data association rules into class methods, and executes the converted class methods through the virtual machine to obtain the data that needs to be supplemented from the second database.

[0072] S105, The indicator calculation device determines the target data based on the data classification rules.

[0073] The target data is the data after summarizing and classifying the data from the first data and the second data based on the indicator calculation requirements.

[0074] In one possible implementation, after obtaining the data classification rules, the indicator calculation device calls the formula language parsing and execution toolkit in the open-source stream processing framework to convert the data classification rules into class methods, and executes the converted class methods through the virtual machine to determine the data after summarizing and classifying the data in the first data and the data in the second data.

[0075] S106. The indicator calculation device performs indicator calculations based on the target data and data calculation rules.

[0076] In one possible implementation, after acquiring the data calculation rules, the indicator calculation device calls the formula language parsing and execution toolkit in the open-source stream processing framework to convert the data calculation rules into class methods, and executes the converted class methods through the virtual machine to perform indicator calculation on the target data based on the data calculation rules.

[0077] In one possible implementation, if a metric becomes invalid, the corresponding metric calculation rule will be deleted from MySQL, stopping the calculation of the data to be calculated for that metric.

[0078] For example, Flink's data processing flow is as follows: Figure 2 As shown in the data processing flowchart, after obtaining the target indicator calculation rules, the indicator calculation device calls the expression parser (IK Expression) in Flink to convert the target indicator calculation rules into class methods, and then executes the converted class methods through the virtual machine to perform indicator calculations on the data to be calculated; the structure of the expression parser component is as follows. Figure 3 The expression parser component structure diagram is shown below. The expression parser includes: an executor interface, an expression compilation module, an expression execution module, a configuration management module, and an environment variable management container. The process by which the expression parser processes the string (target indicator calculation rules) is as follows: Figure 4 As shown.

[0079] In one possible implementation, the process by which the index calculation device processes the data to be processed is as follows: Figure 5 The flowchart of the indicator calculation device processing the data to be processed is shown. The broadcast stream includes the target indicator calculation rules, and the data stream includes the data to be calculated. After the indicator calculation device receives the broadcast stream and the data stream, it transforms the target indicator calculation rules into instance methods to process the data to be calculated and outputs the indicator calculation results.

[0080] In some embodiments, in order to select the data to be calculated, first data for index calculation is obtained, so that the index calculation device performs index calculation based on the first data, combined with Figure 1 like Figure 6 As shown, the index calculation method provided in this application specifically includes the following S201-S202.

[0081] S201, The indicator calculation device determines the data selection rules based on the embedded data in the data to be calculated.

[0082] Among them, the data selection rule is used to determine the first data in the data to be calculated; the first data is used to perform indicator calculation.

[0083] In one possible implementation, the selection rule is used to select the first data in the data to be calculated that meets the preset conditions for indicator calculation. After the selection rule is determined, the selection rule is transformed into a first type of method based on the IK Expression in Flink, and the transformed first type of method is executed by the virtual machine to determine the first data in the data to be calculated.

[0084] For example, the picking rules are as follows:

[0085] "eventId=="Pushcard_open"&&$CAST2NUMBER($EXTRACT(properties,"card_type"))===1&&$CAST2NUMBER($EXTRACT( properties,"open_mode"))==2&&$CAST2STRING($EXTRACT(properties,"pushNumber"))=="TS11130438820040704"".

[0086] The preset conditions are: the tracking point type is Pushcard_open; the card type (card_type) in the tracking point attribute is 1; the open mode (open_mode) is type 2; the push number (pushNumber) is TS11130438820040704; the data in the data to be calculated that meets the above preset conditions is the first data used for the indicator.

[0087] S202, the index calculation device obtains data selection rules from the second database and determines the first data in the data to be calculated based on the data selection rules.

[0088] In one possible implementation, the indicator calculation device determines the data selection rules corresponding to the data to be calculated based on the data to be calculated, obtains the data selection rules from the second database, and determines the first data in the data to be calculated based on the data selection rules.

[0089] In some embodiments, the second database also includes indicator dimension data, which serves as backup data for indicator calculation; in cases where the first data is insufficient to complete the indicator calculation, in order to supplement the data required for indicator calculation, combined with... Figure 6 like Figure 7 As shown, the index calculation method provided in this application specifically includes the following S301-S302.

[0090] S301, The indicator calculation device determines the corresponding data association rules based on the first data.

[0091] In one possible implementation, if the indicator calculation cannot be completed based on the first data, the second database includes dimensional data for indicator calculation pre-stored based on the indicator calculation requirements, and the indicator calculation device determines the data association rules in the second database based on the first data.

[0092] For example, the indicator calculation device determines the data association rules in MySQL used to supplement the dimension data based on the first data, and the association expression is: "left_key,table_name,right_key,f1^type1@f2^type2;left_key,table_name,right_key,f1^type1@f2^type2.....

[0093] S302, the indicator calculation device obtains data association rules from the second database, and obtains the second data in the indicator dimension data based on the first data and the data association rules.

[0094] In one possible implementation, if the indicator calculation cannot be completed based on the first data, the second database includes dimensional data for indicator calculation pre-stored based on the indicator calculation requirements. The indicator calculation device determines the data association rules in the second database based on the first data. After determining the selection rules, the data association rules are transformed into a second type of method based on IK Expression in Flink, and the transformed second type of method is executed by the virtual machine to obtain the dimensional data from the second database, thereby satisfying the indicator calculation requirements.

[0095] In some embodiments, in order to obtain data classification rules when the first data and the second data need to be classified and summarized, the first data and the second data are classified and summarized, so that the indicator calculation device performs indicator calculation based on the classified and summarized target data, combined with Figure 7 like Figure 8 As shown, the index calculation method provided in this application specifically includes the following S401-S402.

[0096] S401, The index calculation device determines the corresponding data classification rules in the second database based on the first data and the second data.

[0097] In one possible implementation, the indicator calculation requires the aggregation of data from different dimensions, and the calculation is performed after aggregation. The indicator calculation device determines the data classification rules in the second database for aggregating the first data and the second data based on the first data and the second data.

[0098] S402, the indicator calculation device obtains data classification rules from the second database and determines target data based on the first data, the second data, and the data classification rules.

[0099] In one possible implementation, after determining the data classification rules, the indicator calculation device transforms the data classification rules into a third-class method based on IKExpression in Flink, and executes the transformed third-class method through a virtual machine to summarize and classify the first and second data, thereby meeting the indicator calculation requirements.

[0100] In some embodiments, in order to obtain the data calculation rules corresponding to the target data in the second database, the target data is used to calculate indicators based on the data calculation rules, combined with... Figure 8 like Figure 9 As shown, the index calculation method provided in this application specifically includes the following S501-S502:

[0101] S501, The indicator calculation device determines the corresponding data calculation rules in the second database based on the target data.

[0102] In one possible implementation, the second database includes multiple data calculation rules determined based on the indicator calculation requirements, and the indicator calculation device determines the data calculation rules corresponding to the target data in the second database based on the target data.

[0103] S502, the indicator calculation device obtains the data calculation rules from the second database and performs indicator calculation based on the target data and the data calculation rules.

[0104] In one possible implementation, after determining the data calculation rules, the indicator calculation device transforms the data calculation rules into a fourth type of method based on IKExpression in Flink, and executes the transformed fourth type of method through a virtual machine to calculate the indicator of the target data based on the data calculation rules.

[0105] For example, the programming language for the above indicator calculation method is as follows: Figure 10 As shown, SELECT a, b, c is the data computation language, FROM table_a is the data picking language, JOIN ON table_b ON EXPRESSION is the data association language, and GROUP BY g_a is the data classification language.

[0106] In some embodiments, the above-mentioned indicator calculation method can be specifically implemented through methods such as... Figure 11 The implementation process of the indicator calculation method shown is as follows.

[0107] In some embodiments, to determine the data update cycle based on the indicator calculation requirements, the data to be calculated in the first database is deleted at a preset time point based on the data update cycle to ensure the timeliness of the data in the first database. For example... Figure 12 As shown, the index calculation method provided in this application also includes the following S601-S602:

[0108] S601, The indicator calculation device determines the data update cycle based on the indicator calculation requirements.

[0109] In one possible implementation, the indicator calculation is time-sensitive. The data to be calculated stored in the first database needs to be cleaned up if it does not meet the timeliness requirements. The indicator calculation device determines the data update cycle based on the needs of different indicator calculations.

[0110] S602, The indicator calculation device deletes the data to be calculated in the first database at a preset time point based on the data update cycle.

[0111] In one possible implementation, when the indicator calculation device determines through a preset timing module that the data to be calculated stored in the first database exceeds a preset time, the data to be calculated in the first database is deleted at a preset time point. The data to be calculated includes: first data, second data, and target data.

[0112] In one possible implementation, the indicator calculation requirements are determined based on the operational activities. At the start of the operational activities, the indicator calculation rules determined based on the indicator calculation requirements are stored in a second database. The indicator calculation device scans the second database according to a preset period, obtains the indicator calculation rules, and performs indicator calculations. When the operational activities end, the indicator calculation device stops obtaining indicator calculation rules and does not perform indicator calculations.

[0113] The foregoing primarily describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the aforementioned functions, the index calculation device or electronic device includes corresponding hardware structures and / or software modules for performing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0114] This application embodiment can, according to the above method, exemplarily divide an indicator calculation device or electronic device into functional modules. For example, the indicator calculation device or electronic device may include functional modules corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.

[0115] Figure 13 This is a block diagram illustrating an index calculation device according to an exemplary embodiment. (Refer to...) Figure 13 The index calculation device 1300 includes: an acquisition unit 1301 and a processing unit 1302. The acquisition unit 1301 acquires data to be calculated from a first database; the data to be calculated is data used for indicator calculation when the indicator is updated; the first database is an open-source stream processing platform for storing the data to be calculated; the acquisition unit 1301 acquires target indicator calculation rules for the data to be calculated from a second database; the target calculation rules include: data picking rules, data association rules, data classification rules, and data calculation rules; the second database is a relational database management system for storing at least one indicator calculation rule determined based on indicator calculation requirements; the processing unit 1302 determines first data in the data to be calculated based on the data picking rules; the first data is used for indicator calculation; the processing unit 1302 acquires second data from the second database based on the data association rules; the second data is data that needs to be supplemented when indicator calculation cannot be performed based on the first data; the processing unit 1302 determines target data based on the data classification rules; the target data is data after classifying the data in the first data and the second data based on indicator calculation requirements; the processing unit 1302 performs indicator calculation based on the target data and the data calculation rules.

[0116] In one possible implementation, the processing unit 1302 is specifically used to: determine data picking rules based on the embedded data in the data to be calculated; instruct the acquisition unit to acquire the data picking rules from the second database, and determine the first data in the data to be calculated based on the data picking rules.

[0117] In one possible implementation, the second database also includes indicator dimension data; the indicator dimension data is backup data for indicator calculation; the processing unit 1302 is specifically used to: determine the corresponding data association rule based on the first data; instruct the acquisition unit to acquire the data association rule from the second database, and acquire the second data in the indicator dimension data based on the first data and the data association rule.

[0118] In one possible implementation, the processing unit 1302 is specifically configured to: determine the corresponding data classification rules in the second database based on the first data and the second data; obtain the data classification rules from the second database; and determine the target data based on the first data, the second data, and the data classification rules.

[0119] In one possible implementation, the processing unit 1302 is specifically used to: determine the corresponding data calculation rules in the second database based on the target data; obtain the data calculation rules from the second database; and perform index calculation based on the target data and the data calculation rules.

[0120] In one possible implementation, the processing unit 1302 is further configured to determine the data update cycle based on the indicator calculation requirements; and delete the data to be calculated in the first database at a preset time point based on the data update cycle.

[0121] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0122] Figure 14 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Figure 14 As shown, the electronic device 1400 includes, but is not limited to, a processor 1401 and a memory 1402.

[0123] The memory 1402 described above is used to store the executable instructions of the processor 1401. It is understood that the processor 1401 is configured to execute instructions to implement the index calculation method in the above embodiments.

[0124] It should be noted that those skilled in the art will understand that Figure 14 The electronic device structure shown does not constitute a limitation on the electronic device; the electronic device may include, but is not limited to, other electronic devices. Figure 14This may indicate more or fewer components, or combinations of certain components, or different component arrangements.

[0125] Processor 1401 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in memory 1402, and by calling data stored in memory 1402, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. Processor 1401 may include one or more processing units. Optionally, processor 1401 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into processor 1401.

[0126] The memory 1402 can be used to store software programs and various data. The memory 1402 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, application programs required by at least one functional module (such as a determination unit, processing unit, etc.), etc. Furthermore, the memory 1402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0127] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1402 including instructions, which can be executed by a processor 1401 of an electronic device 900 to implement the methods in the above embodiments.

[0128] In actual implementation, Figure 13 The functions of the acquisition unit 1301 and the processing unit 1302 can both be provided by Figure 14 The processor 1401 calls the computer program stored in the memory 1402 to implement the process. The specific execution process can be found in the description of the method section in the previous embodiment, and will not be repeated here.

[0129] Optionally, the computer-readable storage medium may be a non-transitory computer-readable storage medium, such as a read-only memory (ROM), random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device.

[0130] In an exemplary embodiment, this application also provides a computer program product including one or more instructions, which can be executed by a processor 1401 of an electronic device to perform the methods described above.

[0131] It should be noted that when one or more instructions in the computer-readable storage medium or computer program product are executed by the processor of an electronic device, they implement the various processes of the above method embodiments and achieve the same technical effect as the above method. To avoid repetition, they will not be described again here.

[0132] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0133] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0134] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the classified units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0135] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0136] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, essentially, or the part that contributes to the prior art, or a complete or partial classification of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0137] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for calculating an index, characterized in that, include: Retrieve the data to be calculated from the first database; The data to be calculated is the data used for indicator calculation when the indicator is updated. The first database is an open-source stream processing platform used to store the data to be computed; Obtain the target indicator calculation rules for the data to be calculated from the second database; The target indicator calculation rules include: data selection rules, data association rules, data classification rules, and data calculation rules; the second database is a relational database management system for storing at least one indicator calculation rule determined based on indicator calculation requirements; Based on the data selection rules, a first data point is determined from the data to be calculated; the first data point is used for indicator calculation. The second data is obtained from the second database based on the data association rules; the second data is supplementary data that needs to be obtained when the indicator cannot be calculated based on the first data. The target data is determined based on the data classification rules; the target data is the data after classifying the data in the first data and the second data based on the indicator calculation requirements; Indicator calculations are performed based on the target data and the data calculation rules.

2. The method according to claim 1, characterized in that, The step of determining the first data in the data to be calculated based on the data picking rules includes: Data selection rules are determined based on the embedded data in the data to be calculated; The data selection rules are obtained from the second database, and the first data in the data to be calculated is determined based on the data selection rules.

3. The method according to claim 2, characterized in that, The second database also includes indicator dimension data; the indicator dimension data is backup data for indicator calculation; the step of obtaining the second data from the second database based on the data association rules includes: Based on the first data, determine the corresponding data association rules; The data association rules are obtained from the second database, and the second data in the indicator dimension data is obtained based on the first data and the data association rules.

4. The method according to claim 3, characterized in that, The process of determining the target data based on the data classification rules includes: Based on the first data and the second data, determine the corresponding data classification rules in the second database; The data classification rules are obtained from the second database, and the target data is determined based on the first data, the second data, and the data classification rules.

5. The method according to claim 4, characterized in that, The calculation of indicators based on the target data and the data calculation rules includes: Based on the target data, determine the corresponding data calculation rules in the second database; The data calculation rules are obtained from the second database, and the indicators are calculated based on the target data and the data calculation rules.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: The data update cycle is determined based on the calculation requirements of the aforementioned indicators; The data to be calculated in the first database is deleted at a preset time point based on the data update cycle.

7. An index calculation device, characterized in that, Includes: an acquisition unit and a processing unit; The acquisition unit acquires data to be calculated from the first database; the data to be calculated is data used for indicator calculation when the indicator is updated. The first database is an open-source stream processing platform used to store the data to be computed; The acquisition unit is used to acquire the target indicator calculation rules of the data to be calculated from the second database; The target indicator calculation rules include: data selection rules, data association rules, data classification rules, and data calculation rules; the second database is a relational database management system for storing at least one indicator calculation rule determined based on indicator calculation requirements; The processing unit is used to determine the first data in the data to be calculated based on the data selection rules; the first data is used for indicator calculation. The processing unit is used to obtain second data from the second database based on the data association rules; the second data is supplementary data that needs to be obtained when the indicator cannot be calculated based on the first data. The processing unit is used to determine target data based on the data classification rules; the target data is the data after classifying the data in the first data and the second data based on the indicator calculation requirements; The processing unit is used to calculate indicators based on the target data and the data calculation rules.

8. The apparatus according to claim 7, characterized in that, The processing unit is specifically used for: Data selection rules are determined based on the embedded data in the data to be calculated; The acquisition unit is instructed to obtain data picking rules from the second database and determine the first data in the data to be calculated based on the data picking rules.

9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, When the computer-executable instructions stored in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is capable of performing the method as described in any one of claims 1 to 6.