Method and system for quickly configuring and generating index library based on domain-specific language

By adopting a domain-specific language (DSL) specification for indicator configuration, this paper solves the problem of balancing accuracy, efficiency, and flexibility in indicator library generation in existing technologies. It enables efficient and flexible indicator library generation and iteration, lowers the technical threshold, and improves the generation efficiency and ease of use of indicator libraries.

CN121743464APending Publication Date: 2026-03-27SUNSHINE PROPERTY & CASUALTY INSURANCE CO
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing technologies struggle to ensure accurate and controllable results while achieving efficient configurable generation and flexible iteration of the indicator library, and also struggle to balance lowering the technical threshold with the reuse of existing data assets.

Method used

The specification uses a domain-specific language (DSL) to determine the indicator configuration information. Core attributes are input through the configuration interface, and lexical, syntactic, and semantic verification is performed. Executable code is generated and scheduled to be executed by the computing engine, realizing indicator storage and service-oriented publishing.

Benefits of technology

It enables efficient configurable generation and flexible iteration of the indicator library, lowers the technical threshold, ensures accurate and controllable generation results, and improves the efficiency, standardization and ease of use of the indicator library.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121743464A_ABST
    Figure CN121743464A_ABST
Patent Text Reader

Abstract

The invention provides a method and system for generating an index library in a rapid configuration mode based on a domain-specific language, and relates to the technical field of computer software. Index configuration information, input by a user in a configuration interaction interface, of a target index is received; performing lexical analysis, grammatical analysis and semantic verification on the index configuration information to obtain target configuration information; according to the target configuration information, generating an executable code which can be identified by the target calculation engine, wherein the executable code is an SQL query statement; scheduling the executable code to a target calculation engine for execution, extracting data from the associated data source and completing calculation to obtain a target index, and storing the target index to a preset index library; the target index is registered to the index library center for metadata management, and an index query and data service interface is provided externally, so that efficient configuration generation and flexible iteration of the index library can be realized while the accuracy and controllability of the generation result are ensured, and the technical threshold is reduced and the existing data assets are reused.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software technology, and in particular to a method and system for rapidly generating an indicator library based on a domain-specific language. Background Technology

[0002] As enterprises deepen their digital transformation, data analytics plays an increasingly crucial role in business decision-making. As the core carrier for storing and managing key business metrics, the efficiency, standardization, and flexibility of metric generation directly impact the quality of data analysis and the speed of business response. Currently, enterprises demand not only accurate and compliant metric generation but also rapid adaptation to changing business needs, while simultaneously lowering the barrier to entry for non-technical personnel. Balancing the accuracy, efficiency, and flexibility of metric generation has become a significant challenge restricting the improvement of enterprises' data analytics capabilities.

[0003] To address these challenges, existing technologies have developed two core solutions. One is an end-to-end generation solution based on large models, which directly understands users' natural language descriptions through large language models and automatically generates indicator configuration information or underlying execution code, attempting to reduce the cost of manual intervention through the flexibility of the model. The other is a configuration-based generation solution based on rule engines, which parses and converts users' standardized configurations into executable computational logic through pre-defined rules and code templates, aiming to improve the standardization of indicator generation through fixed rules.

[0004] Although the two types of technologies mentioned above have alleviated the problem of low efficiency of traditional manual coding to some extent, they still have key drawbacks: they cannot achieve efficient configurable generation and flexible iteration of the indicator library while ensuring the accuracy and controllability of the generated results, and they are difficult to balance the reduction of technical thresholds with the reuse of existing data assets. Summary of the Invention

[0005] This invention provides a method and system for rapidly configurable generation of an indicator library based on a domain-specific language. It can achieve efficient configurable generation and flexible iteration of the indicator library while ensuring the accuracy and controllability of the generated results, and also takes into account reducing the technical threshold and reusing existing data assets.

[0006] To achieve the above objectives, the embodiments of the present invention adopt the following technical solutions: Firstly, a method for rapidly generating a metric library based on a domain-specific language is provided. The method includes: receiving metric configuration information of a target metric input by a user through a configuration interface; the metric configuration information being determined according to the domain-specific language specification corresponding to the target metric, which includes the metric's syntax rules, semantic mapping relationships, and integrity verification rules; the metric configuration information including the core attributes of the target metric, such as metric name, business definition description, associated data source, dimension, metric, filtering conditions, and aggregation logic; performing lexical analysis, syntactic analysis, and semantic verification on the metric configuration information to obtain target configuration information; generating executable code recognizable by a target computing engine based on the target configuration information, wherein the executable code is an SQL query statement; scheduling the executable code to the target computing engine for execution, extracting data from the associated data source and completing calculations to obtain the target metric; storing the target metric in a preset metric library; registering the target metric with a metric library center for metadata management and providing metric query and data service interfaces to complete the service-oriented release of the target metric.

[0007] The beneficial effects of this invention are as follows: When the indicator configuration information is determined based on a Domain-Specific Language (DSL) specification, the method provided by this invention allows non-technical personnel to directly input core attributes through a configuration interface without writing complex code. The subsequent parsing and verification, code generation, execution, storage, and service deployment are all automated, avoiding the error risks of manual coding and significantly shortening the indicator generation cycle. Simultaneously, the introduction of the DSL specification forces indicators to be configured according to a unified syntax and semantics, resolving the inconsistency in indicator definitions from the source. This ensures that the generated target indicators not only meet business requirements but also possess standardized metadata management and queryable interfaces, significantly improving the efficiency, standardization, and usability of indicator library generation. Therefore, the method provided by this invention can achieve efficient configurable generation and flexible iteration of the indicator library while ensuring the accuracy and controllability of the generated results, and also reduces the technical threshold and reuses existing data assets.

