Texera / texera

Collaborative Machine-Learning-Centric Data Analytics Using Workflows
https://texera.github.io
Apache License 2.0
160 stars 68 forks source link

Add report print function in Texera menu. #2765

Closed xudongwu-0 closed 1 month ago

xudongwu-0 commented 1 month ago

In this PR, we have added a report generation feature and a backward-compatible JSON visualization export feature to the Texera project. The report generation feature allows users to create user-friendly reports after completing a data processing workflow, exporting them in HTML format. This feature aims to enhance user efficiency by providing a more convenient way to generate and share reports. Based on this, we are developing a storytelling AI feature that will automatically analyze workflows and generate detailed reports in the future.

Key Features Report Generation: Users can automatically generate reports containing data processing results and visualizations upon workflow completion. These reports can be freely shared without compromising content integrity.

Backward-Compatible JSON Visualization and Export: Each operator's details are optimized using a JSON viewer. The entire workflow can be exported as an optimized JSON file, which supports workflow import functionality.

Implementation Details Added a "Generate Report" button to the front end, allowing users to select the report format and generate the report. Implemented a report generator module in the back end, responsible for converting workflow results into visual report content. Integrated an HTML generation library and JSON viewer to ensure the report export functionality and backward compatibility.

Key functions

  1. onClickExportAllResults Purpose: Initiates the process to export all results. It retrieves the workflow content, converts it to JSON format, calls the getWorkflowSnapshot function to capture the workflow snapshot, and finally calls getAllOperatorResults to obtain the results of all operators.

  2. getWorkflowSnapshot Purpose: Captures the current workflow snapshot and returns the image data URL of the snapshot.

  3. getAllOperatorResults Purpose: Relies on the displayResult function to get the results of each operator and the downloadResultsAsHtml function to download the results.

  4. displayResult Purpose: Retrieves and displays the results of the specified operator. It depends on this.workflowResultService.getResultService and this.workflowResultService.getPaginatedResultService to obtain the result services.

  5. downloadResultsAsHtml Purpose: Downloads the results of all operators and the workflow snapshot as an HTML file. The HTML file includes the formatted JSON download, JSON viewer, and comment upload/download functionalities. All these features are implemented within this function.

Operation Process:After running the workflow, click the bottom below. image