Method, system and equipment for intelligently generating interface program and medium
By using semantic analysis and unsupervised machine learning techniques, the power system interface specification document is automatically parsed, the interface physical model is constructed, and the interface program is generated. This solves the problems of low accuracy and insufficient flexibility in the existing interface program generation technology, and realizes efficient and reliable automated generation of interface programs.
Patent Information
- Application Number
- CN202511106685.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-11-28
AI Technical Summary
Existing technologies for generating power system interface programs suffer from limited document parsing capabilities, a lack of intelligent support for model building, and insufficient flexibility in program generation. This results in low accuracy in extracting protocol parameters, the need for manual intervention to complete the mapping logic design, and the inability to dynamically generate data conversion logic that adapts to different interaction modes.
By parsing the interface technical specification document using semantic analysis technology, extracting key parameters of the business interface message logic model and data interaction mode, constructing the physical model of the producer and consumer interface, identifying the protocol type through unsupervised machine learning, and generating interface programs in conjunction with a template library, the generation of automated data conversion logic is realized.
It significantly improves the accuracy and efficiency of interface program generation, reduces the error rate of manual intervention, supports dynamic updates and data integration of heterogeneous systems, and meets the high reliability and high automation requirements of power systems.
Smart Images

Figure CN121029856A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of interface automatic generation, and in particular to a method, system, device and medium for intelligently generating an interface program. BACKGROUND
[0002] With the continuous improvement of the informatization degree of the power system, the data interaction demand between various business systems is increasingly complex, and the development efficiency and accuracy of the interface program as the key carrier of data flow between systems directly affect the integration performance of the overall system. Currently, the development of the interface program mainly relies on the traditional mode of manually reading technical specification documents and manually writing codes. This mode has significant bottlenecks in dealing with large-scale, multi-protocol and heterogeneous system integration scenarios. On the one hand, the power system interface specification document usually contains a large number of professional terms and complex logic, and manual analysis is prone to understanding deviation, resulting in incorrect protocol type identification, parameter omission or incomplete message structure analysis. On the other hand, the development of the interface program needs to repeatedly process general logic such as data mapping, format conversion and exception checking, which has a long development cycle and is difficult to adapt to the rapid changes of business requirements. Although code generation tools based on templates have appeared in the prior art, they rely on manual configuration of mapping relationships and cannot automatically analyze the implicit logic in unstructured documents. Moreover, they lack sufficient support for the protocol types specific to the power system, making it difficult to meet the requirements of high reliability and high automation degree of interface generation.
[0003] The existing technology has three core deficiencies in the interface program generation process: first, the document analysis capability is limited, and the traditional method mainly relies on keyword matching or rule engine, which cannot effectively deal with the sparsity and heterogeneity of professional terms in the power system, resulting in an accuracy rate of protocol parameter extraction lower than 80%; second, the model construction and mapping process lacks intelligent support, existing reverse engineering tools can obtain the database structure, but cannot automatically establish the field-level mapping relationship between the business model and the physical model, and manual intervention is needed to complete the mapping logic design, which is prone to data conversion errors due to subjective understanding differences; third, the program generation flexibility is insufficient, the existing template library only covers general protocol types, and does not support message queues, file transmission and other protocols specific to the power system, and cannot dynamically generate data conversion logic that adapts to different interaction modes. SUMMARY
[0004] In view of the above existing problems, the present application provides a method, system, device and medium for intelligently generating an interface program to solve the problems that the existing technology cannot effectively deal with the sparsity and heterogeneity of professional terms in the power system, resulting in a low accuracy rate of protocol parameter extraction, the need for manual intervention to complete the mapping logic design, the introduction of data conversion errors due to subjective understanding differences, and the inability to dynamically generate data conversion logic that adapts to different interaction modes.
[0005] To address the aforementioned technical problems, a method for intelligently generating interface programs is proposed, including:
[0006] The interface technical specification document is parsed using semantic analysis technology to extract key parameters of the business interface message logic model and data interaction mode. Based on the business interface message logic model, a producer interface physical model is constructed and a mapping relationship is established. Based on the business interface message logic model, technical fields are supplemented to construct a consumer interface physical model. Based on the producer interface physical model, mapping relationship, and key parameters of data interaction mode, a producer interface program is generated, and based on the consumer interface physical model and key parameters of data interaction mode, a consumer interface program is generated.
[0007] As a preferred embodiment of the method for intelligently generating interface programs according to the present invention, the key parameters for extracting the logical model and data interaction mode of the business interface message include: extracting the interface list and interface mode of the structured table in the document; analyzing the document text through unsupervised machine learning to identify the data interaction protocol type; extracting protocol parameters using association analysis technology; and establishing a logical model by performing cluster analysis on the message fields.
[0008] As a preferred embodiment of the method for intelligently generating interface programs according to the present invention, the establishment of the mapping relationship includes: obtaining the existing database model of the producer system through reverse engineering; visually displaying the existing database model and the interface business model; and establishing a visual mapping relationship between the existing database model and the interface business model.
[0009] As a preferred embodiment of the method for intelligently generating interface programs according to the present invention, the method for generating producer interface programs includes: matching a configurable program template library according to the protocol type; injecting protocol parameters to generate program instances; and generating data conversion logic based on mapping relationships.
[0010] As a preferred embodiment of the method for intelligently generating interface programs according to the present invention, the unsupervised machine learning includes: using a topic model to pre-set a set of power system protocol types, and calculating the document topic probability distribution and determining the interface protocol type through word segmentation and dynamic topic assignment optimization;
[0011] Calculating the document topic probability distribution involves statistically analyzing the topic count matrix and updating it using Gibbs sampling until the count matrix fluctuation is less than 0.001. The loop is then terminated with a set number of iterations of 1500. The formula is as follows:
[0012]
[0013] Where P is the conditional probability that the current word belongs to topic k. To exclude the number of words in document d related to topic k after the current word, To exclude the occurrence count of the word v following the current word in topic k, α is the Dirichlet prior parameter of the document-topic distribution, η is the Dirichlet prior parameter of the topic-word distribution, and K is the total number of preset topics;
[0014] The formula for estimating document-topic distribution is expressed as:
[0015]
[0016] Where, θ d,k Let be the probability distribution of document d belonging to topic k, and α be the Dirichlet prior parameter of the document-topic distribution. To exclude the number of words in document d with topic k after the current word, where K is the total number of preset topics;
[0017] Determining the interface protocol type includes extracting candidate parameters using regular expressions, constructing a keyword-parameter association graph, calculating node weights based on a graph sorting algorithm, and confirming candidate parameters whose weights exceed a threshold as valid protocol parameters.
[0018] The formula for calculating node weights is expressed as follows:
[0019]
[0020] in, For node v i The current importance score, b is the damping coefficient of 0.85, All pointers to node v i The set of neighboring nodes, W ji For node v j Point to v i edge weights, Out(v) j ) is node v j The set of all neighboring nodes pointed to It is the sum of the weights of all outgoing edges of the node. For neighbor node v j The current score; when the edge weight between the keyword and the candidate parameter is greater than 0.9, the candidate parameter is considered to be the value of the keyword.
[0021] As a preferred embodiment of the method for intelligently generating interface programs according to the present invention, the data conversion logic includes: interface program templates for platform-built-in message queues, RESTful services, WebService services, and file services; selecting a matching program template and configuring template parameters based on key parameter information of the interaction mode; generating a target interface program; and generating business data extraction logic in the program based on the mapping relationship between the producer interface physical model and the existing physical model, extracting data from the producer's existing business physical model and writing it into the producer interface physical model; and generating interactive data entities from the producer physical interface model according to the key information of the interaction mode and different interaction conventions, and pushing them to the matching interface.
[0022] As a preferred embodiment of the method for intelligently generating interface programs according to the present invention, the generation of consumer interface programs includes: determining the interface program type of the interaction mode, key configuration information of the interface program such as IP, port, URL, file directory, file naming rules, service name, calling parameters, encryption algorithm and password; generating consumer interface programs based on the parameters; obtaining interactive data entities from the interface channel; verifying the legality and integrity of the data according to the rules agreed upon by the consumer interface physical model; and writing the verified data into the database table constructed by the consumer interface physical model.
[0023] The beneficial effects of this preferred technical solution are that it extracts data from the existing business physical model based on the mapping relationship, generates exchange data entities according to the interaction agreement and pushes them to the target interface, realizing the automated flow of producer-side data, and generates consumer programs by configuring key parameters of IP and encryption algorithms, and performs data verification and storage based on physical model rules, thus realizing trusted access to consumer-side data.
[0024] As a preferred embodiment of the intelligent interface program generation system described in this invention, it is characterized by including an interface specification semantic parsing module, a physical model construction and mapping module, an interface program generation module, and a parameter intelligent extraction module.
[0025] The interface specification semantic parsing module is used to automatically parse the power system interface technical specification document and extract key information using natural language processing technology.
[0026] The physical model construction and mapping module is used to construct a database physical model and establish mapping relationships based on the semantic parsing results. On the producer side, the existing database model is obtained through reverse engineering and a field-level mapping is established with the interface business model. On the consumer side, technical fields are added to generate a complete physical model.
[0027] The interface program generation module is used to match a pre-set template library, inject key parameters, and generate data conversion logic based on the mapping relationship to extract and reassemble data.
[0028] The parameter intelligent extraction module is used to construct a parameter name-value association graph, and to identify and retain parameters whose weights are greater than the confidence threshold by iteratively calculating the node weights.
[0029] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of a method for a smart generation interface program.
[0030] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method for a smart generation interface program.
[0031] The beneficial effects of this invention are as follows: This invention uses semantic analysis technology to parse interface specification documents and extract key parameters of business interface message logic models and data interaction patterns, achieving automated transformation from unstructured documents to structured models, significantly improving parsing accuracy and efficiency; it constructs physical models of producer and consumer interfaces based on business logic models and establishes mapping relationships, solving the problem of data structure differences in heterogeneous systems, greatly reducing manual mapping errors and supporting dynamic updates; it uses unsupervised machine learning to identify protocol types and extract parameters through association analysis, breaking through the limitations of traditional rule engines and improving protocol identification accuracy and parameter extraction recall; it combines template libraries and mapping relationships to generate interface programs, replacing repetitive coding work, shortening the development cycle and reducing error rates; it optimizes topic probability distribution and verifies parameter validity through Gibbs sampling and graph sorting algorithms, enhancing the interpretability and computational efficiency of parameter extraction; the producer interface program implements business data extraction and interactive entity push, solving the problem of heterogeneous data source integration and meeting real-time requirements; the consumer interface program implements data verification and persistent storage, ensuring data integrity and compliance. Attached Figure Description
[0032] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 The above is a general flowchart of a method for intelligently generating interface programs according to an embodiment of the present invention.
[0034] Figure 2The present invention provides a system scheme flowchart for an intelligent generation interface program according to an embodiment of the present invention. Detailed Implementation
[0035] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0036] Example 1, referring to Figure 1 As an embodiment of the present invention, a method for intelligently generating interface programs is provided, comprising:
[0037] S100: Uses semantic analysis technology to parse interface technical specification documents and extract key parameters of business interface message logic model and data interaction mode.
[0038] S200: Based on the business interface message logic model, construct the producer interface physical model and establish mapping relationships. Based on the business interface message logic model, supplement the technical fields and construct the consumer interface physical model.
[0039] S300: Generate the producer interface program based on the key parameters of the producer interface physical model, mapping relationship, and data interaction mode, and generate the consumer interface program based on the key parameters of the consumer interface physical model and data interaction mode.
[0040] It should be noted that by using methods such as text scanning and intelligent parsing, the interface model design and database modeling are completed automatically, eliminating the need for manual design and significantly improving work efficiency. Based on the interface specifications, data formats, and interaction models, interface program instances can be automatically generated, greatly improving the efficiency of interface function development. In actual engineering construction, when faced with frequent changes in interface interaction content due to business adjustments and other reasons, it can effectively simplify the iterative process of design modification and function adjustment, significantly improving iteration efficiency.
[0041] Example 2, refer to Figure 1 This is a second embodiment of the present invention, which provides a method for intelligently generating interface programs, including:
[0042] In step S100, the key parameters for extracting the logical model of the service interface message and the data interaction mode include steps S101 to S104:
[0043] S101: Read the structured tables in the interface technical specification and directly extract the interface list and interface mode description;
[0044] S102: Analyze document text using unsupervised machine learning to identify data interaction protocol types;
[0045] S103: Extract protocol parameters using correlation analysis techniques;
[0046] S104: Perform cluster analysis on message fields to establish a logical model.
[0047] In this embodiment of the application, in step S102, the unsupervised machine learning includes steps A1 to A4:
[0048] A1: Preset protocol topic set, message queue, SFTP file, RESTful service, WebService service.
[0049] A2: After segmenting the interface document, remove stop words and add power-specific terms (such as neutral point small reactance).
[0050] A3: When initializing topic assignment, force the special term to be associated with the protocol type (e.g., message topic → message queue).
[0051] A4: Determine the protocol type of the document through dynamic topic probability calculation and iterative sampling; the calculation of the document topic probability distribution includes statistical analysis of the topic count matrix, updating the count matrix using Gibbs sampling until the fluctuation of the count matrix is less than 0.001, and setting the forced termination loop count to 1500. The formula is expressed as:
[0052]
[0053] Where P is the conditional probability that the current word belongs to topic k. To exclude the number of words in document d related to topic k after the current word, To exclude the occurrences of the word v following the current word in topic k, α is the Dirichlet prior parameter of the document-topic distribution, η is the Dirichlet prior parameter of the topic-word distribution, and K is the total number of preset topics.
[0054] In an optional implementation, in step S102, the unsupervised machine learning further includes constructing a protocol keyword dictionary, scanning documents to calculate the protocol keyword density, and matching the protocol type according to a threshold (if the SFTP keyword appears more than 5 times, it is determined).
[0055] In another alternative implementation, in step S102, the unsupervised machine learning may further include training a BERT model by labeling historical interface document protocol types, extracting document chapter embedding vectors, and outputting the protocol probability distribution through a fully connected layer.
[0056] It should be noted that the LDA scheme does not require labeled data, and solves the problem of sparse professional terms by using a power-specific thesaurus and forced topic assignment, adapting to the different document expressions of power grids in various provinces; the rule-based scheme relies on manual maintenance of the dictionary, and the deep learning scheme requires a large number of labeled samples.
[0057] In this embodiment of the application, in step S103, the correlation analysis technique includes steps B1 to B4:
[0058] B1: Extract candidate parameters using regular expressions.
[0059] B2: Construct a keyword-parameter relationship graph, where nodes are candidate parameters and context keywords.
[0060] B3: Calculate the edge weights between context keywords and candidate parameters, expressed by the formula:
[0061]
[0062] in, For node v i The current importance score, b is the damping coefficient of 0.85, All pointers to node v i The set of neighboring nodes, W ji For node v j Point to v i edge weights, Out(v) j ) is node v j The set of all neighboring nodes pointed to It is the sum of the weights of all outgoing edges of the node. For neighbor node v j The current score.
[0063] B4: When the edge weight between the keyword and the candidate parameter is greater than 0.9, the candidate parameter is considered to be the value of the keyword.
[0064] In an optional implementation, in step S103, the association analysis technology further includes locating parameter tables (such as service code tables) in the document, parsing the mapping relationship between table headers and cells, and extracting structured key-value pairs.
[0065] In another optional implementation, in step S103, the association analysis technique may further include training parameter annotations using a BiLSTM+CRF model, annotating parameter names (B-PARAM) and values (B-VALUE) in the text, and combining continuous label values to generate parameter pairs.
[0066] In this embodiment of the application, the cluster analysis in step S104 includes steps C1 to C3:
[0067] C1: Define the cluster center based on the target database field.
[0068] C2: Calculate the Euclidean distance from the field to the center, expressed by the formula:
[0069]
[0070] Where D(x,C) p Let M be the Euclidean distance between a data object and its cluster center in the spatial domain, M be the dimension of the data object, and x be the data object's dimension. q Let C be the value of the qth attribute of data object x. p For the p-th cluster center, C pq Cluster center C p The qth attribute value;
[0071] The formula for the sum of squared errors of the entire dataset is as follows:
[0072]
[0073] Where SSE is the sum of squared errors of the dataset, and O is the number of clusters.
[0074] C3: Merge fields with a distance of less than 0.5 into the same category.
[0075] In an optional implementation, in step S104, the clustering analysis further includes establishing a field type mapping table and matching document field types to target database types, with unmatched fields using default types.
[0076] In another optional implementation, in step S104, the clustering analysis may further include constructing an ontology library in the power field (active power → metering type → numerical type) and inferring field types through attributes (maximum load → hasUnit "MW" → numerical type).
[0077] It should be noted that KMeans solves the equivalent conversion problem between "10,000 kW" and "MW" by dynamically clustering units of measurement; the mapping table method cannot handle new units, and the ontology method relies on a well-developed knowledge base.
[0078] In step S200, establishing the mapping relationship includes steps S201 to S203:
[0079] S201: Obtain the existing database model of the producer system through reverse engineering; reverse engineering includes parsing database metadata to obtain: table structure definitions (field names, types, lengths), foreign key relationships between tables, and generating a physical model topology diagram.
[0080] S202: Visualize the existing database model and interface business model.
[0081] S203: Establish a visual mapping relationship between the existing database model and the interface business model.
[0082] Furthermore, based on the generated business interface message logical model, a visual physical model is automatically generated. On the basis of the physical model, key parameters obtained from semantic analysis are supplemented, mainly responsible for technical fields such as data reception time.
[0083] In step S300, the process of generating the producer interface program includes steps S301 to S303:
[0084] S301: Match the configurable program template library according to the protocol type;
[0085] S302: Example of a program to generate injection protocol parameters;
[0086] S303: Generate data transformation logic based on mapping relationship.
[0087] Furthermore, the data generation and transformation logic includes interface program templates for the platform's built-in message queue, RESTful service, WebService service, and file service. Based on the key parameter information of the interaction mode, a matching program template is selected and the template parameters are configured to generate the target interface program. According to the mapping relationship between the producer interface physical model and the existing physical model, business data extraction logic is generated in the program to extract data from the producer's existing business physical model and write it into the producer interface physical model. From the producer physical interface model, according to the key information of the interaction mode, interactive data entities are generated according to different interaction conventions and pushed to the matching interface.
[0088] In this embodiment of the application, step S301, the configurable program template library includes steps D1 to D3:
[0089] D1: Pre-built protocol template (message queue: Kafka producer template);
[0090] D2: Inject key parameters;
[0091] D3: Automatically generates Java / Python example code.
[0092] In an optional implementation, in step S301, the configurable program template library further includes providing a basic template (SFTP file upload template), manually modifying placeholder parameters, and copying the template file to the project directory.
[0093] In another alternative implementation, in step S301, the configurable program template library may further include defining an interface description language (DSL) and generating target language code through a compiler.
[0094] It should be noted that parameterized templates achieve zero-coding generation through automatic injection and are compatible with various power grid protocols (20+ templates); fixed templates require manual modification and are prone to errors, and DSL solutions require additional syntax learning.
[0095] Furthermore, the process of generating the consumer interface program includes determining the interface program type of the interaction mode, key configuration information of the interface program such as IP, port, URL, file directory, file naming rules, service name, calling parameters, encryption algorithm and password, generating the consumer interface program based on the parameters, obtaining the interaction data entity from the interface channel, verifying the legality and integrity of the data according to the rules agreed upon in the consumer interface physical model, and writing the verified data into the database table constructed by the consumer interface physical model.
[0096] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
[0097] Example 3, referring to Figure 2 This is the third embodiment of the present invention. This embodiment provides a system for intelligently generating interface programs, including an interface specification semantic parsing module, a physical model construction and mapping module, an interface program generation module, and a parameter intelligent extraction module.
[0098] The interface specification semantic parsing module is used to automatically parse the power system interface technical specification document and extract key information using natural language processing technology.
[0099] The physical model construction and mapping module is used to construct a database physical model and establish mapping relationships based on the semantic parsing results. On the producer side, the existing database model is obtained through reverse engineering and a field-level mapping is established with the interface business model. On the consumer side, technical fields are added to generate a complete physical model.
[0100] The interface program generation module is used to match a pre-set template library, inject key parameters, and generate data conversion logic based on the mapping relationship to extract and reassemble data.
[0101] The parameter intelligent extraction module is used to construct a parameter name-value association graph, and to identify and retain parameters whose weights are greater than the confidence threshold by iteratively calculating the node weights.
[0102] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
[0103] Example 4, the fourth embodiment of the present invention, differs from the previous three embodiments in that:
[0104] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0105] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0106] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0107] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
Claims
1. A method for intelligently generating interface programs, characterized in that: include, Semantic analysis techniques are used to parse the interface technical specification document and extract key parameters of the business interface message logic model and data interaction mode. Based on the business interface message logic model, construct the producer interface physical model and establish mapping relationships. Based on the business interface message logic model, supplement the technical fields and construct the consumer interface physical model. Based on the key parameters of the producer interface physical model, mapping relationship, and data interaction mode, the producer interface program is generated, and based on the key parameters of the consumer interface physical model and data interaction mode, the consumer interface program is generated.
2. The method for intelligently generating interface programs as described in claim 1, characterized in that: The key parameters for extracting the logical model and data interaction mode of the business interface messages include the interface list and interface mode of the structured table in the document. Analyze document text using unsupervised machine learning to identify data interaction protocol types; Protocol parameters were extracted using correlation analysis techniques. Cluster analysis is performed on message fields to establish a logical model.
3. The method for intelligently generating interface programs as described in claim 2, characterized in that: The establishment of the mapping relationship includes obtaining the existing database model of the producer system through reverse engineering; Visualize and display the existing database model and interface business model; Establish a visual mapping relationship between the existing database model and the interface business model.
4. The method for intelligently generating interface programs as described in claim 3, characterized in that: The producer interface program includes a configurable program template library that matches the protocol type. Example of a program to generate injection protocol parameters; Data transformation logic is generated based on mapping relationships.
5. The method for intelligently generating interface programs as described in claim 4, characterized in that: The unsupervised machine learning includes using a topic model to pre-set a set of power system protocol types, and calculating the document topic probability distribution through word segmentation and dynamic topic assignment optimization to determine the interface protocol type. Calculating the document topic probability distribution involves statistically analyzing the topic count matrix and updating it using Gibbs sampling until the count matrix fluctuation is less than 0.
001. The loop is then terminated with a set number of iterations of 1500. The formula is as follows: Where P is the conditional probability that the current word belongs to topic k. To exclude the number of words in document d related to topic k after the current word, To exclude the occurrence count of the word v following the current word in topic k, α is the Dirichlet prior parameter of the document-topic distribution, η is the Dirichlet prior parameter of the topic-word distribution, and K is the total number of preset topics; The formula for estimating document-topic distribution is expressed as: Where, θ d,k Let be the probability distribution of document d belonging to topic k, and α be the Dirichlet prior parameter of the document-topic distribution. To exclude the number of words in document d with topic k after the current word, where K is the total number of preset topics; Determining the interface protocol type includes extracting candidate parameters using regular expressions, constructing a keyword-parameter association graph, calculating node weights based on a graph sorting algorithm, and confirming candidate parameters whose weights exceed a threshold as valid protocol parameters. The formula for calculating node weights is expressed as follows: in, For node v i The current importance score, b is the damping coefficient of 0.85, All pointers to node v i The set of neighboring nodes, W ji For node v j Point to v i edge weights, Out(v) j ) is node v j The set of all neighboring nodes pointed to It is the sum of the weights of all outgoing edges of the node. For neighbor node v j The current score; when the edge weight between the keyword and the candidate parameter is greater than 0.9, the candidate parameter is considered to be the value of the keyword.
6. The method for intelligently generating interface programs as described in claim 5, characterized in that: The data generation and transformation logic includes interface program templates for the platform's built-in message queue, RESTful service, WebService service, and file service. Based on the key parameter information of the interaction mode, a matching program template is selected and the template parameters are configured to generate the target interface program. According to the mapping relationship between the producer interface physical model and the existing physical model, business data extraction logic is generated in the program to extract data from the producer's existing business physical model and write it into the producer interface physical model. From the producer physical interface model, according to the key information of the interaction mode, interactive data entities are generated according to different interaction conventions and pushed to the matching interface.
7. The method for intelligently generating interface programs as described in claim 6, characterized in that: The process of generating the consumer interface program includes determining the interface program type of the interaction mode, key configuration information of the interface program such as IP, port, URL, file directory, file naming rules, service name, call parameters, encryption algorithm and password, generating the consumer interface program based on the parameters, obtaining the interaction data entity from the interface channel, verifying the legality and integrity of the data according to the rules agreed upon in the consumer interface physical model, and writing the verified data into the database table constructed by the consumer interface physical model.
8. A system for intelligently generating interface programs, employing the method for intelligently generating interface programs as described in any one of claims 1 to 7, characterized in that, It includes an interface specification semantic parsing module, a physical model construction and mapping module, an interface program generation module, and a parameter intelligent extraction module; The interface specification semantic parsing module is used to automatically parse the power system interface technical specification document and extract key information using natural language processing technology. The physical model construction and mapping module is used to construct a database physical model and establish a mapping relationship based on the semantic parsing results. On the producer side, the existing database model is obtained through reverse engineering and a field-level mapping is established with the interface business model. On the consumer side, technical fields are added to generate a complete physical model. The interface program generation module is used to match a pre-set template library, inject key parameters, and generate data conversion logic based on the mapping relationship to extract and reassemble data. The parameter intelligent extraction module is used to construct a parameter name-value association graph, and to identify and retain parameters whose weights are greater than the confidence threshold by iteratively calculating the node weights.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of a method for a smart generation interface program according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of a method for a smart generation interface program as described in any one of claims 1 to 7.