[0008] In one possible implementation of the first aspect, before receiving the target indicator configuration information input by the user in the configuration interaction interface, the method further includes: receiving an input domain-specific language specification generation instruction, the domain-specific language specification generation instruction carrying the target business scenario and core attributes of the target indicator; generating domain-specific language syntax rules based on the target business scenario, the syntax rules including keyword definitions, attribute declaration formats, logical operators, and statement end markers; generating a domain-specific language semantic mapping relationship according to the core attributes of the target indicator, the semantic mapping relationship including a one-to-one correspondence between the core attributes of the indicator and the underlying calculation logic; and determining a domain-specific language configuration integrity verification rule, the integrity verification rule being used to characterize each core attribute included in the target indicator as a mandatory attribute or an optional attribute.

[0009] The method provided by this invention generates syntax rules based on the target business scenario, ensuring that all users configure metrics in a unified format. Through a one-to-one correspondence between core attributes and underlying calculation logic, different configurations can be accurately converted into SQL calculation logic. Integrity verification rules clearly define required / optional attributes, preventing users from omitting key configurations (such as associated data sources). This step provides a unified language standard for subsequent metric configuration, fundamentally reducing subsequent process conflicts caused by non-standard configurations and laying the foundation for the accuracy of metric generation.

[0010] In one possible implementation of the first aspect, the step of performing lexical analysis, syntactic analysis, and semantic verification on the indicator configuration information to obtain target configuration information includes: splitting the indicator configuration information into multiple syntactic units and removing units with invalid characters and format errors; based on the syntactic rules, verifying whether the combination logic of each syntactic unit is legal, and generating an abstract syntax tree; traversing the abstract syntax tree, and based on the integrity verification rules and semantic mapping relationship, verifying the logical consistency of the core attributes of the target indicator, detecting and marking logical conflicts, and retaining conflict-free configuration information as target configuration information, wherein the logical conflicts include mismatch between dimensions and fields of the associated data source, and incompatibility between filtering conditions and aggregation logic.

[0011] The method provided by this invention uses lexical analysis to preemptively remove invalid characters and formatted error units, preventing errors from flowing into subsequent stages; syntactic analysis, based on the combination logic of DSL syntax rule verification units, generates a structured abstract syntax tree to ensure the legality of the configuration syntax; semantic verification combines integrity verification rules and semantic mapping relationships to accurately detect core logical conflicts such as mismatches between dimensions and associated data source fields, and incompatibility between filtering conditions and aggregation logic, and marks the conflict locations. This process can identify errors in advance during the indicator configuration stage, avoiding calculation failures and rework caused by errors, significantly improving the accuracy of indicator configuration and the smoothness of subsequent processes.

[0012] In one possible implementation of the first aspect, generating executable code recognizable by the target computing engine based on the target configuration information includes: constructing a code generation template library, which pre-stores multiple SQL query statement templates for the target computing engine; matching the corresponding SQL query statement template from the code generation template library based on the storage engine type corresponding to the associated data source in the target configuration information; traversing the abstract syntax tree corresponding to the target configuration information to extract the core attribute information of the target metric, the core attribute information including dimension field names, metric calculation logic, filtering condition expressions, and aggregation function types; and filling the corresponding positions with the core attribute information through the preset syntax structure of the matched SQL query statement template to generate the executable code.

[0013] The method provided by this invention pre-stores SQL templates adapted to different target computing engines through a code generation template library, eliminating the need for manual template structure writing. It automatically matches templates based on the storage engine type of the associated data source, ensuring SQL syntax compatibility with the target engine. It traverses the abstract syntax tree to extract core attributes such as dimensions, metrics, and filtering conditions, and fills them in according to the preset syntax structure of the template, achieving fully automated SQL code generation. This process reduces code generation time from hours to seconds, while avoiding manual coding errors and engine compatibility issues, significantly improving the efficiency and compatibility of executable code generation.

[0014] In one possible implementation of the first aspect, scheduling the executable code to the target computing engine for execution, extracting data from the associated data source and completing the calculation to obtain the target indicator, and storing the target indicator in a preset indicator library, includes: identifying the target computing engine type corresponding to the executable code; establishing a communication connection with the target computing engine based on preset engine connection parameters; submitting the executable code to the target computing engine for execution; obtaining the calculation result and determining it as the target indicator after the executable code has been executed; and storing the target indicator in the preset indicator library.

[0015] The method provided by this invention automatically identifies the target computing engine type corresponding to the executable code, establishes a communication connection based on preset parameters, and eliminates the need for manual input of connection information; it automatically submits the code for execution without the need for manual uploading and triggering; after execution, it directly obtains the calculation results and stores them in a preset indicator library. This process can completely eliminate the dependence on manual operation, improve the automation level of indicator calculation, ensure the smooth flow of data from the associated data source to the calculation and storage, and reduce the risk of process interruption and data loss caused by manual intervention.

[0016] In one possible implementation of the first aspect, registering the target indicator to an indicator library center for metadata management and providing indicator query and data service interfaces includes: registering the metadata information of the target indicator to the indicator library center, wherein the metadata information includes the domain-specific language configuration text, abstract syntax tree, executable code, data lineage, generation time, and lifecycle status of the target indicator; establishing an index for the metadata information in the indicator library center, supporting metadata retrieval by indicator name, business domain, generation time, and dimension fields; constructing an API interface, wherein the API interface supports initiating query requests by target indicator name, dimension value range, and time range; wherein the API interface has multiple permission levels, and users with different permission levels correspond to different interface operation permissions; and recording log information for each API interface call, wherein the log information includes call time, caller identifier, query parameters, and return results.

