Emergency plan automatic generation method

By defining the plan template and real-time data collection, combined with the large language model, the emergency plan documents are automatically generated, which solves the problems of insufficient transparency, real-timeness and universality in traditional plan generation methods, and realizes the real-timeness and intelligent reasoning capabilities of the plan.

CN120031007APending Publication Date: 2025-05-23YUNHE (HENAN) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411864008.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

Traditional emergency plan generation methods have problems such as low transparency, inability to promptly reflect the latest data and situation changes, and low universality.

Method used

An emergency plan automatic generation method is adopted to automatically generate plan documents by defining plan templates, template nodes and paragraph nodes, combining real-time data collection and large language models. The method includes real-time data acquisition, template node data matching, large language model prompt word generation, and document automation compilation.

Benefits of technology

Real-time and transferability of plan documents are achieved, intelligent reasoning capabilities of plan are enhanced, and potential risks can be identified in a timely manner and help decision makers formulate response measures in advance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120031007A_ABST
    Figure CN120031007A_ABST
Patent Text Reader

Abstract

The invention discloses a method for automatically generating an emergency plan, which can be used for automatically building a document structure of the plan as required and automatically selecting a representation type of document content. Meanwhile, according to labels and descriptions of all the nodes of the document, data content needed by the nodes of the document can be automatically matched, needed real-time data can be automatically obtained through a real-time data collection interface, and then through semantic understanding of the labels and the descriptions of all the nodes of the document and in combination with a preset cue word template, the data content of the nodes of the document can be automatically obtained. Cue words required by the large language model are automatically generated, and finally, document content is automatically generated by utilizing the large language model, so that automatic compiling of the plan document is realized. According to the invention, the real-time data is acquired by using the real-time data acquisition system, so that the plan document has real-time performance and mobility. According to the method, the document content is automatically generated by utilizing the large language model, so that the plan also has the intelligent reasoning capability of the large language model, potential risks can be identified in time, and a decision maker is helped to formulate countermeasures in advance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of automatic processing of emergency plans, and is particularly applicable to an automatic generation method of emergency plans. Background Art

[0002] The generation of traditional emergency plans relies on expert experience. Although the knowledge of experts is of great value, it is limited to specific scenarios, resulting in plans generated in complex and changing environments that may not be effective enough, lacking generalization and scalability, and limiting the scientificity and comprehensiveness of decision-making. At the same time, the traditional emergency plan generation method has obvious deficiencies in information integration, and is prone to data islands, which aggravates the barriers to the use of multi-source data. It takes a long time to analyze and make decisions on the plan, which affects the accuracy and timeliness of the decision.

[0003] At present, the template-based automatic generation method of emergency plans has simplified the plan generation process to a certain extent, but it lacks flexibility and cannot effectively respond to data changes and emergencies, cannot reflect the latest data and situational changes in a timely manner, and cannot fully consider local characteristics and historical data, thus limiting the effectiveness and reliability of the template-based automatic generation method of flood control and dispatch plans in practical applications.

[0004] With the development and application of machine learning algorithms, there are also methods for automatically generating flood control dispatch plans based on machine learning algorithms. However, their reasoning ability is weak, the decision-making process is not transparent enough, and users do not trust and accept emergency plans automatically generated based on machine learning algorithms. At the same time, machine learning algorithms themselves are difficult to effectively apply in different regions and under different environmental conditions, which limits the universality and practicality of the generated plans. Summary of the invention

[0005] The present invention aims to provide a method for automatically generating emergency plans, aiming to solve the problems of low transparency, inability to timely reflect the latest data and situation changes, and low universality in the generation of emergency plans.

[0006] To achieve the above object, the present invention adopts the following technical solutions: The method for automatically generating an emergency plan according to the present invention comprises the following steps: S1, define the plan template, template node and paragraph node; S2, instantiate the plan template, select appropriate template nodes according to requirements and add them to the plan template, enter the label and description of the template node, and set the hierarchical relationship between multiple template nodes; S3, select a suitable paragraph node according to the requirements and add it to the plan template, enter the paragraph title, paragraph content and text type of the paragraph node, and establish an association relationship with the template node; S4, establishing a plan outline based on steps S2 and S3; S5, searching the emergency plan information table according to the label and description of the template node to determine the data required by the template node; S6, reading the data required by the template node from the real-time data acquisition system; S7, automatically generating prompt words required by the large language model according to the paragraph title, paragraph content and text type of the paragraph node, combined with the data required by the template node to which the paragraph node belongs and the prompt word template; S8, the large language model automatically generates paragraph content based on the prompt words; S9, adjust the automatically generated paragraph content, and have experts or managers review and improve it to determine the paragraph content; S10, writing the paragraph content into the word document according to the plan outline.

