Word report generation method and system for realizing customization of power system based on nodejs
Through the Node.js framework and template engine technology, customized Word report generation for the power system is realized, which solves the problems of low efficiency and poor flexibility in traditional methods and provides an efficient and flexible customized report generation solution.
Patent Information
- Application Number
- CN202510861155.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-09-23
AI Technical Summary
Traditional power system report generation methods are inefficient, lack flexibility and scalability, and are unable to meet diverse business needs.
By combining the Node.js framework with template engine technology, we can achieve customized Word report generation for power systems through data preprocessing, template selection and customization, including data denoising, missing value filling and format conversion. It also supports visualization or code editing of multiple Word templates, and dynamically fills in and optimizes formats.
It improves the efficiency and flexibility of power system report generation, can meet the needs of different business scenarios, supports the generation of multiple reports at one time and automatic distribution, and ensures the accuracy and consistency of data.
Smart Images

Figure CN120688470A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of customized report generation, and in particular to a method and system for generating a customized Word report for an electric power system based on Node.js. Background Art
[0002] In power systems, regularly generating and submitting various types of reports is essential. However, traditional report generation methods often suffer from the following problems: first, they are inefficient and require manual intervention; second, they lack flexibility and are unable to meet the needs of different business scenarios; and third, they have poor scalability and are unable to adapt to the rapid changes in the power system.
[0003] Existing technologies primarily rely on manual operations or the use of general-purpose office software (such as Microsoft Word) to generate reports. This approach is not only time-consuming and labor-intensive, but also prone to errors, and is particularly inefficient when dealing with large amounts of data and complex templates. Furthermore, existing solutions lack customization capabilities and cannot meet the diverse business needs of the power system. Therefore, this invention leverages the efficiency and scalability of the Node.js framework, combined with template engine technology and data processing techniques, to provide an intelligent and personalized solution for power system report generation. Summary of the Invention
[0004] The present invention provides a method and system for generating a customized Word report for an electric power system based on Node.js, which solves the problems of low efficiency, lack of flexibility and scalability of traditional report generation methods.
[0005] The purpose of the present invention can be achieved through the following technical solutions: The first aspect of the present invention is to provide a method for generating a customized Word report for a power system based on NodeJS, comprising: Acquire data from the power system and perform preprocessing to obtain processed data; Obtain several Word templates and select and customize Word report templates; Generate customized Word reports for power systems through processed data and selected and customized templates.
[0006] Furthermore, the data in the power system includes equipment operation data, load data, fault records, environmental data and power quality data.
[0007] Furthermore, the preprocessing includes: The data obtained from the power system database is denoised and missing values are filled to obtain cleaned data; the cleaned data is converted into a unified JSON format as processed data.
[0008] Furthermore, the denoising of the data obtained from the power system database includes: Denoising is performed using median filtering algorithm and Fourier transform frequency domain filtering algorithm.
[0009] Furthermore, the missing value filling includes: When the missing data accounts for less than or equal to 5% of all the data, the data is filled using linear interpolation or ARIMA model; When the missing data accounts for more than or equal to 30% of all data, the missing data will be replaced by data from similar devices in the corresponding time period; When the amount of missing data accounts for more than 5% and less than 30% of all data, multiple imputation or KNN nearest neighbor filling is used.
[0010] Furthermore, the acquisition of several Word templates and the selection and customization of Word report templates include: Obtain several Word templates, including several covering common report types in power systems. These include: operation monitoring reports, planning and statistics reports, fault and safety reports, market transaction reports, planning and construction reports, and regulatory and compliance reports. Among them, several Word templates are derived from existing suitable templates or custom templates; Among them, users can modify the template content of several Word templates through a visual interface or code editing, including inserting tables, charts, and text descriptions; Among them, custom templates are designed and uploaded by users themselves, and allow secondary development and expansion of existing templates.
[0011] Furthermore, the generation of a customized Word report for the power system by using the processed data and the selected and customized template includes: Dynamically fill in the selected template and perform corresponding format optimization to complete the generation of customized Word reports for the power system; The specific operation of dynamically filling the selected template is as follows: calling the docx (or officegen library function of Node.js to dynamically fill the processed data into the selected template; The specific operations for corresponding format optimization are: automatic typeset of the filled document to ensure the alignment and aesthetics of titles, tables, and charts; Supports generating multiple reports at one time; generated reports can be automatically distributed to relevant personnel via email, cloud storage or API interface.
[0012] The second aspect of the present invention is to provide a NodeJS-based customized Word report generation system for power systems, comprising: The data acquisition and processing module is used to acquire data from the power system and perform preprocessing to obtain processed data; Template management module, used to obtain several Word templates and select and customize Word report templates; The report generation and output module is used to generate customized Word reports for the power system through processed data and selected and customized templates.
[0013] The third aspect of the present invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, it implements the method for generating customized word reports for power systems based on NodeJS.
[0014] The fourth aspect of the present invention is to provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method for generating a customized word report for a power system based on nodejs.
[0015] Compared with the existing technology, the beneficial effects of the present invention are: acquiring data in the power system and performing preprocessing to obtain processed data; acquiring several Word templates and selecting and customizing Word report templates; generating customized Word reports for the power system through the processed data and the selected and customized templates, thereby solving the problems of low efficiency, lack of flexibility and scalability of traditional report generation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 The present invention provides a step flow diagram of a method for generating a customized Word report for a power system based on NodeJS; Figure 2 The present invention provides a module flow diagram of a word report generation system for realizing customization of power system based on NodeJS. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0019] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0020] In response to the problems existing in the background technology, a method and system for generating customized word reports for power systems based on nodejs were studied and designed, which has important practical significance.
[0021] like Figure 1 As shown, the first aspect of the present invention is to provide a method for generating a customized Word report for a power system based on NodeJS, comprising the following steps: Step S001: Acquire data in the power system and perform preprocessing to obtain processed data.
[0022] It should be noted that in order to generate customized reports for the power system, it is necessary to collect relevant data generated by the power system during operation, and to customize the generation of relevant reports based on the relevant data generated by the power system during operation.
[0023] Specifically, real-time data is obtained from the power system database through an application programming interface (API). This API supports multiple data sources, such as MySQL, MongoDB, and Redis. The API used to obtain real-time data from the power system database is provided by two types of systems: one provided by the power system database and the other provided by third-party service providers, such as Alibaba Cloud and Huawei Cloud.
[0024] The data in the power system database includes equipment operation data, load data, fault records, environmental data, and power quality data. Equipment operation data includes voltage, current, temperature, and power; load data includes regional power load and peak and valley values; fault record data includes fault time, equipment ID (Identification), and fault type; environmental data includes wind speed (wind power) and light intensity (photovoltaic); and power quality data includes harmonic distortion rate and voltage fluctuation.
[0025] It should be further explained that since the data obtained directly from the power system database may be interfered by noise and omissions in data collection, it is necessary to denoise the data and fill in missing values when customizing the report, so that the customized Word report can better reflect the actual situation of the power system.
[0026] Specifically, the data obtained from the power system database are denoised and missing values are filled; wherein, the method for denoising the data obtained from the power system database includes: denoising processing through a median filtering algorithm and a Fourier transform frequency domain filtering algorithm; wherein, the median filtering algorithm and the Fourier transform frequency domain filtering algorithm are both well-known technologies and will not be described in detail here.
[0027] Among them, median filtering is a nonlinear filtering method primarily used to eliminate impulse noise (such as salt and pepper noise) in signals. Its core process involves first defining a sliding window (e.g., 3×3, 5×5, etc.) and moving it point by point across the signal or image, extracting the neighborhood data covered by the window each time. Next, all values within the window are sorted and the median is taken to replace the value at the current center point. For example, in photovoltaic inverter power data, if a point experiences a sudden outlier (e.g., a sudden drop from 1200W to 50W) due to sampling error, median filtering replaces that point with the median value of the neighborhood data (e.g., 1250W), effectively smoothing out the abnormal fluctuation while preserving the signal's edges and sharp features. Because it does not rely on mean calculation, median filtering is highly robust to extreme outliers. However, it is computationally complex (requiring real-time sorting) and has limited effectiveness against Gaussian noise (continuous random noise).
[0028] Fourier transform frequency-domain filtering is a denoising method based on spectral analysis, suitable for periodic or high-frequency noise. The process consists of three steps: First, time-domain to frequency-domain conversion: The original signal is converted to the frequency domain using a fast Fourier transform (FFT), resulting in a spectrum containing different frequency components. Second, frequency-domain filtering: A filter is designed based on the noise characteristics (e.g., a low-pass filter attenuates high-frequency noise) and a spectral multiplication is performed to suppress the target frequency band (e.g., by truncating frequencies above a threshold). Third, inverse transformation restoration: An inverse Fourier transform is performed on the filtered spectrum to restore the denoised time-domain signal. For example, if photovoltaic panel temperature data contains periodic fluctuations caused by environmental interference (e.g., 50Hz power frequency interference), the noise frequency can be located and filtered out using a Fourier transform, followed by smoothing the data. This method is effective for periodic noise, but over-filtering can lead to blurred edges, and the cutoff frequency must be carefully selected to avoid signal distortion.
[0029] The specific process of filling missing values is as follows: When the missing data accounts for less than or equal to 5% of the total data, data filling is performed using linear interpolation or the ARIMA (Autoregressive Integrated Moving Average) model. When the missing data accounts for more than or equal to 30% of all data, the missing data will be replaced by data from similar devices in the corresponding time period; When the missing data accounts for more than 5% and less than 30% of the total data, multiple imputation or KNN (K-Nearest Neighbors) nearest neighbor filling is used; Among them, the linear interpolation algorithm, ARIMA model, multiple interpolation method and KNN are all well-known technologies and will not be described in detail here.
[0030] At this point, the data after data denoising and filling processing using the above method is the cleaned data.
[0031] It should be noted that when creating customized reports, the data obtained from the power system database does not conform to the report generation format, so data format conversion is required. This data format conversion includes the conversion of confusing time formats, inconsistent units, unstructured text, and inconsistent enumeration values.
[0032] Specifically, the cleaned data is converted into a unified JSON (JavaScript Object Notation) format as processed data to facilitate subsequent template filling. JavaScript is a programming language.
[0033] Step S002: Obtain several Word templates, and select and customize a Word report template.
[0034] It should be noted that in order to generate customized Word reports for the power system, it is necessary to predefine some templates first and use the predefined templates to generate customized reports.
[0035] Specifically, several Word templates are obtained, among which several Word templates cover common report types in the power system; the report types include: operation monitoring reports, planning and statistics reports, fault and safety reports, market transaction reports, planning and construction reports, and supervision and compliance reports, etc.
[0036] Among them, several Word templates are derived from existing suitable templates or custom templates.
[0037] Among them, users can modify the template content of several Word templates through a visual interface or code editing, including inserting tables, charts, text descriptions, etc.
[0038] Among them, custom templates are designed and uploaded by users themselves, and allow secondary development and expansion of existing templates.
[0039] At this point, you have obtained several Word templates.
[0040] Then the user selects the required template according to their needs.
[0041] Step S003: Generate a customized Word report for the power system using the processed data and the selected and customized template.
[0042] It should be noted that power data (such as voltage and load) needs to be dynamically inserted into different templates (daily / monthly / fault reports) according to business scenarios. The filling mechanism decouples data and style, solving the data-template separation problem. Equipment parameters (such as transformer nameplate data) need to be dynamically combined with real-time operation data (SCADA, Supervisory Control and Data Acquisition System). Filling is a key step in multi-source data fusion.
[0043] It's also important to note that format optimization is necessary to meet industry standards, which may require certain fonts for titles and table borders. This optimization allows dispatchers to locate voltage limit violations within seconds, directly impacting emergency response efficiency.
[0044] Specifically, it is dynamically filled through the selected template and the corresponding format is optimized; The specific operation of dynamically filling the selected template is to call library functions such as docx (document generation library) or officegen (Office document generation library) of Node.js to dynamically fill the processed data into the selected template; The specific operations for corresponding format optimization are: automatically typeset the filled document to ensure the alignment and aesthetics of titles, tables, charts and other contents.
[0045] It should be noted that when the power system generates related reports, there will be large reports. Therefore, it is also necessary to generate multiple reports at one time. Otherwise, generating reports one by one will cause a lot of time waste. In addition, generating multiple reports at one time can also ensure data consistency, that is, all equipment reports in the same period use the same data snapshot to avoid data version differences caused by batch generation.
[0046] Specifically, it supports the generation of multiple reports at one time; the generated reports can be automatically distributed to relevant personnel via email, cloud storage or API interface, which can not only improve efficiency and data security, but also achieve full-link traceability of data flow.
[0047] At this point, the above method has completed the generation and delivery of customized word reports for the power system.
[0048] like Figure 2 As shown, the second aspect of the present invention is to provide a word report generation system based on nodejs to realize customized power system, including: The data acquisition and processing module 101 is used to acquire data from the power system and perform preprocessing to obtain processed data; The template management module 102 is used to obtain several Word templates and select and customize Word report templates; The report generation and output module 103 is used to generate customized Word reports for the power system using the processed data and selected and customized templates.
[0049] The third aspect of the present invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, it implements a method for generating a customized word report for a power system based on nodejs.
[0050] The fourth aspect of the present invention is to provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, a method for generating a customized word report for a power system based on nodejs is implemented.
[0051] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, optical storage, etc.) containing computer-usable program code.
[0052] The present invention is described with reference to flowcharts and / or block diagrams of methods, systems, and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0053] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0054] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0055] Finally, 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 the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the present invention.
Claims
1. A method for generating customized word reports for power systems based on nodejs, characterized in that: include: Acquire data from the power system and perform preprocessing to obtain processed data; Obtain several Word templates and select and customize Word report templates; Generate customized Word reports for power systems through processed data and selected and customized templates.
2. The method for generating a customized word report for a power system based on nodejs according to claim 1 is characterized in that: The data in the power system includes equipment operation data, load data, fault records, environmental data and power quality data.
3. The method for generating a customized word report for a power system based on nodejs according to claim 1 is characterized in that: The preprocessing comprises: The data obtained from the power system database is denoised and missing values are filled to obtain cleaned data; the cleaned data is converted into a unified JSON format as processed data.
4. The method for generating a customized word report for a power system based on nodejs according to claim 3 is characterized in that: Denoising the data acquired from the power system database includes: Denoising is performed using median filtering algorithm and Fourier transform frequency domain filtering algorithm.
5. The method for generating a customized word report for a power system based on nodejs according to claim 1 is characterized in that: The missing value filling includes: When the missing data accounts for less than or equal to 5% of all the data, the data is filled using linear interpolation or ARIMA model; When the missing data accounts for more than or equal to 30% of all data, the missing data will be replaced by data from similar devices in the corresponding time period; When the amount of missing data accounts for more than 5% and less than 30% of all data, multiple imputation or KNN nearest neighbor filling is used.
6. The method for generating a customized word report for a power system based on nodejs according to claim 1 is characterized in that: The acquisition of several Word templates and the selection and customization of Word report templates include: Obtain several Word templates, including several covering common report types in power systems. These include: operation monitoring reports, planning and statistics reports, fault and safety reports, market transaction reports, planning and construction reports, and regulatory and compliance reports. Among them, several Word templates are derived from existing suitable templates or custom templates; Among them, users can modify the template content of several Word templates through a visual interface or code editing, including inserting tables, charts, and text descriptions; Among them, custom templates are designed and uploaded by users themselves, and allow secondary development and expansion of existing templates.
7. The method for generating a customized word report for a power system based on nodejs according to claim 1 is characterized in that: The generation of customized Word reports for the power system by processing the data and selecting and customizing the template includes: Dynamically fill in the selected template and perform corresponding format optimization to complete the generation of customized Word reports for the power system; The specific operation of dynamically filling the selected template is as follows: calling the docx (or officegen library function of Node.js to dynamically fill the processed data into the selected template; The specific operations for corresponding format optimization are: automatic typeset of the filled document to ensure the alignment and aesthetics of titles, tables, and charts; Supports generating multiple reports at one time; generated reports can be automatically distributed to relevant personnel via email, cloud storage or API interface.
8. A word report generation system based on nodejs to realize customized power system, characterized by: include: The data acquisition and processing module is used to acquire data from the power system and perform preprocessing to obtain processed data; Template management module, used to obtain several Word templates and select and customize Word report templates; The report generation and output module is used to generate customized Word reports for the power system through processed data and selected and customized templates.
9. An electronic device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a method for generating a customized Word report for a power system based on NodeJS as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the method for generating a customized Word report for a power system based on NodeJS as described in any one of claims 1 to 7.