[0017] The method provided by this invention uniformly registers metadata such as the DSL configuration text, data lineage, and generation time of indicators to an indicator database center and establishes a multi-dimensional index to support rapid retrieval. The constructed API interface supports querying by indicator name, dimension, and time range, and sets multiple permission levels to ensure that sensitive indicators are only accessible to authorized users. Each API call records the call time, caller, query parameters, and other logs for easy problem tracing. The method provided by this invention improves the convenience of indicator querying while ensuring data security and traceability, meeting the management needs of enterprise-level indicator databases.

[0018] In one possible implementation of the first aspect, the method further includes: receiving a modification instruction for a target metric input by a user on a configuration interaction interface, the modification instruction carrying updated metric configuration information; responding to the target metric modification instruction, determining an updated target metric based on the updated metric configuration information; repeatedly performing lexical analysis, syntax analysis, and semantic verification steps on the updated metric configuration information to obtain updated target configuration information; based on the updated target configuration information, performing executable code generation, code scheduling and execution, and metric storage steps to obtain updated target metric; overwriting target metrics in a preset metric library with the updated target metric; and updating the metadata information of the target metrics in the metric library center so that the updated target metric is consistent with the metadata information.

[0019] The method provided by this invention, upon receiving a modification instruction, first performs repeated lexical, syntactic, and semantic verification on the updated configuration information to ensure the new configuration is valid; based on the verified configuration, it generates new executable code and schedules its execution to obtain the updated metrics; it automatically overwrites the old data in the preset metric library and synchronously updates the metadata information in the metric library center. Furthermore, by repeatedly verifying and synchronously updating metadata, the method provided by this invention ensures the logical correctness of the updated metrics and the consistency between the data and metadata, effectively responding to rapid changes in business requirements.

[0020] Secondly, this invention provides a system for rapidly generating an indicator library based on a domain-specific language. The system includes: an information receiving module for receiving indicator configuration information of a target indicator input by a user through a configuration interface. The indicator configuration information is determined according to the domain-specific language specification corresponding to the target indicator. The domain-specific language specification includes the indicator's syntax rules, semantic mapping relationships, and integrity verification rules. The indicator configuration information includes the core attributes of the target indicator, including indicator name, business definition description, associated data source, dimension, metric, filtering conditions, and aggregation logic. An information verification module is used to perform lexical analysis, syntax analysis, and semantic verification on the indicator configuration information to obtain the target configuration information. A code generation module is used to generate executable code recognizable by the target computing engine based on the target configuration information. The executable code is an SQL query statement. An indicator calculation module is used to schedule the executable code to the target computing engine for execution, extract data from the associated data source, complete the calculation, obtain the target indicator, and store the target indicator in a preset indicator library. A service publishing module is used to register the target indicator with the indicator library center for metadata management and provide indicator query and data service interfaces to complete the service publishing of the target indicator.

[0021] Thirdly, an electronic device is provided, the electronic device including a memory and one or more processors; the memory is coupled to the processors; wherein the memory stores computer program code, the computer program code including computer instructions, which, when executed by the processor, cause the electronic device to perform the method as described in any implementation of the first aspect.

[0022] Fourthly, a computer-readable storage medium is provided, including computer instructions that, when executed on an electronic device, cause the electronic device to perform a method as described in any implementation of the first aspect.

[0023] Fifthly, a computer program product is provided that, when run on a computer, causes the computer to perform the method in any implementation of the first aspect.

[0024] Understandably, the beneficial effects achieved by the system of the second aspect, the electronic device of the third aspect, the computer-readable storage medium of the fourth aspect, and the computer program product of the fifth aspect provided above can be referred to with reference to the beneficial effects of the first aspect and any of its possible design embodiments, which will not be repeated here. Attached Figure Description

[0025] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention; Figure 2 A flowchart illustrating a method for rapidly generating an indicator library based on a domain-specific language, as provided in an embodiment of the present invention; Figure 3 A flowchart illustrating another method for rapidly configurable generation of an indicator library based on a domain-specific language, provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a generation system provided in an embodiment of the present invention. Detailed Implementation

[0026] The technical solutions of the embodiments of the present invention will be described below with reference to the accompanying drawings. In the description of the present invention, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can represent A or B. The "or" in the present invention is merely a description of the relationship between the related objects, indicating that three relationships can exist. For example, A or B can represent: A alone, A and B simultaneously, and B alone. A and B can be singular or plural. Furthermore, in the description of the present invention, unless otherwise stated, "multiple" refers to two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items.

[0027] Furthermore, to facilitate a clear description of the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" are not necessarily different.

[0028] In this embodiment of the invention, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this embodiment of the invention should not be construed as superior or more advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner for ease of understanding.

[0029] As enterprises deepen their digital transformation, data analytics plays an increasingly crucial role in business decision-making. As the core carrier for storing and managing key business metrics, the efficiency, standardization, and flexibility of metric generation directly impact the quality of data analysis and the speed of business response. Currently, enterprises demand not only accurate and compliant metric generation but also rapid adaptation to changing business needs, while simultaneously lowering the barrier to entry for non-technical personnel. Balancing the accuracy, efficiency, and flexibility of metric generation has become a significant challenge restricting the improvement of enterprises' data analytics capabilities.

[0030] To address these challenges, existing technologies have developed two core solutions. One is an end-to-end generation solution based on large models, which directly understands users' natural language descriptions through large language models and automatically generates indicator configuration information or underlying execution code, attempting to reduce the cost of manual intervention through the flexibility of the model. The other is a configuration-based generation solution based on rule engines, which parses and converts users' standardized configurations into executable computational logic through pre-defined rules and code templates, aiming to improve the standardization of indicator generation through fixed rules.