[0007] Furthermore, the template node sequence includes a plurality of paragraph nodes, and the paragraph nodes are divided according to content types, including text paragraphs, picture paragraphs, and table paragraphs.

[0008] Furthermore, step S5 collects and analyzes existing plan documents, which will be confirmed by experienced experts to form the emergency plan information table containing key titles, data items, and data source interfaces; by extracting keywords from template node labels and descriptions or by judging the similarity between template node labels and descriptions and keywords in the emergency plan information table, the emergency plan information table is searched to determine the data required for the template node.

[0009] Furthermore, it also includes plan version management, which automatically records the creation time and update time of the word document.

[0010] Furthermore, step S2 also includes determining the similarity of the template node labels and descriptions to avoid repeated construction of template nodes.

[0011] The advantage of the present invention is that it can build the document structure of the plan according to the needs, and select the expression type of the document content by itself. At the same time, according to the labels and descriptions of each node of the document, it can automatically match the data content required by the document node, and automatically obtain the required real-time data through the real-time data acquisition interface, and then use the semantic understanding of the labels and descriptions of each node of the document, combined with the pre-set prompt word template, to automatically generate the prompt words required by the large language model, and finally use the large language model to automatically generate the document content, thereby realizing the automatic compilation of the plan document. Since the real-time data obtained by the real-time data acquisition system is used in the present invention, the plan document is real-time and portable. The present invention uses a large language model to automatically generate document content, so that the plan also has the intelligent reasoning ability of the large language model, which can identify potential risks in time and help decision makers formulate countermeasures in advance. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 The present invention is a flowchart of the method for automatically generating an emergency plan. DETAILED DESCRIPTION

[0013] The technical solutions in the embodiments of the present invention are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0014] The method for automatically generating an emergency plan according to the present invention is as follows: Figure 1 As shown, the following steps are included: S1, define the plan template, template node and paragraph node.

[0015] Use the WordParagraph model to define a paragraph node, which contains the following fields: title: used to store the title of the paragraph to provide a clear content structure when generating a plan.

[0016] content: Use RichTextField to store the specific content of the paragraph and support a variety of text formats.

[0017] ctype: Defines the content type (such as title, text, picture, table, etc.) through an integer field, which facilitates the distinction and processing of paragraph types for subsequent plan generation.

[0018] Use the TemplateNode model to create a template node, which contains the following fields: label: Set a label for each node for easy identification and management.

[0019] description: Provides a detailed description of the node to help users understand the role of the node.

[0020] template: stores the template content of the node, which serves as the basis for plan generation.

[0021] parent: defines the hierarchical structure of nodes and supports template management of tree structures.

[0022] Result: stores the final generated content for easy viewing and modification later.

[0023] wordParagraphs: Associated with WordParagraph through the ManyToManyField field type, allowing multiple paragraph nodes to be associated with one template node.

[0024] Use the PlanTemplate model to define the final plan template, which contains the following fields: name: The name used to identify the plan template to ensure that users can easily select and manage it.

[0025] title: An optional title field used to further describe the subject of the plan.

[0026] plan_node: Associated to TemplateNode through a foreign key to determine the template structure used by the plan.

[0027] ctype: Defines the plan template type through an integer field to adapt to different water conservancy project scenarios.

[0028] S2, instantiate the plan template, select the appropriate template node according to the needs and add it to the plan template, enter the label and description of the template node, and set the hierarchical relationship between multiple template nodes.

[0029] S3, select the appropriate paragraph node according to the needs and add it to the plan template, enter the paragraph title, paragraph content and content type of the paragraph node, and establish an association relationship with the template node.

