Query method of business indexes and generation method of query API (Application Program Interface) of business indexes
By receiving the client's target query request, adjusting and generating corresponding API scripts based on the target API identification information and metadata table, it solves the problem of difficult operation and low processing efficiency in the existing technology, and realizes efficient and flexible API generation and business indicator query.
Patent Information
- Application Number
- CN202411970513.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-02
AI Technical Summary
When querying business indicators in financial business scenarios, the existing technology is difficult to operate, low processing efficiency, and the generated API is poorly flexible, which affects the user's query experience.
By receiving the client's target query request, the matching preset API script is determined from the database based on the identification information and metadata table of the target API, and the script is adjusted according to the query type parameters, the corresponding API script is generated, and the API query engine is called to execute the script to obtain business data, and the query results of the target business indicators are calculated.
Reduces operation difficulty, improves data processing efficiency, enhances API flexibility, and improves user query experience.
Smart Images

Figure CN119917542A_ABST
Abstract
Description
Technical Field
[0001] This specification belongs to the field of Internet technology, and in particular to a method for querying business indicators and a method for generating a query API for business indicators. Background Art
[0002] In financial business scenarios, users often need to query the business indicators they are concerned about through trading platforms so that they can better understand the specific circumstances of the relevant business and make better subsequent decisions.
[0003] As user needs become increasingly diversified, the types of business indicators that users want to query are becoming more and more numerous, and the data content of the business indicators that they want to query is becoming more and more complex. Based on existing methods, most of them rely on technical personnel to manually design and encode corresponding APIs according to the specific needs of users, so that users can perform specific queries on the data content of the business indicators of concern based on the corresponding APIs. However, when the above methods are implemented, there are often difficulties in operation, low processing efficiency, and poor flexibility of the generated APIs, which in turn affects the user's query experience.
[0004] Currently, no effective solution has been proposed to the above problems. Summary of the invention
[0005] This specification provides a method for querying business indicators and a method for generating a query API for business indicators, which can effectively reduce the difficulty of related operations, efficiently and conveniently complete the generation of query APIs for business indicators, and related queries on business indicators based on corresponding APIs, thereby improving overall data processing efficiency.
[0006] This specification provides a method for querying business indicators, which is applied to a server and includes:
[0007] Receive a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; the query parameters at least include a query type parameter;
[0008] In response to the target query request, according to the identification information of the target API and the metadata table, a matching preset API script is determined from the first database as the first API script; wherein the first database stores at least a plurality of preset API scripts; and the metadata table is associated with the first database;
[0009] According to the query type parameter, determining a matching result processing statement template from the first database;
[0010] According to the query parameters and the result processing statement template, the first API script is adjusted to obtain a corresponding second API script;
[0011] Calling the API query engine to execute the second API script, obtaining corresponding target business data from the second database based on the metadata table; and calculating and obtaining a target query result about the target business indicator and matching the query type parameter according to the target business data; wherein the second database at least stores the business data;
[0012] Feedback the target query result to the client.
[0013] In one embodiment, the query type parameter includes at least one of the following: an indicator value query identifier, an indicator evaluation result query identifier, and an indicator calculation detail query identifier.
[0014] In one embodiment, the target query request also carries an identity identifier of the client;
[0015] Accordingly, after receiving the target query request, the method further includes:
[0016] According to the identification information of the target API, query the verification subtable in the metadata table to determine whether there is a target verification rule corresponding to the target API;
[0017] In the case where it is determined that there is a target verification rule, obtaining and performing a query permission check on the target query request using the identity identifier of the client according to the target verification rule, and obtaining a permission check result; at the same time, performing an integrity check on the target query request using the query parameters according to the target verification rule, and obtaining an integrity check result;
[0018] According to the target verification rules, the permission verification result and the integrity verification result are used together to determine whether the target query request has passed the verification;
[0019] When it is determined that the target query request fails to pass the verification, a first error message about the target query request is fed back to the client.
[0020] In one embodiment, the query parameter further includes at least one of the following: a time parameter, a granularity parameter, and an indicator identifier of a key indicator.
[0021] In one embodiment, the API query engine is called to execute the second API script, and corresponding target business data is obtained from the second database based on the metadata table; and a target query result about the target business indicator and matching the query type parameter is calculated according to the target business data, including:
[0022] Calling an API query engine to execute a second API script to determine indicator identifiers of multiple subordinate indicators of the target business indicator;
[0023] According to the indicator identifier of the subordinate indicator, the metadata table is queried to determine the final indicator and the intermediate indicator from multiple subordinate indicators;
[0024] Based on the metadata table, obtain and obtain corresponding target business data from the second database according to the calculation rules of the final level indicators;
[0025] According to the calculation rules of the final-level indicators and the target business data, the indicator value of the final-level indicators is calculated and used to calculate the evaluation value of the final-level indicators;
[0026] Based on the metadata table, the target query results about the target business indicators and matching the query type parameters are obtained by obtaining and calculating the target business indicators and the intermediate indicators according to the construction rules of the target business indicators and the construction rules of the intermediate indicators, using the evaluation values of the final indicators and the corresponding weight coefficients.
[0027] In one embodiment, the method further comprises:
[0028] Receive a target API generation request; wherein the target API generation request carries at least identification information of the target API and an indicator identifier of a target business indicator associated with the target API;
[0029] In response to the target API generation request, according to the indicator identifier of the target business indicator, a construction rule for generating the target business indicator is configured; and the construction rule of the target business indicator is stored in the metadata table; wherein the construction rule includes the indicator identifier of the subordinate indicator related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicator, and the weight coefficient of the subordinate indicator;
[0030] According to the construction rules of the target business indicators, a matching script configuration template is determined; wherein the script configuration template at least includes a matching template statement;
[0031] According to the metadata table, determine the construction rules of the subordinate indicators;
[0032] The construction rules of the target business indicators, the construction rules of the subordinate indicators, and the script configuration template are used together to construct the corresponding preset API script;
[0033] The preset API script is stored in the first database; and the metadata table is updated.
[0034] In one embodiment, after constructing the corresponding preset API script, the method further includes:
[0035] Based on the second database, obtaining simulation data about the preset API script;
[0036] Use simulated data to simulate the preset API script and obtain the simulated test results;
[0037] According to the simulation test results, determine whether the preset API script has passed the test;
[0038] When the preset API test is confirmed to have passed, the target API is released for use by the client.
[0039] This specification also provides a method for generating a query API for a business indicator, including:
[0040] Receive a target API generation request; wherein the target API generation request carries at least identification information of the target API and an indicator identifier of a target business indicator associated with the target API;
[0041] In response to the target API generation request, according to the indicator identifier of the target business indicator, a construction rule for generating the target business indicator is configured; and the construction rule of the target business indicator is stored in the metadata table; wherein the construction rule includes the indicator identifier of the subordinate indicator related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicator, and the weight coefficient of the subordinate indicator;
[0042] According to the construction rules of the target business indicators, a matching script configuration template is determined; wherein the script configuration template at least includes a matching template statement;
[0043] According to the metadata table, determine the construction rules of the subordinate indicators;
[0044] The construction rules of the target business indicators, the construction rules of the subordinate indicators, and the script configuration template are used together to construct the corresponding preset API script;
[0045] The preset API script is stored in the first database; and the metadata table is updated.
[0046] This specification also provides a business indicator query device, which is applied to a server and includes:
[0047] A receiving module receives a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; the query parameters at least include a query type parameter;
[0048] A first determination module is used to respond to a target query request and determine a matching preset API script from a first database as a first API script according to identification information of a target API and a metadata table; wherein the first database stores at least a plurality of preset API scripts; and the metadata table is associated with the first database;
[0049] A second determination module, configured to determine a matching result processing statement template from the first database according to the query type parameter;
[0050] An adjustment module, used to adjust the first API script according to the query parameters and the result processing statement template, and obtain a corresponding second API script;
[0051] An execution module is used to call the API query engine to execute the second API script, obtain corresponding target business data from the second database based on the metadata table; and calculate the target query result about the target business indicator and matching the query type parameter according to the target business data; wherein the second database at least stores business data;
[0052] The feedback module is used to feed back the target query result to the client.
[0053] The present specification also provides a server, comprising a processor and a memory for storing processor executable instructions, wherein the processor implements the relevant steps of the business indicator query method when executing the instructions.
[0054] Based on the query method of business indicators and the method for generating a query API for business indicators provided in this specification, before specific implementation, receive and respond to the target API generation request initiated by the business end, configure the construction rules and script configuration template for generating the target business indicators, and the construction rules of the subordinate indicators associated with the target business indicators; then use the construction rules of the target business indicators, the construction rules of the subordinate indicators, and the script configuration template in combination to automatically construct the corresponding preset API script, so as to efficiently and conveniently realize the automatic generation of the query API for the business indicators. In the specific implementation, the target query request initiated by the client based on the target API is received and responded to; according to the identification information of the target API and the metadata table, a matching first API script is determined from the first database; at the same time, according to the query type parameter, a matching result processing statement template is determined from the first database; then according to the query parameter and the result processing statement template, the first API script is adjusted to obtain the corresponding second API script; the API query engine is called to execute the second API script, and the corresponding target business data is obtained from the second database based on the metadata table; and according to the target business data, a layer-by-layer calculation is performed to obtain a target query result about the target business indicator and matching the query type parameter; the target query result is fed back to the client, and the generated target API is used to quickly and accurately realize the result query about the business indicator. Thereby, the difficulty of related operations can be effectively reduced, and the generation of query APIs about business indicators and related queries about business indicators based on APIs can be completed efficiently and conveniently, thereby improving the overall data processing efficiency and enabling users to obtain a better query experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of this specification, the drawings required for use in the embodiments will be briefly introduced below. The drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0056] Figure 1 It is a flowchart of a method for querying business indicators provided by an embodiment of this specification;
[0057] Figure 2 It is a schematic diagram of an embodiment of a query method for business indicators provided by an embodiment of this specification, in a scenario example;
[0058] Figure 3 It is a schematic diagram of an embodiment of a query method for business indicators provided by an embodiment of this specification, in a scenario example;
[0059] Figure 4 It is a schematic diagram of an embodiment of a query method for business indicators provided by an embodiment of this specification, in a scenario example;
[0060] Figure 5 It is a schematic diagram of an embodiment of a query method for business indicators provided by an embodiment of this specification, in a scenario example;
[0061] Figure 6 It is a flowchart of a method for generating a query API for a business indicator provided by an embodiment of this specification;
[0062] Figure 7 It is a schematic diagram of the structure of a server provided by an embodiment of this specification;
[0063] Figure 8 It is a schematic diagram of the structure of a query device for business indicators provided by an embodiment of this specification;
[0064] Fig. 9 It is a schematic diagram of an embodiment of a query method for business indicators provided by an embodiment of this specification, in a scenario example;
[0065] Fig.10 It is a schematic diagram of an embodiment of a query method for business indicators provided by an embodiment of this specification, in a scenario example;
[0066] Fig.11 It is a schematic diagram of an embodiment of a query method for business indicators provided by an embodiment of this specification, in a scenario example. DETAILED DESCRIPTION
[0067] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0068] It should be noted that the user-related information and data involved in the embodiments of this specification are all information and data authorized by the user or fully authorized by relevant parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users or relevant parties to choose to authorize or refuse.
[0069] It should also be noted that in the embodiments of this specification, certain software, components, models and other existing solutions in the industry may be mentioned. They should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.
[0070] See also Figure 1 As shown, the embodiment of this specification provides a method for querying business indicators, wherein the method is specifically applied to the server side. When implemented specifically, the method may include the following contents:
[0071] S101: receiving a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; the query parameters at least include a query type parameter;
[0072] S102: In response to the target query request, according to the identification information of the target API and the metadata table, determine a matching preset API script from a first database as a first API script; wherein the first database stores at least a plurality of preset API scripts; and the metadata table is associated with the first database;
[0073] S103: Determine a matching result processing statement template from the first database according to the query type parameter;
[0074] S104: adjusting the first API script according to the query parameter and the result processing statement template to obtain a corresponding second API script;
[0075] S105: Calling an API query engine to execute a second API script, obtaining corresponding target business data from a second database based on the metadata table; and calculating a target query result about a target business indicator and matching a query type parameter according to the target business data; wherein the second database at least stores business data;
[0076] S106: Feedback the target query result to the client.
[0077] For details, see Figure 2 As shown, the query method of the above-mentioned business indicators can be applied to the server side. The above-mentioned server can specifically include a background server applied to the transaction service platform side, which can realize functions such as data transmission and data processing. Specifically, the server can be, for example, an electronic device with data calculation, storage and network interaction functions. Alternatively, the server can also be a software program running in the electronic device to provide support for data processing, storage and network interaction. In this embodiment, the number of the servers is not specifically limited. The server can specifically be one server, or several servers, or a server cluster formed by several servers.
[0078] The client can be understood as a front end that is deployed on the user (e.g., the business query party) side and can realize functions such as data collection and data transmission. Specifically, the client can be, for example, an electronic device such as a desktop computer, a tablet computer, a laptop computer, a smart phone, etc. Alternatively, the client can also be a software application that can run in the above electronic devices. For example, it can be an APP of a transaction service platform running on a smart phone.
[0079] Specifically, a target API associated with the target business indicator can also be deployed on the client. The target API supports users to query various types of business information related to the target business indicator (including: the indicator value of the target business indicator, the indicator evaluation result of the target business indicator, the target business indicator multi-indicator calculation details, etc.). The above API (Application Programming Interface) can be specifically understood as an application programming interface. It should be noted that each API (or query API) corresponds to a business indicator.
[0080] The above-mentioned business indicators can be specifically understood as parameter data that can reflect the business attribute characteristics and are calculated based on the corresponding business data. Specifically, for example, in a financial business scenario, the above-mentioned business indicators may include one or more of the following: the customer's average annual income, the customer's average fixed consumption, the customer's average disposable income, etc. Of course, it should be noted that the business indicators listed above are only a schematic illustration. In specific implementation, for different application scenarios and combined with different business needs, the above-mentioned business indicators may also include other types of indicators. This specification does not limit this.
[0081] Furthermore, the above business indicators may also include: final-level indicators and non-final-level indicators.
[0082] Among them, the indicator value of the final-level indicator is directly calculated based on the business data.
[0083] The index value of the non-final-level index is calculated based on the index values of other indexes, or is calculated based on the combination of the index values of other indexes and business data. The above-mentioned other indexes used to calculate the index values of non-final-level indexes can be collectively referred to as lower-level indexes.
[0084] Accordingly, when a user needs to query the relevant business information of a target business indicator, he can set the corresponding query parameters through the target API of the client, and then use the target API to initiate a corresponding target query request to the server. The target query request at least carries the identification information of the target API and the query parameters; the query parameters at least include a query type parameter for indicating the specific information type about the target business indicator to be queried.
[0085] In specific implementation, after receiving the target query request, the server may first parse the target query request to obtain the identification information of the corresponding target API; and at the same time, extract the query parameters in the target query request.
[0086] Next, the server can respond to the target query request and determine the storage index of the preset script corresponding to the identification information of the target API by querying the metadata table; then search the first database based on the storage index to obtain the corresponding preset script as the first API script.
[0087] The first database at least stores a plurality of preset API scripts.
[0088] The above-mentioned preset API script can be specifically understood as a code script that responds to the API generation request in advance, automatically configures and generates a code script that is compatible with the API query engine of the platform system and can complete the basic operations of the business indicators corresponding to the API.
[0089] Furthermore, the first database may also store a plurality of preset result processing statement templates corresponding to different query type parameters.
[0090] The query type parameter may specifically include at least one of the following: an indicator value query identifier, an indicator evaluation result query identifier, an indicator calculation detail query identifier, etc. The preset result processing statement template may specifically be understood as a code template that can perform further processing operations based on the basic operation results of the business indicators to obtain a query result that meets the user's query type.
[0091] The above-mentioned element data table is associated with the first database, and at least stores the storage index of each preset API script in the first database, and the corresponding relationship between the storage index and the identification information of the API.
[0092] Furthermore, the above metadata table may also store an indicator type sub-table, a verification sub-table, a rule sub-table, a configuration information sub-table, and the like of business indicators.
[0093] Specifically, the indicator type sub-table may specifically include the indicator type (including: non-final-level indicator or final-level indicator) corresponding to the indicator identifier of each business indicator.
[0094] The verification subtable contains the identification information of the API that needs to be verified before querying, and the verification rules corresponding to the identification information of the API (including: query authority verification rules and / or integrity verification rules). The rule subtable may specifically contain the construction rules of the business indicators corresponding to the indicator identification of each business indicator; for the final indicator, it may also include the calculation rules based on the business data for the final indicator.
[0095] The above construction rules may specifically include the indicator identifiers of the subordinate indicators that are required to be used when calculating the corresponding business indicators, the hierarchical relationship between the corresponding business indicators and the subordinate indicators, and the relevant weight coefficients of the subordinate indicators. Figure 3As shown, the hierarchical relationship between the corresponding business indicators and subordinate indicators can be specifically stored in a tree structure. Among them, the business indicator corresponding to the construction rule (for example, the first-level indicator A) as the highest-level indicator can be set as the root node of the tree structure; the subordinate indicators used to calculate the business indicator are set as nodes in the level below the root node in order from high to low. The final indicator in the subordinate indicator (for example, the third-level indicators a11, a12, a21, a22, a31, a32) can be set as a leaf node in the lowest level, and the intermediate indicators in the subordinate indicator other than the final indicator (for example, the second-level indicators a1, a2, a3) can be set as intermediate nodes in the intermediate level below the root node and above the lowest level. Further, in the above tree structure, nodes with indicator calculation relationships between adjacent different levels can also be connected using edges; and corresponding weight coefficients can also be marked on the edges. For example, based on the construction rule of the second-level indicator a1, the second-level indicator a1 is calculated based on the third-level indicator a11 and the third-level indicator a12. Accordingly, the secondary index a1 can be connected to the tertiary index a11 and the tertiary index a12 in the tree structure using edges, and the corresponding weight coefficients can be marked on the edges. The above calculation rules can specifically include data identifiers of business data required for calculation, and calculation formulas based on business data.
[0096] The configuration information sub-table may also include relevant information such as the configuration time of the preset API script, the identity of the configurer, custom configuration parameters, and attribute information of the code field.
[0097] In addition, the metadata table may also include other rule data related to the indicator value calculation rules, indicator evaluation rules, and the like of each business indicator.
[0098] In specific implementation, the server can determine a matching processing result statement template from the first database according to the query type parameter; jointly use the query parameter and the result processing statement template to modify and adjust the first API script to obtain a second API script corresponding to the target query request.
[0099] Furthermore, the server can obtain corresponding target business data from the second database based on the metadata table by calling the API query engine to execute the second API script; and calculate the target query results about the target business indicators and matching the query type parameters based on the target business data; and then feed back the target query results to the client.
[0100] The second database at least stores the business data of the transaction service platform. Furthermore, the query results that have been queried by the client within a period of time and have not expired can also be stored in the second database.
[0101] Based on the above embodiment, by receiving and responding to the target query request initiated by the client based on the target API, according to the identification information of the target API and the metadata table, a matching first API script is determined from the first database; at the same time, according to the query type parameter, a matching result processing statement template is determined from the first database; then according to the query parameter and the result processing statement template, the first API script is adjusted to obtain the corresponding second API script; the API query engine is called to execute the second API script, and the corresponding target business data is obtained from the second database based on the metadata table; and the target query result about the target business indicator and matching the query type parameter is calculated according to the target business data; the target query result is fed back to the client, and the generated API is used to quickly and accurately realize the result query about the business indicator. Thereby, the difficulty of related operations can be effectively reduced, and the query related to the business indicator based on the API can be completed efficiently and conveniently, thereby improving the overall data processing efficiency.
[0102] In some embodiments, after calculating the target query result about the target business indicator and matching the query type parameter based on the target business data, the method also includes: generating a query tag for the target query result based on the identification information of the target API and the query type parameter; adding the query tag to the target query result; and storing the target query result carrying the query tag in a second database.
[0103] Correspondingly, after receiving a target query request initiated by the client based on the target API, the method may also include: searching a second database based on the identification information and query type parameters of the target API to determine whether there is a first query tag that matches the identification information and query type parameters of the target API; if it is determined that the first query tag exists, obtaining a query result corresponding to the first query tag as the target query result.
[0104] When it is determined that there is no matching first query tag, the second database can be searched based only on the identification information of the target API to determine whether there is a second query tag that matches the identification information of the target API; when it is determined that the second query tag exists, the query result corresponding to the second query tag is obtained as an intermediate result; according to the query type parameters, a matching result processing statement template is determined from the first database; based on the query parameters and the result processing statement template, further calculation processing is performed on the basis of the intermediate result to obtain a target query result about the target business indicator and matching the query type parameters.
[0105] When it is determined that there is no matching second query tag, a target query result about the target business indicator and matching the query type parameter may be re-determined according to the above-mentioned query method for the business indicator.
[0106] Specifically, the query result stored in the second database may also carry a timestamp; wherein the timestamp is generated according to the storage time of the query result.
[0107] Correspondingly, in a specific implementation, the timestamp of the query result in the second database can be retrieved at every preset time period (for example, every half a month); whether the storage time of the query result in the second database is greater than a preset time threshold is determined based on the timestamp; and the query result whose storage time is greater than the preset time threshold is marked as invalid; and the query result marked as invalid is deleted from the second database to reduce the occupancy of the storage resources of the second database.
[0108] In some embodiments, the query type parameters may include at least one of the following: an indicator value query identifier, an indicator evaluation result query identifier, an indicator calculation detail query identifier, and the like.
[0109] The query type parameter indicates different query types about the target business indicator, for example, query about the indicator value of the target business indicator, query about the indicator evaluation result of the target business indicator, query about the indicator calculation details of the target business indicator, and so on.
[0110] Based on the above embodiments, it is possible to support multiple different types of queries about target business indicators through the same API to meet users' diverse query requests; at the same time, since multiple different types of queries corresponding to the same target business indicator are implemented based on only the same API, there is no need to separately design and deploy APIs for different types of queries for the same target business indicator, thereby effectively reducing the deployment and maintenance costs of the API and improving the utilization rate of a single API.
[0111] In some embodiments, the target query request may further carry an identity identifier of the client;
[0112] Accordingly, after receiving the target query request, refer to Figure 4 As shown, when the method is implemented specifically, it may also include the following contents:
[0113] S1: According to the identification information of the target API, query the verification subtable in the metadata table to determine whether there is a target verification rule corresponding to the target API;
[0114] S2: When it is determined that there is a target verification rule, obtain and perform a query permission check on the target query request using the client's identity according to the target verification rule to obtain a permission check result; at the same time, perform an integrity check on the target query request using the query parameters according to the target verification rule to obtain an integrity check result;
[0115] S3: According to the target verification rule, the permission verification result and the integrity verification result are combined to determine whether the target query request has passed the verification;
[0116] S4: When it is determined that the target query request fails to pass the verification, a first error message about the target query request is fed back to the client.
[0117] In specific implementation, after receiving the target query request, the verification subtable in the metadata table can be searched first to determine whether there is identification information of the target API; if the identification information of the target API is not found, it can be determined that the target query request does not need to be verified.
[0118] On the contrary, when the identification information of the target API is searched, it is determined that the target query request needs to be verified. At this time, the metadata table can be queried according to the identification information of the target API to obtain the target verification rules corresponding to the identification information of the target API; wherein the target verification rules can specifically include: query permission verification rules and integrity verification rules.
[0119] In specific implementation, the platform user database can be queried based on the client's identity identification to obtain the client's identity data (for example, the job level, occupation, user tag, etc. of the user who logged in to the client); then, based on the permission verification rules and the client's identity data, it can be verified whether the user who logged in to the client has the authority to query the target business indicator, and the query permission verification of the target query request can be implemented to obtain the corresponding permission verification result. At the same time, according to the integrity verification rules, through parameter matching, it can be detected whether the query parameters contain the parameter information necessary for querying the target business indicator, and the integrity verification of the target query request can be implemented to obtain the corresponding integrity verification result.
[0120] Then, according to the target verification rule, the permission verification result and the integrity verification result are used together. If it is determined that the permission verification has passed and the integrity verification has passed, it is determined that the target query request has passed the verification; and further processing of the target query request can be triggered. Otherwise, it is determined that the target query request has not passed the verification; at this time, the first error prompt about the target query request can be fed back to the client.
[0121] The first error message may include the reason why the verification failed, including: permission verification failed and / or integrity verification failed.
[0122] Based on the above embodiment, before responding to a target query request, the target query request can be verified to ensure that the target query request is safe and accurate, thereby avoiding subsequent unauthorized queries or query failures.
[0123] In some embodiments, the query parameter may also include at least one of the following: a time parameter, a granularity parameter, an indicator identifier of a key indicator, and the like.
[0124] Specifically, for example, when a user wants to query the indicator value of the target business indicator from 2019 to 2023, the time parameter identifier "T" can be used to add the following time parameter "T: 2019-2023" in the query parameters in the following manner. For another example, when a user wants to query the indicator evaluation results of the target business indicator of Bank A, the granularity parameter identifier "L" can be used to add the following granularity parameter "L: A" in the query parameters in the following manner. For another example, when a user wants to query the indicator value of the subordinate indicator (for example, indicator T-102) of interest when calculating the target business indicator, the indicator identifier "V" of the key indicator can be used to add the indicator identifier of the key indicator "V: T-102" in the query parameters in the following manner.
[0125] In addition to the query parameters listed above, other types of query parameters such as display method parameters, business field parameters, etc. may also be included according to specific application scenarios and processing requirements. This specification does not limit this.
[0126] In some embodiments, see Figure 5 As shown, the above-mentioned calling API query engine executes the second API script, obtains the corresponding target business data from the second database based on the metadata table; and calculates the target query result about the target business indicator and matching the query type parameter according to the target business data. When implemented specifically, it may include the following contents:
[0127] S1: calling an API query engine to execute a second API script to determine indicator identifiers of multiple subordinate indicators of a target business indicator;
[0128] S2: According to the indicator identifier of the subordinate indicator, query the metadata table to determine the final indicator and the intermediate indicator from multiple subordinate indicators;
[0129] S3: Based on the metadata table, obtain and obtain corresponding target business data from the second database according to the calculation rules of the final-level indicators;
[0130] S4: Calculate and use the indicator value of the final indicator according to the calculation rule of the final indicator and the target business data to obtain the evaluation value of the final indicator;
[0131] S5: Based on the metadata table, obtain and according to the construction rules of the target business indicators and the construction rules of the intermediate indicators, use the evaluation value of the final indicator and the corresponding weight coefficient, and calculate level by level to obtain the target query result about the target business indicator and matching the query type parameter.
[0132] During specific implementation, by calling the API query engine to execute the second API script, the indicator value of each final-level indicator can be calculated based on the target business data and the calculation rules of the final-level indicators; and according to the calculation rules of the final-level indicators, the evaluation value of the final-level indicator (for example, the indicator score of the final-level indicator) is calculated based on the indicator value of each final-level indicator.
[0133] Furthermore, according to the hierarchical relationship of the target business indicators based on the tree structure, from the lowest level upwards, according to the construction rules of the intermediate indicators, using the evaluation values of the final-level indicators and combining the corresponding weight coefficients, the evaluation values of the intermediate indicators of each level are gradually calculated, and finally the evaluation value of the target business indicator is calculated.
[0134] Finally, by executing the relevant result processing statements in the second API script, the evaluation value of the target business indicator is processed to obtain the target query result corresponding to the query type parameter and related to the target business indicator.
[0135] Based on the above embodiments, target query results that meet user needs can be automatically calculated efficiently and accurately.
[0136] In some embodiments, the method may further include the following when implemented:
[0137] S1: Receive a target API generation request; wherein the target API generation request carries at least identification information of the target API and an indicator identifier of a target business indicator associated with the target API;
[0138] S2: respond to the target API generation request, configure the construction rule for generating the target business indicator according to the indicator identifier of the target business indicator; and store the construction rule of the target business indicator in the metadata table; wherein the construction rule includes the indicator identifier of the subordinate indicator related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicator, and the weight coefficient of the subordinate indicator;
[0139] S3: Determine a matching script configuration template according to the construction rules of the target business indicator; wherein the script configuration template at least includes a matching template statement;
[0140] S4: According to the metadata table, determine the construction rules of the subordinate indicators;
[0141] S5: jointly use the construction rules of the target business indicator, the construction rules of the subordinate indicator, and the script configuration template to construct a corresponding preset API script;
[0142] S6: Store the preset API script in the first database; and update the metadata table.
[0143] In specific implementation, the business end can initiate a request to the server about the target API generation based on business needs or user feedback to quickly establish and generate the target API for the target business indicator. Figure 2 shown.
[0144] The above-mentioned business end can be understood as a front end that is deployed on the side of the business personnel (for example, the platform service provider) and can realize functions such as data collection and data transmission. Specifically, the client can be, for example, an electronic device such as a desktop computer, a tablet computer, a laptop computer, a smart phone, etc. Alternatively, the client can also be a software application that can run in the above-mentioned electronic device.
[0145] The target API generation request may also carry configuration data about target business indicators set by business personnel.
[0146] Specifically, the configuration data may include indicator identifiers of subordinate indicators used when calculating target business indicators, and configuration parameters for indicating the hierarchical relationship between the target business indicator and the subordinate indicators, and weight coefficients of the subordinate indicators.
[0147] In the case where the subordinate indicators used are business indicators already available on the transaction service platform, the above configuration data may only include the indicator identifiers of the subordinate indicators of the next level adjacent to the target business indicator, and the weight coefficients of the above subordinate indicators. Accordingly, the server may query the metadata table based on the indicator identifiers of the above subordinate indicators, obtain and automatically sort out and determine the indicator identifiers, hierarchical relationships, and weight coefficients of other subordinate indicators based on the construction rules of each subordinate indicator.
[0148] In some cases, the target API request may also carry a business description text of the target business indicator by the business personnel. Accordingly, the server can use a pre-trained configuration model based on deep learning, and automatically determine the subordinate indicators used to calculate the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicators, and the weight coefficients of the subordinate indicators according to the business description text and the metadata table, and obtain and output the corresponding configuration data. The configuration model is connected to the metadata table.
[0149] In specific implementation, the server may automatically configure and generate the construction rules of the target business indicator according to the configuration data about the target business indicator; and bind the construction rules of the target business indicator with the indicator identifier of the target business indicator and store them in the metadata table.
[0150] In specific implementation, the matching degree between the construction rule and each preset script configuration template in the preset script library can be calculated according to the construction rule of the target business indicator; according to the matching degree, the preset script configuration template with the highest matching degree is screened out as the matching script configuration template.
[0151] The pre-set script library stores a plurality of preset script configuration templates. Specifically, the preset script configuration templates may include corresponding template statements, including relevant basic SQL statements, such as Select statements, Where conditional statements, and the like.
[0152] Before specific implementation, a large number of historical API scripts can be obtained first; a large number of historical API scripts can be clustered to obtain multiple corresponding code data groups, each code data group containing common code fragments; based on the multiple code data groups, historical API scripts corresponding to each code data group and representative can be screened out from the historical API scripts as corresponding sample API scripts; based on the sample API scripts and the corresponding code data groups, multiple preset script configuration templates can be constructed; and then multiple preset script configuration templates can be combined to obtain a corresponding preset script library.
[0153] In specific implementation, the construction rules of the target business indicator, the construction rules of the lower-level indicators, and the calculation rules of the final-level indicators can be used together to sort out the complete calculation logic based on the tree structure for calculating the target business indicator; then, according to the calculation logic, the script configuration template is adaptively adjusted and modified to obtain the preset API script corresponding to the target business indicator. After binding the preset API script with the target API identification information, it is stored in the first database; and the storage index of the preset script based on the first database is obtained; at the same time, the identification information of the target API and the storage index of the preset script are added to the metadata table; and the corresponding relationship between the identification information of the target API and the storage index of the preset script is established to complete the update of the metadata table. In this way, when the target business indicator is calculated by executing the preset API later, it can be based on the tree structure, starting from the final indicator at the lowest level leaf node, and calculating upward layer by layer until the target business indicator of the root node at the highest level is calculated.
[0154] Based on the above embodiment, the server can respond to the target API generation request initiated by the business end, and automatically generate the target API associated with the target business indicator efficiently and accurately.
[0155] In some embodiments, after the corresponding preset API script is constructed, the method may further include the following when implemented:
[0156] S1: Based on the second database, obtain simulation data about the preset API script;
[0157] S2: Use the simulated data to perform a simulated test on the preset API script to obtain the simulated test results;
[0158] S3: Determine whether the preset API script passes the test based on the simulation test results;
[0159] S4: When it is determined that the preset API test has passed, the target API is released for use by the client.
[0160] In specific implementation, the second database can be searched first to find business data related to the execution of the preset API script as sample business data. Further, data fitting is performed based on the sample business data to obtain simulation data with a large amount of data for simulation testing. Then, the simulation test data is used to perform simulation testing on the target API with a large amount of data to obtain corresponding simulation test results.
[0161] According to the simulation test results, if the preset API test is confirmed to have passed, the target API can be released online on the trading service platform. In this way, the client can initiate a query request about the target business indicator by calling the above target API.
[0162] On the contrary, based on the simulation test results, if it is determined that the preset API test has not passed, the test records of the preset API can be queried; and the test records can be analyzed to determine the cause of the problem that caused the test to fail; and then the problematic code segment can be located in the preset API script based on the cause of the problem; and after making targeted adjustments and modifications to the problematic code segment, the simulation test can be re-performed until the test passes.
[0163] Based on the above embodiments, simulation tests can be used to effectively ensure that the target API published to the outside is stable and reliable.
[0164] In some embodiments, the target API generation request may also carry a verification indication.
[0165] Correspondingly, after constructing the corresponding preset API script, you can also respond to the verification instruction to obtain the target verification rules for the target API; store the identification information and target verification rules of the target API in the verification subtable in the metadata table, and establish a correspondence between the identification information of the target API and the target verification rules to complete the update of the verification subtable.
[0166] Specifically, the target API generation request may also carry a verification rule customized by the business end. Accordingly, the verification rule carried by the target API generation request may be parsed and obtained as the target verification rule for the target API.
[0167] In addition, it is also possible to respond to the verification instruction, obtain and comprehensively determine the authority level of the target business indicator based on the indicator identifier of the target business indicator and the indicator identifier of the subordinate indicator related to the target business indicator; then, based on the authority level of the target business indicator, determine the preset query authority verification rule that matches the authority level of the target business indicator from multiple preset query authority verification rules as the target query authority verification rule. Among them, multiple preset query authority verification rules are pre-configured, and each preset query authority verification rule corresponds to at least one authority level. At the same time, it is also possible to determine the parameter information necessary for querying the target business indicator based on the preset API script; then, based on the above necessary parameter information, determine the corresponding target integrity verification rule. Finally, the above target query authority verification rule and target integrity verification rule are combined to obtain the target verification rule for the target API.
[0168] After the target verification rule is generated, the identification information of the target API and the target verification rule can be stored in the verification subtable in the metadata table, and a correspondence between the identification information of the target API and the target verification rule can be established in the table to update the metadata table.
[0169] Based on the above embodiment, after constructing the target API, you can also customize and generate and store the target verification rules corresponding to the target API, so that before calling the target API in response to the target query request, you can first verify the target query request according to the target verification rules to ensure the security of the data, and at the same time avoid query failures due to lack of necessary parameter information when calling the target API to execute the corresponding API script, thereby affecting the user's query experience.
[0170] As can be seen from the above, the query method of the business indicator provided by the embodiment of this specification, before the specific implementation, receives and responds to the target API generation request initiated by the business end, automatically configures the construction rules, script configuration templates, and construction rules of subordinate indicators associated with the target business indicators; then the construction rules of the target business indicators, the construction rules of the subordinate indicators, and the script configuration template are used together to automatically construct the corresponding preset API script, and the automatic generation of the API is realized efficiently and conveniently. In the specific implementation, the target query request initiated by the client based on the target API is received and responded to, and the matching first API script is determined from the first database according to the identification information of the target API and the metadata table; at the same time, according to the query type parameter, the matching result processing statement template is determined from the first database; then according to the query parameter and the result processing statement template, the first API script is adjusted to obtain the corresponding second API script; the API query engine is called to execute the second API script, and the corresponding target business data is obtained from the second database based on the metadata table; and the target query result about the target business indicator and matching the query type parameter is calculated according to the target business data; the target query result is fed back to the client, and the generated API is used to quickly and accurately realize the result query about the business indicator. This can effectively reduce the difficulty of related operations, efficiently and conveniently complete the generation of query APIs for business indicators, as well as API-based business indicator-related queries, and improve overall data processing efficiency.
[0171] See also Figure 6 As shown, the embodiment of this specification also provides a method for generating a query API for a business indicator. The method may include the following contents when implemented:
[0172] S601: Receive a target API generation request; wherein the target API generation request carries at least identification information of the target API and an indicator identifier of a target business indicator associated with the target API;
[0173] S602: In response to the target API generation request, according to the indicator identifier of the target business indicator, configure a construction rule for generating the target business indicator; and store the construction rule of the target business indicator in the metadata table; wherein the construction rule includes the indicator identifier of the subordinate indicator related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicator, and the weight coefficient of the subordinate indicator;
[0174] S603: Determine a matching script configuration template according to the construction rule of the target business indicator; wherein the script configuration template at least includes a matching template statement;
[0175] S604: Determine the construction rules of the subordinate indicators according to the metadata table;
[0176] S605: jointly using the construction rules of the target business indicator, the construction rules of the subordinate indicators, and the script configuration template to construct a corresponding preset API script;
[0177] S606: Store the preset API script in the first database; and update the metadata table.
[0178] Based on the above embodiment, the target API generation request initiated by the business end can be well responded to, and a target API that meets the requirements can be automatically and efficiently generated to facilitate users to query relevant data of target business indicators through the client.
[0179] This specification embodiment provides a server, referring to Figure 7 The server includes a network communication port 701, a processor 702 and a memory 703, and the above structures are connected through internal cables so that each structure can perform specific data interaction.
[0180] Among them, the network communication port 701 can be specifically used to receive a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; and the query parameters include at least a query type parameter.
[0181] The processor 702 can be specifically used to respond to a target query request, and determine a matching preset API script as a first API script from a first database according to identification information of a target API and a metadata table; wherein the first database stores at least a plurality of preset API scripts; the metadata table is associated with the first database; according to a query type parameter, a matching result processing statement template is determined from the first database; according to the query parameter and the result processing statement template, the first API script is adjusted to obtain a corresponding second API script; an API query engine is called to execute the second API script, and corresponding target business data is obtained from the second database based on the metadata table; and a target query result about a target business indicator and matching the query type parameter is calculated according to the target business data; wherein the second database stores at least business data; and the target query result is fed back to the client.
[0182] The memory 703 may be specifically used to store corresponding instruction programs, as well as metadata tables, the first database, the second database and other related data.
[0183] Based on the above method, the relevant structural performance of the server can be effectively utilized, the data processing speed of the electronic device can be improved, and the data processing of the query of the business indicator can be efficiently realized.
[0184] In this embodiment, the network communication port 701 can be a virtual port that is bound to different communication protocols so that different data can be sent or received. For example, the network communication port can be a port responsible for web data communication, a port responsible for FTP data communication, or a port responsible for email data communication. In addition, the network communication port can also be a physical communication interface or communication chip. For example, it can be a wireless mobile network communication chip, such as GSM, CDMA, etc.; it can also be a Wifi chip; it can also be a Bluetooth chip.
[0185] In this embodiment, the processor 702 may be implemented in any appropriate manner. For example, the processor may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) executable by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, etc. This specification does not limit this.
[0186] In this embodiment, the memory 703 may include multiple levels. In a digital system, anything that can store binary data can be a memory; in an integrated circuit, a circuit with a storage function that has no physical form is also called a memory, such as RAM, FIFO, etc.; in a system, a storage device with a physical form is also called a memory, such as a memory stick, TF card, etc.
[0187] The embodiment of the present specification also provides a computer-readable storage medium for a query method based on the above-mentioned business indicators, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed, the following are achieved: receiving a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; the query parameters at least include query type parameters; responding to the target query request, determining a matching preset API script as a first API script from a first database according to the identification information of the target API and a metadata table; wherein the first database stores at least a plurality of preset API scripts; the metadata table is associated with the first database; determining a matching result processing statement template from the first database according to the query type parameter; adjusting the first API script according to the query parameters and the result processing statement template to obtain a corresponding second API script; calling an API query engine to execute the second API script, and obtaining corresponding target business data from the second database based on the metadata table; and calculating a target query result about the target business indicator and matching the query type parameter according to the target business data; wherein the second database stores at least business data; and feeding back the target query result to the client.
[0188] The embodiment of the present specification also provides a computer-readable storage medium for a method for generating a query API based on a business indicator, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed, the following are implemented: receiving a target API generation request; wherein the target API generation request carries at least identification information of the target API and an indicator identifier of a target business indicator associated with the target API; responding to the target API generation request, configuring a construction rule for generating the target business indicator according to the indicator identifier of the target business indicator; and storing the construction rule of the target business indicator in a metadata table; wherein the construction rule includes an indicator identifier of a subordinate indicator related to the target business indicator, a hierarchical relationship between the target business indicator and the subordinate indicator, and a weight coefficient of the subordinate indicator; determining a matching script configuration template according to the construction rule of the target business indicator; wherein the script configuration template includes at least a matching template statement; determining a construction rule of the subordinate indicator according to the metadata table; jointly using the construction rule of the target business indicator, the construction rule of the subordinate indicator, and the script configuration template to construct a corresponding preset API script; storing the preset API script in a first database; and updating the metadata table.
[0189] In this embodiment, the storage medium includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a cache, a hard disk (HDD), or a memory card. The memory may be used to store computer program instructions. The network communication unit may be an interface for network connection communication set in accordance with the standard specified by the communication protocol.
[0190] In this embodiment, the functions and effects specifically implemented by the program instructions stored in the computer-readable storage medium can be explained in comparison with other implementations and will not be described in detail here.
[0191] The embodiment of the present specification also provides a computer program product, which at least includes a computer program, and when the computer program is executed by a processor, it implements the following method steps: receiving a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; the query parameters at least include a query type parameter; responding to the target query request, determining a matching preset API script as a first API script from a first database according to the identification information of the target API and a metadata table; wherein the first database stores at least a plurality of preset API scripts; the metadata table is associated with the first database; according to the query type parameter, determining a matching result processing statement template from the first database; according to the query parameter and the result processing statement template, adjusting the first API script to obtain a corresponding second API script; calling an API query engine to execute the second API script, and obtaining corresponding target business data from the second database based on the metadata table; and calculating a target query result about the target business indicator and matching the query type parameter according to the target business data; wherein the second database stores at least business data; and feeding back the target query result to the client.
[0192] The embodiment of the specification also provides another computer program product, which at least includes a computer program, and when the computer program is executed by a processor, it implements the following method steps: receiving a target API generation request; wherein the target API generation request carries at least identification information of the target API and the indicator identification of the target business indicator associated with the target API; responding to the target API generation request, configuring a construction rule for generating the target business indicator according to the indicator identification of the target business indicator; and storing the construction rule of the target business indicator in a metadata table; wherein the construction rule includes the indicator identification of the subordinate indicator related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicator, and the weight coefficient of the subordinate indicator; determining a matching script configuration template according to the construction rule of the target business indicator; wherein the script configuration template at least includes a matching template statement; determining the construction rule of the subordinate indicator according to the metadata table; jointly using the construction rule of the target business indicator, the construction rule of the subordinate indicator, and the script configuration template to construct a corresponding preset API script; storing the preset API script in the first database; and updating the metadata table.
[0193] See also Figure 8 As shown, the embodiment of this specification also provides a device for querying business indicators, which may specifically include the following structural modules:
[0194] The receiving module 801 may be specifically configured to receive a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; and the query parameters include at least a query type parameter;
[0195] The first determination module 802 may be specifically configured to respond to a target query request and determine a matching preset API script from a first database as a first API script according to identification information of a target API and a metadata table; wherein the first database stores at least a plurality of preset API scripts; and the metadata table is associated with the first database;
[0196] The second determination module 803 may be specifically configured to determine a matching result processing statement template from the first database according to the query type parameter;
[0197] The adjustment module 804 may be specifically used to adjust the first API script according to the query parameter and the result processing statement template to obtain a corresponding second API script;
[0198] The execution module 805 may be specifically used to call the API query engine to execute the second API script, obtain the corresponding target business data from the second database based on the metadata table; and calculate the target query result about the target business indicator and matching the query type parameter according to the target business data; wherein the second database at least stores the business data;
[0199] The feedback module 806 may be specifically configured to feed back the target query result to the client.
[0200] In some embodiments, the above-mentioned query type parameters may specifically include at least one of the following: an indicator value query identifier, an indicator evaluation result query identifier, an indicator calculation detail query identifier, etc.
[0201] In some embodiments, the target query request also carries an identity identifier of the client;
[0202] Correspondingly, after receiving the target query request, when the device is specifically implemented, it can also be used to: query the verification subtable in the metadata table according to the identification information of the target API to determine whether there is a target verification rule corresponding to the target API; when it is determined that there is a target verification rule, obtain and perform a query permission check on the target query request using the client's identity according to the target verification rule to obtain a permission check result; at the same time, according to the target verification rule, perform an integrity check on the target query request using the query parameters to obtain an integrity check result; according to the target verification rule, jointly use the permission check result and the integrity check result to determine whether the target query request has passed the verification; when it is determined that the target query request has not passed the verification, feedback a first error prompt about the target query request to the client.
[0203] In some embodiments, the query parameter may also include at least one of the following: a time parameter, a granularity parameter, an indicator identifier of a key indicator, and the like.
[0204] In some embodiments, when the above-mentioned execution module 805 is specifically implemented, the API query engine can be called to execute the second API script in the following manner to obtain the corresponding target business data from the second database based on the metadata table; and the target query result about the target business indicator and matching the query type parameter is calculated based on the target business data: calling the API query engine to execute the second API script, and determining the indicator identifiers of multiple subordinate indicators about the target business indicator; querying the metadata table according to the indicator identifiers of the subordinate indicators, and determining the final indicator and the intermediate indicator from the multiple subordinate indicators; based on the metadata table, obtaining and obtaining the corresponding target business data from the second database according to the calculation rules of the final indicator; calculating and using the indicator value of the final indicator according to the calculation rules of the final indicator and the target business data, and calculating the evaluation value of the final indicator; based on the metadata table, obtaining and using the evaluation value of the final indicator according to the construction rules of the target business indicator and the construction rules of the intermediate indicators, and the corresponding weight coefficient, through layer-by-layer calculation, obtaining the target query result about the target business indicator and matching the query type parameter.
[0205] In some embodiments, when the above-mentioned device is implemented, it can also be used to: receive a target API generation request; wherein the target API generation request carries at least the identification information of the target API and the indicator identification of the target business indicator associated with the target API; respond to the target API generation request, and configure the construction rules for generating the target business indicator according to the indicator identification of the target business indicator; and store the construction rules of the target business indicator in the metadata table; wherein the construction rules include the indicator identification of the subordinate indicators related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicators, and the weight coefficient of the subordinate indicators; according to the construction rules of the target business indicator, determine a matching script configuration template; wherein the script configuration template at least includes a matching template statement; according to the metadata table, determine the construction rules of the subordinate indicators; jointly use the construction rules of the target business indicator, the construction rules of the subordinate indicators, and the script configuration template to construct a corresponding preset API script; store the preset API script in the first database; and update the metadata table.
[0206] In some embodiments, after the corresponding preset API script is constructed, the device can also be used when it is implemented to: obtain simulation data about the preset API script based on a second database; use the simulation data to perform simulation testing on the preset API script to obtain simulation test results; determine whether the preset API script has passed the test based on the simulation test results; if it is determined that the preset API test has passed, publish the target API for the client to use.
[0207] This specification also provides a device for generating a query API for a business indicator, which may specifically include the following structural modules:
[0208] The receiving module may be specifically used to receive a target API generation request; wherein the target API generation request carries at least identification information of the target API and an indicator identification of a target business indicator associated with the target API;
[0209] The configuration module can be specifically used to respond to the target API generation request, configure the construction rules for generating the target business indicator according to the indicator identifier of the target business indicator; and store the construction rules of the target business indicator in the metadata table; wherein the construction rules include the indicator identifier of the subordinate indicator related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicator, and the weight coefficient of the subordinate indicator;
[0210] The first determination module may be specifically used to determine a matching script configuration template according to the construction rule of the target business indicator; wherein the script configuration template at least includes a matching template statement;
[0211] The second determination module can be specifically used to determine the construction rules of the subordinate indicators according to the metadata table;
[0212] The construction module can be used to jointly use the construction rules of the target business indicators, the construction rules of the subordinate indicators, and the script configuration template to construct the corresponding preset API script;
[0213] The update module can be specifically used to store the preset API script into the first database; and update the metadata table.
[0214] It should be noted that the units, devices or modules described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described separately by functions divided into various modules. Of course, when implementing this specification, the functions of each module can be implemented in the same or more software and / or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0215] It can be seen from the above that the device for generating a query API for business indicators provided in the embodiments of this specification can effectively reduce the difficulty of related operations, efficiently and conveniently complete the generation of query APIs for business indicators, and improve the overall data processing efficiency.
[0216] In a specific scenario example, the business indicator query method and business indicator query API generation method provided in this specification can be applied to realize configuration-based automatic API generation. The specific implementation process can be found in the following content.
[0217] In this scenario example, considering the conventional method, developers are required to develop API interfaces such as indicator score query (e.g., indicator evaluation result query), indicator value query (e.g., indicator value query) and indicator detail query (e.g., indicator calculation detail query) for each final indicator, and develop score query API interfaces for non-final indicators. However, with the need for indicator calculation, the increase in the number of indicators, and the change in the indicator level, this method becomes inefficient and difficult to maintain.
[0218] In order to improve development efficiency and flexibility, a configuration-based automatic API generation method is proposed in this scenario example. Based on this method, the management end can configure the indicator scoring rules, weights, detailed physical tables, statistical data physical tables (for example, metadata tables, etc.) and other information to automatically generate the relevant indicator detail query API, indicator value query API, and indicator score query API. The application only needs to pass in parameters and query conditions, and the API will automatically return the indicator details, indicator scores, indicator values and other results based on the parameters. This process reduces manual coding and improves the scalability and reliability of the system.
[0219] Specifically, for business indicator query scenarios, in order to construct and use an operational indicator (e.g., a target business indicator) to evaluate the capabilities of a business department in a certain area (e.g., evaluating the operation and maintenance capabilities of a data center), refer to Fig. 9 As shown, a corresponding system framework can be constructed, wherein the system framework at least includes three parts: application layer, platform layer, and data storage layer.
[0220] The platform layer may include: a metadata management module (e.g., a metadata table), an API module (e.g., an API query engine), and an indicator management module. Further, the metadata management module may include at least: a data source management unit and a library table management unit. The indicator management module may include at least: an indicator configuration unit and an indicator API configuration unit.
[0221] The above-mentioned indicator management module is used to cooperate with the business end to complete relevant configurations and generate corresponding rules (for example, construction rules, verification rules, etc.); the above-mentioned metadata management module is used to store and call configurations to generate corresponding rules, and at the same time connect to the data storage layer to retrieve or store relevant data.
[0222] The data storage layer may include: a database (eg, a first database) and a data warehouse (eg, a second database). The database is used to store scripts, statement codes, templates and other data. The data warehouse is used to store business data.
[0223] Specifically, for example, the metadata management module can be used to manage the structural information, field attributes, relationship mapping, etc. of the library table; the indicator management module can be used to configure the indicator code, name, parent indicator (the indicator of the upper level constructed by the lower-level indicators), indicator scoring calculation rules (for example, indicator evaluation rules), indicator weight, etc.; and according to the indicator configuration and API query engine, instantiate the indicator query API and other operations; use the API query engine to respond to and process query requests from the client, complete the call and execution of the relevant API, and obtain the query results required by the client.
[0224] In specific implementation, based on the indicator management module, basic information such as indicator code (e.g., indicator identifier of business indicator), name, unit, granularity (e.g., granularity parameter) can be configured; the indicator hierarchy (e.g., hierarchical relationship), parent indicator, indicator score calculation rules, indicator weight (e.g., weight coefficient), etc. can be configured; the physical table for indicator storage and the physical table for indicator detail data storage can be configured. Specifically, developers (e.g., business personnel) can use the above indicator management module to define indicator score query API, indicator value query API, and indicator detail query API on the platform.
[0225] Among them, the indicator definition table, indicator hierarchy table, and indicator API configuration table defined and set by developers based on the indicator management module can refer to the relevant contents of Table 1, Table 2, and Table 3 respectively.
[0226] Table 1
[0227] Indicator Code Indicator English name Indicator Chinese name ...... Is it the final level?
[0228] Table 2
[0229] Indicator Code Parent node indicator Scoring Rules Weight
[0230] Table 3
[0231]
[0232] Specifically, taking the three-level indicator system as an example, the third-level indicator is the final indicator, which has two attributes: indicator value and indicator score. It can convert the indicator value into an indicator score through custom rules. For example, if the indicator value exceeds 0.9, it is 100 points, if it is between 0.8 and 0.9, it is 90 points, and so on. Secondary indicators and primary indicators are non-final indicators, and only have the attribute of indicator score. The indicator score of each level is the indicator score obtained by processing and calculating the score of the next level with a certain weight (such as a1 score = a11 score * a11 weight + a12 score * a12 weight).
[0233] In specific implementation, based on the metadata management module, database connection can be performed: configure the database connection information involved, etc.; data dictionary management can be performed: collect and maintain the structural information of all database tables, etc.; detailed information such as field type, length, default value, etc. can be provided; field attribute management can be performed: allow configuration of detailed attributes of the field, such as whether it can be empty, data format, etc.; custom field annotation can be performed to generate API documentation and verification rules; metadata can be dynamically updated: automatically identify database structure changes and update metadata; and a visual interface can be supported: a graphical interface is provided to facilitate users to view and manage metadata.
[0234] For specific implementation, based on the API query engine, refer to Fig.10 As shown, the pre-generated API script can be used to query and feed back results (eg, target query results).
[0235] Specifically, taking the two-level indicator system as an example, data processing using the API query engine may include the following:
[0236] S1: Application request: The application sends a request to calculate the department's Level 1 indicator score.
[0237] S2: Parameter verification: Verify that the parameters are compliant.
[0238] S3: Parse and extract parameters: extract parameters such as "indicator code" and "API type".
[0239] S4: According to the “indicator code” and “API type”, extract the corresponding level 2 indicator list (e.g., construction rules).
[0240] S5: According to the list of level 2 indicators, obtain the score query API and weight of each indicator.
[0241] S6: Calculate the level 1 indicator score = level 2 indicator score * sum of weights.
[0242] S7: Return result: Return the score of level 1 indicator.
[0243] For specific implementation, based on the indicator management module, see Fig.11 As shown, a template (e.g., a script configuration template, etc.) can be used to complete the configuration and generation of the API. Specifically, the following contents may be included:
[0244] (1) Indicator configuration
[0245] Specifically, it may include: configuring basic information of indicators: code, name, parent indicator; configuring indicator scoring rules, indicator weight; configuring indicator storage: indicator scoring table, indicator value table.
[0246] (2) API Configuration
[0247] Among them, regarding the scoring API configuration, it can specifically include: selecting indicators: the user selects the [XX] indicator; selecting a new API: the user clicks the "New API" button and selects the "Score" type; selecting scoring rules: select a scoring rule template and fill in scoring parameters; defining input / output: adding optional query conditions and outputs, and setting default sorting and paging rules.
[0248] In specific implementation, relevant code statements, such as the generation process of SQL statements, can be implemented in a templated manner, including: generating basic SELECT statements based on configured table and field information; dynamically splicing WHERE clauses if there are query conditions; and using optional sorting and paging mechanisms to improve query efficiency and response speed.
[0249] (3) Testing API
[0250] Specifically, it may include: selecting an API for testing: the user selects a configured API on the platform; entering test parameters: providing simulated input data and query conditions; viewing results: the system executes the query and returns the results.
[0251] (4) Publishing API
[0252] Specifically, it can include: selecting API for publishing: clicking the "Publish" button; confirming the publishing information: the system displays the publishing information for the user to confirm; notifying relevant users: the system automatically notifies authorized users.
[0253] (5) Application call
[0254] Specifically, it can include: client application requests API: input indicators, API type and conditions; API engine processes the request: verifies permissions and parameters. According to the indicators and API type, obtains the corresponding API; returns the result: formats the result and returns it to the client application. And records the call log.
[0255] Through the above interactive process, the system realizes the efficient configuration, testing, release and management of indicator query API, ensuring a smooth, safe and reliable user experience.
[0256] Through the above scenario examples, the query method of business indicators and the generation method of query API for business indicators provided in this specification are verified. The configuration-based automatic API generation solution simplifies the API development process and improves the response speed and system flexibility. Through the dynamic SQL generation engine and management platform, developers only need to focus on business logic, realizing the decoupling of code and configuration. In general, there are the following advantages: efficient development: reduce manual coding, configure once and reuse; flexible expansion: no need to change the code, adapt to changes in business logic through the management platform; easy maintenance: separation of configuration and logic, clear management interface reduces maintenance costs.
[0257] Although the present specification provides method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent a unique execution order. When the device or client product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. The first, second, etc. words are used to represent the name, and do not represent any particular order.
[0258] Those skilled in the art also know that, in addition to implementing the controller in a purely computer-readable program code, the controller can be made to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules for implementing the method and structures within the hardware component.
[0259] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer-readable storage media including storage devices.
[0260] Through the description of the above embodiments, it can be known that those skilled in the art can clearly understand that the present specification can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present specification can essentially be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in each embodiment of the present specification or some parts of the embodiments.
[0261] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. This specification can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0262] Although the present specification is described through embodiments, those skilled in the art will appreciate that there are many modifications and changes to the present specification without departing from the spirit of the present specification, and it is intended that the appended claims include these modifications and changes without departing from the spirit of the present specification.
Claims
1. A method for querying business indicators, characterized in that: Applicable to servers, including: Receive a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; the query parameters at least include a query type parameter; In response to the target query request, according to the identification information of the target API and the metadata table, a matching preset API script is determined from the first database as the first API script; wherein the first database stores at least a plurality of preset API scripts; and the metadata table is associated with the first database; According to the query type parameter, determining a matching result processing statement template from the first database; According to the query parameters and the result processing statement template, the first API script is adjusted to obtain a corresponding second API script; Calling the API query engine to execute the second API script, obtaining corresponding target business data from the second database based on the metadata table; and calculating and obtaining a target query result about the target business indicator and matching the query type parameter according to the target business data; wherein the second database at least stores the business data; Feedback the target query result to the client.
2. The method according to claim 1, characterized in that The query type parameter includes at least one of the following: an indicator value query identifier, an indicator evaluation result query identifier, and an indicator calculation detail query identifier.
3. The method according to claim 1, characterized in that The target query request also carries the identity of the client; Accordingly, after receiving the target query request, the method further includes: According to the identification information of the target API, query the verification subtable in the metadata table to determine whether there is a target verification rule corresponding to the target API; In the case where it is determined that there is a target verification rule, obtaining and performing a query permission check on the target query request using the identity identifier of the client according to the target verification rule, and obtaining a permission check result; at the same time, performing an integrity check on the target query request using the query parameters according to the target verification rule, and obtaining an integrity check result; According to the target verification rules, the permission verification result and the integrity verification result are used together to determine whether the target query request has passed the verification; When it is determined that the target query request fails to pass the verification, a first error message about the target query request is fed back to the client.
4. The method according to claim 1, characterized in that The query parameters also include at least one of the following: a time parameter, a granularity parameter, and an indicator identifier of a key indicator.
5. The method according to claim 1, characterized in that Calling the API query engine to execute the second API script, and obtaining corresponding target business data from the second database based on the metadata table; And the target query results about the target business indicators and matching the query type parameters are calculated based on the target business data, including: Calling an API query engine to execute a second API script to determine indicator identifiers of multiple subordinate indicators of the target business indicator; According to the indicator identifier of the subordinate indicator, the metadata table is queried to determine the final indicator and the intermediate indicator from multiple subordinate indicators; Based on the metadata table, obtain and obtain corresponding target business data from the second database according to the calculation rules of the final level indicators; According to the calculation rules of the final-level indicators and the target business data, the indicator value of the final-level indicators is calculated and used to calculate the evaluation value of the final-level indicators; Based on the metadata table, the target query results about the target business indicators and matching the query type parameters are obtained by obtaining and calculating the target business indicators and the intermediate indicators according to the construction rules of the target business indicators and the construction rules of the intermediate indicators, using the evaluation values of the final indicators and the corresponding weight coefficients.
6. The method according to claim 1, characterized in that The method further comprises: Receive a target API generation request; wherein the target API generation request carries at least identification information of the target API and an indicator identifier of a target business indicator associated with the target API; In response to the target API generation request, according to the indicator identifier of the target business indicator, a construction rule for generating the target business indicator is configured; and the construction rule of the target business indicator is stored in the metadata table; wherein the construction rule includes the indicator identifier of the subordinate indicator related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicator, and the weight coefficient of the subordinate indicator; According to the construction rules of the target business indicators, a matching script configuration template is determined; wherein the script configuration template at least includes a matching template statement; According to the metadata table, determine the construction rules of the subordinate indicators; The construction rules of the target business indicators, the construction rules of the subordinate indicators, and the script configuration template are used together to construct the corresponding preset API script; The preset API script is stored in the first database; and the metadata table is updated.
7. The method according to claim 6, characterized in that After constructing the corresponding preset API script, the method further includes: Based on the second database, obtaining simulation data about the preset API script; Use simulated data to simulate the preset API script and obtain the simulated test results; According to the simulation test results, determine whether the preset API script has passed the test; When the preset API test is confirmed to have passed, the target API is released for use by the client.
8. A method for generating a query API for a business indicator, characterized in that: include: Receive a target API generation request; wherein the target API generation request carries at least identification information of the target API and an indicator identifier of a target business indicator associated with the target API; In response to the target API generation request, according to the indicator identifier of the target business indicator, a construction rule for generating the target business indicator is configured; and the construction rule of the target business indicator is stored in the metadata table; wherein the construction rule includes the indicator identifier of the subordinate indicator related to the target business indicator, the hierarchical relationship between the target business indicator and the subordinate indicator, and the weight coefficient of the subordinate indicator; According to the construction rules of the target business indicators, a matching script configuration template is determined; wherein the script configuration template at least includes a matching template statement; According to the metadata table, determine the construction rules of the subordinate indicators; The construction rules of the target business indicators, the construction rules of the subordinate indicators, and the script configuration template are used together to construct the corresponding preset API script; The preset API script is stored in the first database; and the metadata table is updated.
9. A business indicator query device, characterized in that: include: A receiving module, configured to receive a target query request initiated by a client based on a target API; wherein the target query request carries at least identification information of the target API and query parameters; and the query parameters include at least a query type parameter; A first determination module is used to respond to a target query request and determine a matching preset API script from a first database as a first API script according to identification information of a target API and a metadata table; wherein the first database stores at least a plurality of preset API scripts; and the metadata table is associated with the first database; A second determination module, configured to determine a matching result processing statement template from the first database according to the query type parameter; An adjustment module, used to adjust the first API script according to the query parameters and the result processing statement template, and obtain a corresponding second API script; An execution module is used to call the API query engine to execute the second API script, obtain corresponding target business data from the second database based on the metadata table; and calculate the target query result about the target business indicator and matching the query type parameter according to the target business data; wherein the second database at least stores business data; The feedback module is used to feed back the target query result to the client.
10. A server, characterized in that: The method comprises a processor and a memory for storing processor-executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 8 when executing the instructions.