[0031] Although the two types of technologies mentioned above have alleviated the problem of low efficiency of traditional manual coding to some extent, they still have key drawbacks: they cannot achieve efficient configurable generation and flexible iteration of the indicator library while ensuring the accuracy and controllability of the generated results, and they are difficult to balance the reduction of technical thresholds with the reuse of existing data assets.

[0032] In view of this, embodiments of the present invention provide a method and system for rapidly generating an indicator library based on a domain-specific language. The method includes: receiving indicator configuration information of a target indicator input by a user in a configuration interaction interface, wherein the indicator configuration information is determined according to the domain-specific language specification corresponding to the target indicator, the domain-specific language specification including the indicator's syntax rules, semantic mapping relationship, and integrity verification rules, and the indicator configuration information including the core attributes of the target indicator, the core attributes including indicator name, business definition description, associated data source, dimension, metric, filtering conditions, and aggregation logic; performing lexical analysis, syntax analysis, and semantic verification on the indicator configuration information to obtain target configuration information; generating executable code recognizable by a target computing engine based on the target configuration information, wherein the executable code is an SQL query statement; scheduling the executable code to the target computing engine for execution, extracting data from the associated data source and completing the calculation to obtain the target indicator, storing the target indicator in a preset indicator library; registering the target indicator to an indicator library center for metadata management, and providing indicator query and data service interfaces to the outside world to complete the service-oriented publication of the target indicator.

[0033] The method provided by this invention, when the indicator configuration information is determined based on the Domain Specific Language (DSL) specification, allows non-technical personnel to directly input core attributes through a configuration interface without writing complex code. The subsequent parsing and verification, code generation, execution, storage, and service deployment are all automated, avoiding the error risks of manual coding and significantly shortening the indicator generation cycle. Furthermore, the introduction of the DSL specification forces indicators to be configured according to a unified syntax and semantics, resolving inconsistencies in indicator definitions from the source. This ensures that the generated target indicators not only meet business requirements but also possess standardized metadata management and queryable interfaces, significantly improving the efficiency, standardization, and usability of indicator library generation. Therefore, the method provided by this invention can achieve efficient configurable generation and flexible iteration of the indicator library while ensuring the accuracy and controllability of the generated results, and also lowers the technical threshold and allows for the reuse of existing data assets.

[0034] In some embodiments, the method for rapidly generating an indicator library based on a domain-specific language provided in this invention can be executed by a system 100 (hereinafter referred to as the generation system 100) for rapidly generating an indicator library based on a domain-specific language.

[0035] As an example, the generation system 100 can be any electronic device 200 with data processing capabilities, such as a general-purpose computer, personal computer, laptop computer, switch, or tablet computer. The specific implementation of the generation system 100 is not limited here.

[0036] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention is shown. The electronic device 200 includes a processor 210, a memory 220, and a communication interface 230.

[0037] Processor 210 may include one or more processing cores. Processor 210 connects to various parts within electronic device 200 using various interfaces and lines, and performs various functions and processes data of electronic device 200 by running or executing instructions, programs, code sets, or instruction sets stored in memory 220, and by calling data stored in memory 220. Optionally, processor 210 may be implemented using at least one of the following hardware forms: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).

[0038] The memory 220 may include random access memory (RAI) or read-only memory (ROI). Optionally, the memory 220 may include non-transitory computer-readable storage ledger. The memory 220 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 220 may include a stored program area. The stored program area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, etc.

[0039] Communication interface 230 is used to communicate with other devices, equipment or communication networks, such as data storage devices, image processing devices or Ethernet, wireless access network (RAN), wireless local area network (WLAN), etc.

[0040] In terms of physical implementation, the aforementioned devices (such as processor 210, memory 220, and communication interface 230) can each be devices within the same device (such as a laptop computer). Alternatively, at least two of these devices can be located within the same device, i.e., as different devices within the same device, similar to the deployment of devices or components in a distributed system.

[0041] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 200. In other embodiments of the present invention, the electronic device 200 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0042] The following description, in conjunction with the accompanying drawings, illustrates a method for rapidly generating an indicator library based on a domain-specific language, according to an embodiment of the present invention.

[0043] Figure 2 This is a flowchart illustrating a method for rapidly generating an indicator library based on a domain-specific language, as provided in an embodiment of the present invention. Optionally, this method can be... Figure 1 The illustrated electronic device 200 performs this operation. The method may include the following steps: S1. Receive the target indicator configuration information input by the user in the configuration interaction interface. The indicator configuration information is determined according to the domain-specific language specification corresponding to the target indicator.

[0044] Specifically, the domain-specific language specification includes the grammar rules, semantic mapping relationships, and integrity verification rules of the indicators. The indicator configuration information includes the core attributes of the target indicator, which include the indicator name, business definition description, associated data source, dimension, metric, filtering conditions, and aggregation logic.

[0045] In some embodiments, prior to S1 described above, the method provided by the present invention further includes: The system receives an input domain-specific language specification generation instruction, which carries the target business scenario and core attributes of the target metric; based on the target business scenario, it generates domain-specific language syntax rules, including keyword definitions, attribute declaration formats, logical operators, and statement termination markers; it generates a domain-specific language semantic mapping relationship based on the core attributes of the target metric, which includes a one-to-one correspondence between the core attributes of the metric and the underlying computational logic; and it determines the integrity verification rules for the domain-specific language configuration, which characterize each core attribute included in the target metric as either a mandatory or optional attribute.