[0030] In steps S2 and S3, after the user instantiates the plan template, the paragraph nodes of the template node are managed by creating, modifying, deleting, and other actions. The plan template contains multiple template nodes, and there is a hierarchical relationship between the multiple template nodes. Each template node includes multiple paragraph nodes in sequence. The paragraph node is determined according to the type of content that needs to be displayed, including title paragraphs, text paragraphs, picture paragraphs, table paragraphs, etc. By comparing the similarity of template node labels and descriptions between multiple template nodes, it is ensured that template nodes are not repeatedly constructed, and all content under the same theme is generated under one template node.

[0031] The specific calculation formula for similarity is as follows: in, , Represents the input string, express , The longest common subsequence of Represents a string , The similarity coefficient.

[0032] For example, after the user has created the template node "Engineering Assessment", if he creates the template node "Engineering Safety Assessment" again, a similarity comparison will be performed. If the similarity R is greater than a given threshold, it will be mapped to the already created template node "Engineering Assessment".

[0033] S4, based on steps S2 and S3, a complete plan outline can be established.

[0034] S5, by collecting and analyzing existing plan documents and confirming them with experienced experts, the emergency plan information table containing key titles, data items, and data source interfaces is formed; by extracting keywords from template node labels and descriptions or by judging the similarity between template node labels and descriptions and keywords in the emergency plan information table, the emergency plan information table is searched to determine the data required for the template node.

[0035] S6, reads the data required by the template node from the real-time data acquisition system.

[0036] For example, according to the template node label and description, this node is about the data analysis of the current weather conditions. Then, based on the weather keywords, the weather-related data items and the sources of these data are determined in the emergency plan information table, and the current weather condition data is read from the data source as the basis for subsequent text generation.

[0037] S7, automatically generating prompt words required by the large language model according to the paragraph title, paragraph content and text type of the paragraph node, combined with the data required by the template node to which the paragraph node belongs and the prompt word template.

[0038] S8, the large language model automatically generates paragraph content based on the prompt words.

[0039] The prompt words for text data are designed as follows: prompt = (f"Reference description: {default_context}\nPlease imitate the above description, generate the actual rainfall situation according to the following known information, and optimize it. Do not generate irrelevant information prompts. Please do not use words such as 'Optimized description:'. Make sure not to include any descriptive text.\nKnown information: {information}, current date: {year}{month}{day}") Among them, default_context represents the reference text information, and information refers to the current information such as rain, water, and construction conditions. By designing targeted prompt words, the text generation model can be effectively guided to produce high-quality content. The reference description provides a template, the known information ensures the relevance and interpretability of the generated content, and the specific date information enhances the timeliness and accuracy of the text.

[0040] The prompt words in the form of a table are designed as follows: prompt = ( "Please draw the following list into a table with the following headings: Station name\tFlow at 8:00 today (m³ / s)\tAverage flow yesterday (m³ / s)." "The table name is "Flow table of major stations of the Yellow River", centered at the top." "Please make sure the content of each column is aligned and use a fixed width in the following format:" "| Station name| Traffic flow at 8:00 today (m³ / s) | Average traffic flow yesterday (m³ / s) |" "| XXX | XXX | XXX |" "Please use spaces to keep the columns consistent and make sure everything is centered in the table. Generate a table only, avoid words like 'OK...', 'Here are...', 'Here are...' or 'That's it...', and make sure not to include any explanatory text.\nList contents are as follows: {default_list}") The default_list represents the list information. The above prompt words need to be modified in a targeted manner for different table information. The large language model can generate corresponding rich text for the given prompt words, and generate the corresponding table through front-end rendering.

[0041] The prompt words designed for image data are as follows: prompt = ( "Please generate a detailed description based on the following image, making sure to include the main features, scenes, and elements involved." "Descriptions should be brief, highlight key points from the image, and use technical terms where possible. Avoid phrases like 'OK...', 'Here are...', 'Here are...', or 'That's it...'. Make sure not to include any descriptive text." "The description should include: scene background, main objects and their characteristics, and related activities or states.\n" "Please see the following image information: {image_info}") Among them, image_info represents the stream data of the image. The prompt words designed above can effectively guide the multimodal large language model to generate high-quality image descriptions. This method ensures that the generated text not only accurately reflects the content of the image, but also provides the necessary contextual information to better serve the application needs of plan generation.