[0046] The method provided by this invention generates syntax rules based on the target business scenario, ensuring that all users configure metrics in a unified format. Through a one-to-one correspondence between core attributes and underlying calculation logic, different configurations can be accurately converted into SQL calculation logic. Integrity verification rules clearly define required / optional attributes, preventing users from omitting key configurations (such as associated data sources). This step provides a unified language standard for subsequent metric configuration, fundamentally reducing subsequent process conflicts caused by non-standard configurations and laying the foundation for the accuracy of metric generation.

[0047] S2. Perform lexical analysis, syntactic analysis, and semantic verification on the indicator configuration information to obtain the target configuration information.

[0048] In one possible implementation, the step of performing lexical analysis, syntactic analysis, and semantic verification on the indicator configuration information to obtain the target configuration information includes: splitting the indicator configuration information into multiple syntactic units and removing units with invalid characters and format errors; based on the syntactic rules, verifying whether the combination logic of each syntactic unit is valid, and generating an abstract syntax tree; traversing the abstract syntax tree, and based on the integrity verification rules and semantic mapping relationship, verifying the logical consistency of the core attributes of the target indicator, detecting and marking logical conflicts, and retaining the configuration information without conflicts as the target configuration information, wherein the logical conflicts include mismatch between dimensions and fields of the associated data source, and incompatibility between filtering conditions and aggregation logic.

[0049] The method provided by this invention uses lexical analysis to preemptively remove invalid characters and formatted error units, preventing errors from flowing into subsequent stages; syntactic analysis, based on the combination logic of DSL syntax rule verification units, generates a structured abstract syntax tree to ensure the legality of the configuration syntax; semantic verification combines integrity verification rules and semantic mapping relationships to accurately detect core logical conflicts such as mismatches between dimensions and associated data source fields, and incompatibility between filtering conditions and aggregation logic, and marks the conflict locations. This process can identify errors in advance during the indicator configuration stage, avoiding calculation failures and rework caused by errors, significantly improving the accuracy of indicator configuration and the smoothness of subsequent processes.

[0050] S3. Generate executable code that can be recognized by the target computing engine based on the target configuration information. The executable code is an SQL query statement.

[0051] In some embodiments, S3 above includes: constructing a code generation template library, wherein the template library pre-stores multiple SQL query statement templates for the target computing engine; matching the corresponding SQL query statement template from the code generation template library based on the storage engine type corresponding to the associated data source in the target configuration information; traversing the abstract syntax tree corresponding to the target configuration information to extract the core attribute information of the target metric, wherein the core attribute information includes dimension field names, metric calculation logic, filtering condition expressions, and aggregation function types; and filling the corresponding positions according to the core attribute information using the preset syntax structure of the matched SQL query statement template to generate the executable code.

[0052] Specifically, multiple SQL query templates are adapted to different types of computing engines, including Hive, MySQL, and ClickHouse.

[0053] The method provided by this invention automatically identifies the target computing engine type corresponding to the executable code, establishes a communication connection based on preset parameters, and eliminates the need for manual input of connection information; it automatically submits the code for execution without the need for manual uploading and triggering; after execution, it directly obtains the calculation results and stores them in a preset indicator library. This process can completely eliminate the dependence on manual operation, improve the automation level of indicator calculation, ensure the smooth flow of data from the associated data source to the calculation and storage, and reduce the risk of process interruption and data loss caused by manual intervention.

[0054] S4. Schedule the executable code to the target computing engine for execution, extract data from the associated data source and complete the calculation to obtain the target indicator, and store the target indicator in the preset indicator library.

[0055] In some embodiments, S4 above includes: identifying the target computing engine type corresponding to the executable code, establishing a communication connection with the target computing engine based on preset engine connection parameters; submitting the executable code to the target computing engine for execution; after the executable code is executed, obtaining the calculation result and determining it as the target indicator; and storing the target indicator in a preset indicator library.

[0056] The method provided by this invention automatically identifies the target computing engine type corresponding to the executable code, establishes a communication connection based on preset parameters, and eliminates the need for manual input of connection information; it automatically submits the code for execution without the need for manual uploading and triggering; after execution, it directly obtains the calculation results and stores them in a preset indicator library. This process can completely eliminate the dependence on manual operation, improve the automation level of indicator calculation, ensure the smooth flow of data from the associated data source to the calculation and storage, and reduce the risk of process interruption and data loss caused by manual intervention.

[0057] S5. Register the target indicator to the indicator library center for metadata management, and provide indicator query and data service interfaces to the outside world to complete the service-oriented release of the target indicator.

[0058] In one possible implementation, S5 above includes: registering the metadata information of the target indicator to an indicator library center, wherein the metadata information includes the domain-specific language configuration text, abstract syntax tree, executable code, data lineage, generation time, and lifecycle status of the target indicator; establishing an index for the metadata information in the indicator library center, supporting metadata retrieval by indicator name, business domain, generation time, and dimension fields; constructing an API interface, wherein the API interface supports initiating query requests by target indicator name, dimension value range, and time range; wherein the API interface has multiple permission levels, and users with different permission levels correspond to different interface operation permissions; and recording log information for each API interface call, wherein the log information includes call time, caller identifier, query parameters, and return results.

[0059] The method provided by this invention uniformly registers metadata such as the DSL configuration text, data lineage, and generation time of indicators to an indicator database center and establishes a multi-dimensional index to support rapid retrieval. The constructed API interface supports querying by indicator name, dimension, and time range, and sets multiple permission levels to ensure that sensitive indicators are only accessible to authorized users. Each API call records the call time, caller, query parameters, and other logs for easy problem tracing. The method provided by this invention improves the convenience of indicator querying while ensuring data security and traceability, meeting the management needs of enterprise-level indicator databases.

[0060] To facilitate understanding of this solution, the following example further explains the method provided by this invention. The method specifically includes the following steps: Step S1: Define a Domain-Specific Language (DSL) specification for metrics. Based on business scenarios, design a declarative and easy-to-understand DSL syntax and semantic structure. This DSL allows users to declaratively define the core attributes of metrics through simple configuration, including but not limited to: metric name, business description, associated data source, dimension, metric, filtering conditions, and aggregation logic. Step S2: Provide a metric configuration interface and receive DSL configuration information. Provide a graphical user interface or text editor to guide users in configuring according to the DSL specification. The system receives metric configuration information submitted by the user that conforms to the DSL specification. Step S3: Parse and verify the DSL configuration. The DSL parsing engine of the system kernel performs lexical analysis, syntax analysis, and semantic verification on the received configuration information to ensure the legality and completeness of the configuration and detect potential logical conflicts. Step S4: Generate executable computational logic code. The DSL parsing engine automatically translates the verified DSL configuration into low-level execution code (such as SQL query statements) that can be recognized by the target computational engine. Step S5: Execute and materialize indicator data. The generated target code is scheduled to execute on the corresponding target calculation engine, extracting data from the specified data source and performing calculations. Finally, the calculation results are stored in the specified indicator library or data table, completing the materialization of the indicator. Step S6: Unified management and service-oriented publishing. The generated indicators are uniformly registered in the indicator library center for metadata management, and standardized indicator query and data service interfaces are provided for upper-layer data applications (such as reports, BI tools, and data APIs).

[0061] In another example, taking the monthly auto insurance claims success rate as the target metric, the system first receives a DSL specification generation instruction carrying the target business scenario and core attributes of auto insurance claims. This instruction generates a domain-specific language specification containing grammatical rules, semantic mapping relationships, and integrity verification rules. Next, business personnel input the metric configuration information according to this specification through the configuration interface. For example, the system uses an auto insurance claims data table in Hive, sets the dimensions to the accident location and accident month, and filters the accident time to ≥2024-01-01 and the case type to auto insurance. After receiving the system's configuration information, it performs lexical analysis, syntactic analysis, and semantic verification to obtain valid target configuration information. Subsequently, based on the storage engine type of the data source in the target configuration information... Matching the corresponding SQL template, extracting core attribute information to populate the template and generate executable SQL code, scheduling the code to Hive for execution, extracting data from the auto insurance claims data table to calculate the indicator result, which is 85% for auto insurance claims success rate in Beijing on January 2024, and storing the result in the indicator library according to the preset partition format; then registering the indicator's metadata to the indicator library center to create an index, building an API interface with access control to provide query services and recording call logs, if subsequent business requirements change, for example, excluding cases with a deductible rate >30%, the updated configuration information is received, and the parsing, verification, code generation, execution, and storage steps are repeated to overwrite the old indicator data and synchronously update the metadata, achieving rapid iteration of the indicator.

[0062] As shown in S1-S5, the method provided by this invention, when the indicator configuration information is determined based on the Domain Specific Language (DSL) specification, allows non-technical personnel to directly input core attributes through the configuration interface without writing complex code. The subsequent parsing and verification, code generation, execution, storage, and service deployment are all automated, avoiding the error risks of manual coding and significantly shortening the indicator generation cycle. Simultaneously, the introduction of the DSL specification forces indicators to be configured according to a unified syntax and semantics, resolving the inconsistency in indicator definitions from the source. This ensures that the generated target indicators not only meet business requirements but also possess standardized metadata management and queryable interfaces, significantly improving the efficiency, standardization, and usability of indicator library generation. Therefore, the method provided by this invention can achieve efficient configurable generation and flexible iteration of the indicator library while ensuring the accuracy and controllability of the generated results, and also reduces the technical threshold and reuses existing data assets.

[0063] In summary, the method provided by this invention has the following beneficial effects: high efficiency and agility: by using a declarative DSL, the development of metrics is transformed from writing code to making configurations, which greatly reduces the technical threshold, enables rapid generation and iteration of metrics, and improves the speed of responding to business needs by several orders of magnitude.

[0064] Ensuring Indicator Standardization and Consistency: A unified DSL standard mandates that all indicators be defined in a standardized manner, fundamentally resolving issues of inconsistent indicator definitions and redundant development, and establishing a reliable indicator system. Significantly Reduced Development and Maintenance Costs: Automated code generation avoids errors from manual coding. When business logic changes, only a single modification to the DSL configuration is needed for global impact, resulting in extremely low maintenance costs. Enhanced System Scalability and Technology Independence: The DSL parsing engine is decoupled from the underlying computing engine. When switching or upgrading the computing engine, only the code generator needs adjustment, without altering the upper-level indicator definitions. The system exhibits excellent scalability and technological adaptability. In other words, this invention provides a configurable, reusable, and model-enhanced indicator library generation paradigm. Through a sophisticated system design, it maximizes the efficiency and ease of use of indicator development while ensuring accurate and controllable generation results.

[0065] In some embodiments, see Figure 3 The method further includes: S60. Receive a modification instruction for the target indicator input by the user in the configuration interaction interface, wherein the modification instruction carries the updated indicator configuration information.

[0066] S61. In response to the target indicator modification instruction, determine the updated target indicator based on the updated indicator configuration information.

[0067] S62. Repeat the lexical analysis, syntax analysis and semantic verification steps on the updated indicator configuration information to obtain the updated target configuration information.