[0042] Use the large language model's intelligent text generation, intelligent reasoning, and retrieval capabilities to quickly generate text content.

[0043] S9, adjust the automatically generated paragraph content, and have experts or managers review and improve it to determine the paragraph content. Users can customize the automatically generated content based on actual needs, adjust the content, add specific details and supplementary information to improve the pertinence and practicality of the plan.

[0044] At the same time, the generated content can also be submitted to relevant experts or managers for review, and users can further modify and improve the content based on suggestions and opinions to ensure the scientificity and effectiveness of the plan.

[0045] S10, writing the paragraph content into the word document according to the plan outline, including processing according to the content type (text, picture or table) of the paragraph node.

[0046] If the paragraph node content type is text, add its content to the Word document using the doc.add_paragraph() method. If the paragraph node content type is an image, decode the base64-encoded image data. Use BytesIO to create a byte stream and add it to the Word document, setting the image width adaptive size. If the paragraph node content type is a table, parse the table content in JSON format into a DataFrame data structure. Then add a table header, traverse the column names of the DataFrame data structure, and add them to the first row of the table, while setting the border style. Finally, add the data rows of the DataFrame data structure, traverse each row of data and add it to the table, while setting the border style of the data cells.

[0047] After all paragraphs are processed, use the doc.save(filename) method to save the Word document to ensure that all content has been written to the Word document and persisted to the server.

[0048] The present invention also includes plan version management, which can automatically record the creation time and update time of the word document. After the word document is successfully created, a unique version number is generated for the document. During subsequent updates, the version number of the document is updated and the update time is recorded. Through the plan version update, the user can select the plan version to be updated, re-upload the file after modifying the content, and generate a new version number. After the plan version is updated, the reviewer logs into the system to review the updated plan to ensure its rationality and feasibility, and feedback the review results. After the plan version update passes the review, the compiler publishes the reviewed plan and sets it to an archived state for historical query. Based on the plan version management, users can view the records of previous updates and download the required version of the plan file, thereby enhancing the transparency and traceability of the flood control and dispatching plan management of water conservancy projects.

Claims

1. A method for automatically generating an emergency plan, characterized in that: The following steps are involved: S1, define the plan template, template node and paragraph node; S2, instantiate the plan template, select appropriate template nodes according to requirements and add them to the plan template, enter the label and description of the template node, and set the hierarchical relationship between multiple template nodes; S3, select a suitable paragraph node according to the requirements and add it to the plan template, enter the paragraph title, paragraph content and text type of the paragraph node, and establish an association relationship with the template node; S4, establishing a plan outline based on steps S2 and S3; S5, searching the emergency plan information table according to the label and description of the template node to determine the data required by the template node; S6, reading the data required by the template node from the real-time data acquisition system; S7, automatically generating prompt words required by the large language model according to the paragraph title, paragraph content and text type of the paragraph node, combined with the data required by the template node to which the paragraph node belongs and the prompt word template; S8, the large language model automatically generates paragraph content based on the prompt words; S9, adjust the automatically generated paragraph content, and have experts or managers review and improve it to determine the paragraph content; S10, writing the paragraph content into the word document according to the plan outline.

2. The method for automatically generating an emergency plan according to claim 1, characterized in that: The template node sequence includes a plurality of paragraph nodes, and the paragraph nodes are divided according to content types, including text paragraphs, picture paragraphs, and table paragraphs.

3. The method for automatically generating an emergency plan according to claim 1, characterized in that: Step S5 collects and analyzes existing emergency plan documents, and has them confirmed by experienced experts to form the emergency plan information table containing key titles, data items, and data source interfaces; By extracting keywords from the template node label and description or by determining the similarity between the template node label and description and keywords in the emergency plan information table, the emergency plan information table is searched to determine the data required for the template node.

4. The method for automatically generating an emergency plan according to claim 1, characterized in that: It also includes plan version management, which automatically records the creation time and update time of the word document.

5. The method for automatically generating an emergency plan according to claim 1, characterized in that: Step S2 also includes judging the similarity of template node labels and descriptions to avoid repeated construction of template nodes.