[0068] S63. Based on the updated target configuration information, execute executable code generation, code scheduling and execution, and indicator storage steps to obtain the updated target indicators.

[0069] S64. Cover the target indicators in the preset indicator library with the updated target indicators.

[0070] S65. Update the metadata information of the target indicators in the indicator library center so that the updated target indicators are consistent with the metadata information.

[0071] The method provided by this invention, upon receiving a modification instruction, first performs repeated lexical, syntactic, and semantic verification on the updated configuration information to ensure the new configuration is valid; based on the verified configuration, it generates new executable code and schedules its execution to obtain the updated metrics; it automatically overwrites the old data in the preset metric library and synchronously updates the metadata information in the metric library center. Furthermore, by repeatedly verifying and synchronously updating metadata, the method provided by this invention ensures the logical correctness of the updated metrics and the consistency between the data and metadata, effectively responding to rapid changes in business requirements.

[0072] The foregoing mainly describes the solutions of the embodiments of the present invention from a methodological perspective. It is understood that, in order to achieve the above-mentioned functions, the generation system 100 includes at least one of the hardware structures and software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of the present invention.

[0073] In this embodiment of the invention, the generation system 100 can be divided into functional units according to the above method example. For example, the generation system 100 can be divided into functional units corresponding to various functions, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in this embodiment of the invention is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0074] For example, Figure 4 This diagram illustrates a hardware structure of a generation system according to an embodiment of the present invention. The generation system 100 includes: an information receiving module 110, used to receive indicator configuration information of a target indicator input by a user in a configuration interaction interface. The indicator configuration information is determined according to the domain-specific language specification corresponding to the target indicator. The domain-specific language specification includes the indicator's syntax rules, semantic mapping relationships, and integrity verification rules. The indicator configuration information includes the core attributes of the target indicator, including indicator name, business definition description, associated data source, dimension, metric, filtering conditions, and aggregation logic; and an information verification module 120, used to perform lexical analysis, syntactic analysis, and... Semantic verification is performed to obtain target configuration information; code generation module 130 is used to generate executable code that can be recognized by the target computing engine based on the target configuration information, wherein the executable code is an SQL query statement; indicator calculation module 140 is used to schedule the executable code to be executed by the target computing engine, extract data from the associated data source and complete the calculation to obtain the target indicator, and store the target indicator in a preset indicator library; service publishing module 150 is used to register the target indicator to the indicator library center for metadata management, and provide indicator query and data service interfaces to the outside world to complete the service publishing of the target indicator.

[0075] To facilitate understanding of this solution, the following example further explains the method provided in this embodiment of the invention. Specifically, the system includes: a DSL definition module: used to create and maintain the syntax and semantic specifications of the domain-specific language of the indicator. A configuration interaction module: provides a user configuration interface for receiving and editing indicator configuration information based on DSL. A DSL parsing and compilation module: as the core of the system, used to parse and verify user configurations and compile them into executable code for the target computing engine. A task scheduling and execution engine: responsible for scheduling and executing computing tasks generated by the parsing module and interacting with the underlying big data computing engine. An indicator library storage and management module: used to store the materialized indicator data results and centrally manage the metadata of all indicators (including DSL configuration, lineage, lifecycle, etc.). An indicator service gateway module: provides a unified API interface for other application systems to query and call indicator data.

[0076] It should be understood that specific descriptions of the above-mentioned optional methods can be found in the foregoing method embodiments, and will not be repeated here. Furthermore, explanations of any of the above-provided generation systems 100 and descriptions of their beneficial effects can be found in the corresponding method embodiments, and will not be repeated here.

[0077] This invention also provides a computer-readable storage medium storing at least one computer instruction, which is loaded and executed by a processor to implement the methods of the various embodiments described above. Explanations of the relevant content and descriptions of the beneficial effects of any of the computer-readable storage media provided above can be found in the corresponding embodiments described above, and will not be repeated here.

[0078] This invention also provides a chip. This chip integrates a control circuit for implementing the functions of the aforementioned generation system 100 and one or more ports. Optionally, the functions supported by this chip are as described above and will not be repeated here.

[0079] Those skilled in the art will understand that the program for implementing all or part of the steps of the above embodiments, which can be executed by a program instructing related hardware, can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The processing unit or processor mentioned above can be a central processing unit, a general-purpose processor, an application-specific integrated circuit (ASIC), a microprocessor (DSP), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.

[0080] This invention also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform any of the methods described in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this invention is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), etc.

[0081] It should be noted that the devices for storing computer instructions or computer programs provided in the embodiments of the present invention, such as, but not limited to, the aforementioned memory, computer-readable storage medium, and communication chip, are all non-transitory. Those skilled in the art should recognize that the functions described in the embodiments of the present invention in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable storage medium or transmitted as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of computer programs from one place to another. Storage media can be any available medium accessible to general-purpose or special-purpose computers.

[0082] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for rapidly generating an indicator library based on a domain-specific language, characterized in that, The method includes: The system receives target indicator configuration information input by the user in the configuration interaction interface. The indicator configuration information is determined according to the domain-specific language specification corresponding to the target indicator. The domain-specific language specification includes the indicator's syntax rules, semantic mapping relationship, and integrity verification rules. The indicator configuration information includes the core attributes of the target indicator. The core attributes include indicator name, business definition description, associated data source, dimension, metric, filtering conditions, and aggregation logic. Lexical analysis, syntactic analysis, and semantic verification are performed on the indicator configuration information to obtain the target configuration information; Based on the target configuration information, executable code recognizable by the target computing engine is generated, wherein the executable code is an SQL query statement; The executable code is scheduled to be executed by the target computing engine, which extracts data from the associated data source and performs calculations to obtain the target indicator, which is then stored in a preset indicator library. The target indicator is registered to the indicator library center for metadata management, and an indicator query and data service interface is provided to the outside world to complete the service-oriented release of the target indicator.

2. The method according to claim 1, characterized in that, Before receiving the target metric configuration information input by the user in the configuration interaction interface, the method further includes: The system receives input domain-specific language specification generation instructions, which carry the target business scenario and core attributes of the target metrics. Based on the target business scenario, generate syntax rules for a domain-specific language. The syntax rules include keyword definitions, attribute declaration formats, logical operators, and statement termination markers. Based on the core attributes of the target metric, a semantic mapping relationship for a domain-specific language is generated, wherein the semantic mapping relationship includes a one-to-one correspondence between the core attributes of the metric and the underlying computational logic; Determine the integrity verification rules for the domain-specific language configuration, wherein the integrity verification rules are used to characterize each core attribute included in the target metric as a mandatory attribute or an optional attribute.

3. The method according to claim 2, characterized in that, The step of performing lexical analysis, syntactic analysis, and semantic verification on the indicator configuration information to obtain target configuration information includes: The indicator configuration information is broken down into multiple syntax units, and units with invalid characters and incorrect formats are removed. Based on the grammar rules, the legality of the combination logic of each grammar unit is verified, and an abstract syntax tree is generated. Traverse the abstract syntax tree, and based on the integrity verification rules and semantic mapping relationships, verify the logical consistency of the core attributes of the target metric, detect and mark logical conflicts, and retain conflict-free configuration information as target configuration information. The logical conflicts include mismatch between dimensions and fields of the associated data source, and incompatibility between filtering conditions and aggregation logic.

4. The method according to claim 3, characterized in that, The step of generating executable code recognizable by the target computing engine based on the target configuration information includes: A code generation template library is constructed, which pre-stores multiple SQL query statement templates for the target computing engine; Based on the storage engine type corresponding to the associated data source in the target configuration information, the corresponding SQL query statement template is obtained from the code generation template library; Traverse the abstract syntax tree corresponding to the target configuration information to extract the core attribute information of the target metric. The core attribute information includes dimension field name, metric calculation logic, filter condition expression and aggregation function type. The executable code is generated by filling the corresponding positions with the core attribute information and the preset syntax structure of the matched SQL query statement template.

5. The method according to claim 4, characterized in that, The process of scheduling the executable code to the target computing engine for execution, extracting data from the associated data source and completing calculations to obtain the target metric, and storing the target metric in a preset metric library includes: Identify the target computing engine type corresponding to the executable code, and establish a communication connection with the target computing engine based on preset engine connection parameters; Submit the executable code to the target computing engine for execution; Once the executable code has finished executing, the calculation result is obtained and determined as the target indicator; The target indicators are stored in a preset indicator library.

6. The method according to claim 5, characterized in that, The process of registering the target indicator to the indicator library center for metadata management and providing indicator query and data service interfaces includes: Register the metadata information of the target indicator to the indicator library center. The metadata information includes the domain-specific language configuration text, abstract syntax tree, executable code, data lineage, generation time and life cycle status of the target indicator. An index is created for the metadata information in the indicator library center, supporting metadata retrieval by indicator name, business domain, generation time, and dimension field; An API interface is constructed, which supports query requests based on the target metric name, dimension value range, and time range; the API interface has multiple permission levels, and users with different permission levels have different interface operation permissions. Log information for each API call is recorded, including the call time, caller ID, query parameters, and return results.

7. The method according to claim 6, characterized in that, The method further includes: Receive a modification instruction for a target indicator input by a user in the configuration interaction interface, the modification instruction carrying updated indicator configuration information; In response to the target indicator modification instruction, the updated target indicator is determined based on the updated indicator configuration information; The updated target configuration information is then subjected to repeated lexical analysis, syntax analysis, and semantic verification steps to obtain the updated target configuration information. Based on the updated target configuration information, execute executable code generation, code scheduling and execution, and indicator storage steps are performed to obtain the updated target indicators. The updated target indicators cover the target indicators in the preset indicator library; Update the metadata information of the target indicators in the indicator library center to ensure that the updated target indicators are consistent with the metadata information.

8. A system for rapidly generating an indicator library based on a domain-specific language, characterized in that, The system includes: The information receiving module is used to receive the indicator configuration information of the target indicator input by the user in the configuration interaction interface. The indicator configuration information is determined according to the domain-specific language specification corresponding to the target indicator. The domain-specific language specification includes the syntax rules, semantic mapping relationship and integrity verification rules of the indicator. The indicator configuration information includes the core attributes of the target indicator. The core attributes include indicator name, business description, associated data source, dimension, metric, filtering conditions and aggregation logic. The information verification module is used to perform lexical analysis, syntactic analysis and semantic verification on the indicator configuration information to obtain the target configuration information. The code generation module is used to generate executable code that can be recognized by the target computing engine based on the target configuration information, wherein the executable code is an SQL query statement; The indicator calculation module is used to schedule the executable code to the target calculation engine for execution, extract data from the associated data source and complete the calculation to obtain the target indicator, and store the target indicator in a preset indicator library; The service publishing module is used to register the target indicator to the indicator library center for metadata management and to provide indicator query and data service interfaces to the outside world, so as to complete the service publishing of the target indicator.

9. An electronic device, comprising a processor; and a memory for storing processor-executable instructions; wherein, The processor is configured to execute the instructions to implement the method for rapidly generating an indicator library based on a domain-specific language as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method for rapidly generating an indicator library based on a domain-specific language as described in any one of claims 1-7.