Skip to content

Conversation

@xudongwu-0
Copy link
Contributor

@xudongwu-0 xudongwu-0 commented Aug 9, 2024

This PR introduces the functionality with a button in the menu to generate an initial report with a snapshot of the workflow.

  1. The file was created in this pr: ReportGenerationService

generateWorkflowSnapshot(workflowName: string): Captures a snapshot of the workflow editor as a base64-encoded PNG image URL. It ensures all image resources are loaded before taking the snapshot using html2canvas.
generateReportAsHtmll(workflowSnapshotURL: string, workflowName: string): Generates an HTML file containing the workflow snapshot and triggers a download of the file. The file name is derived from the workflow name.

  1. The file was changed in this pr: MenuComponent:

onClickGenerateReport: Displays a notification indicating the report generation has started, calls generateWorkflowSnapshot from ReportGenerationService to capture the workflow snapshot, and then calls generateResultsAsHtml to generate and download the HTML report.

Operation Process:Click the button below.
image

Here is the generated report.
image

@xudongwu-0 xudongwu-0 self-assigned this Aug 9, 2024
@xudongwu-0 xudongwu-0 requested review from bobbai00 and chenlica August 9, 2024 22:03
@chenlica
Copy link
Contributor

chenlica commented Aug 9, 2024

Suggestions:

  1. Give an overview of the design;
  2. Attach screenshots of the generated report.

Copy link
Contributor

@bobbai00 bobbai00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! The code is much clearer now.

Please take care of the comments. Also functionality-wise, can you see if there is a way to embed the operator icon into the exported image?

Copy link
Contributor

@bobbai00 bobbai00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments.

Copy link
Contributor

@bobbai00 bobbai00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments

add  notificationService
add  notificationService
Copy link
Contributor

@bobbai00 bobbai00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. left some comments

@chenlica
Copy link
Contributor

A few comments:

  • Include the description about this PR only, not other PRs.
  • Give an overview of the design, not just the function names.
  • Fix grammatical errors.

@chenlica
Copy link
Contributor

The description says: "After running the workflow, click the bottom below." What if the user clicks the button before the execution is finished? If it's not clickable, can we disable the button before the execution?

@xudongwu-0
Copy link
Contributor Author

The description says: "After running the workflow, click the bottom below." What if the user clicks the button before the execution is finished? If it's not clickable, can we disable the button before the execution?

I think it is clickable before finishing execution in this pr. But after adding the outcomes of operators as part B, if the user clicks the button before the execution is finished, the report will not include the outcome. I have edited the description. I will try to disable it after adding the outcomes of operators.

@chenlica
Copy link
Contributor

Change the subject to something like: "Adding a button to generate a report for a workflow"

@xudongwu-0 xudongwu-0 changed the title Report pr 1 Adding a button to generate a report for a workflow Aug 12, 2024
Copy link
Contributor

@chenlica chenlica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now after the changes.

@xudongwu-0
Copy link
Contributor Author

LGTM now after the changes.

Thank you for your time and patience.

@xudongwu-0 xudongwu-0 merged commit 7f244f2 into master Aug 13, 2024
@xudongwu-0 xudongwu-0 deleted the report-pr-1 branch August 13, 2024 05:03
xudongwu-0 added a commit that referenced this pull request Aug 27, 2024
This PR enhances the report generation functionality by integrating
comprehensive operator results handling, allowing for more detailed and
informative reports. This PR is a continuation and enhancement of the
previous PR, which can be found at the following link:
#2770

The file was modified in this PR: ReportGenerationService
getAllOperatorResults(operatorIds: string[]): Collects all operator
results from the workflow, processes them, and generates an HTML report
containing both the workflow snapshot and the results for each operator.
The final report is automatically downloaded with a file name derived
from the workflow name.

retrieveOperatorInfoReport(operatorId: string,allResults: { operatorId:
string; html: string }[]): Fetches and processes the result for a given
operator, generating an HTML snippet that is included in the final
report. Handles different result types, including paginated results and
snapshot results.

generateReportAsHtml(workflowSnapshot: string, allResults: string[],
workflowName: string): Generates a comprehensive HTML file containing
the workflow snapshot and all operator results, then triggers a download
of the report. The file name is created using the workflow name,
ensuring easy identification of the report.

The file was changed in this PR: MenuComponent
onClickGenerateReport: Displays a notification indicating that the
report generation has started, collects the operator results using
getAllOperatorResults from ReportGenerationService, and then calls
generateReportAsHtml to generate and download the comprehensive HTML
report.

Operation Process: Click the button below to generate the report with
detailed operator results and the workflow snapshot.

![image](https://github.com/user-attachments/assets/38311e39-cda1-4c85-a4f2-80d4f4a092fc)

Here is a part of the example report.

![image](https://github.com/user-attachments/assets/e93b10b4-347a-4ce1-aa8b-45d943b56c21)

![image](https://github.com/user-attachments/assets/128aa56a-867f-4ee3-a15e-8f7fe32a5cd5)
xudongwu-0 added a commit that referenced this pull request Aug 31, 2024
…ion (#2807)

This PR enhances the report generation functionality by adding Operator
JSON and Comments Section. This PR is a continuation and enhancement of
the previous PR, which can be found at the following link:
#2770 and
#2792

1. The file was modified in this PR: ReportGenerationService

retrieveOperatorInfoReport(operatorId: string,allResults: { operatorId:
string; html: string }[]):
Implements a 'Toggle Detail' button beneath each operator, allowing
users to expand and view the operator's corresponding JSON, formatted
using a JSON viewer.
Adds a comments section below each operator, enabling users to leave
their own comments. It can be use

2. generateReportAsHtml(workflowSnapshot: string, allResults: string[],
workflowName: string):

Generates a comprehensive HTML file containing the workflow snapsho, all
operator results, operator details, and comments section ,then triggers
a download of the report.
add 'Download Workflow JSON' button, allowing user download the whole
JSON file directly from the report.

Operation Process: Click the button below to generate the report with
detailed operator results and the workflow snapshot.

![image](https://github.com/user-attachments/assets/737a7087-7997-40f6-b1eb-931f139399e6)

Here is a part of the example report.

![image](https://github.com/user-attachments/assets/82bc91e8-0d25-4d2b-97d1-8f844552329e)

![image](https://github.com/user-attachments/assets/93f98a15-bc1c-45d5-a5ee-31953e00491f)
xudongwu-0 added a commit that referenced this pull request Sep 18, 2024
This PR enhances the report generation functionality by adding animation
during the process. This PR is a continuation and enhancement of the
previous PR:

Adding a button to generate a report for a workflow:
#2770
Enhancing Report Generation by adding Operator Results:
#2792
Enhancing Report Generation by Adding Operator Json and Comments Section
: #2807
Ai Flag: #2818 and
#2808

Key Changes:

**menu.component.ts:** 
At the start, notification.blank is called to display a message, and
notification.remove is used to remove it at the end. Upon successful
generation, this.notificationService.success is invoked.

**notification.service.ts:** 
notification.blank and notification.remove have been added.

Screenshot of the notification:

![image](https://github.com/user-attachments/assets/76f01cfd-dd52-4ba5-8f87-d2703473e82e)

![image](https://github.com/user-attachments/assets/a0a06876-275d-4062-a62a-0b423488107c)
xudongwu-0 added a commit that referenced this pull request Oct 15, 2024
#2816)

This PR enhances the report generation functionality by
addingStory-teller Ai based on Ai flag. This PR is a continuation and
enhancement of the previous PR:
Adding a button to generate a report for a workflow: #2770 
Enhancing Report Generation by adding Operator Results: #2792 
Enhancing Report Generation by Adding Operator Json and Comments Section
: #2807
Ai Flag: #2818 and
#2808

**New Methods:**
checkAiAssistantEnabled():
Validates whether the AI Assistant feature is enabled by checking the
availability of the required API key. This function ensures that
subsequent AI-based functionalities are executed only when the AI
Assistant is available.

generateComment(operatorInfo: any):
Generates insightful comments for each operator using OpenAI’s GPT
model, tailored for a highly educated audience but one that might not
have deep statistical knowledge. The comments are plain text, enhancing
the overall readability and value of the report.

generateSummaryComment(operatorInfo: any):
Produces a concise, insightful summary comment that highlights key
findings, trends, and areas of improvement across the workflow, focusing
particularly on UDFs. This function is crucial for providing a
comprehensive understanding of the workflow to users.

**Enhanced Methods:**
retrieveOperatorInfoReport(operatorId: string, allResults: { operatorId:
string; html: string }[]):
Implements the checkAiAssistantEnabled, generateComment, and
generateSummaryComment functions to enrich the operator information
section in the generated reports. The function now adds a "Toggle
Detail" button beneath each operator, allowing users to expand and view
the operator’s corresponding JSON, formatted using a JSON viewer.
Additionally, a comments section is added below each operator, enabling
users to leave or view AI-generated comments.

generateReportAsHtml(workflowSnapshot: string, allResults: string[],
workflowName: string):
Generates a comprehensive HTML file containing the workflow snapshot,
all operator results, operator details, and comments. This method
integrates AI-generated comments and a summary section at the end of the
report. It also introduces a "Download Workflow JSON" button, allowing
users to download the entire workflow JSON file directly from the
report.

**Operation Process:** 
Click the button below to generate the report with detailed operator
results and the workflow snapshot.

![image](https://github.com/user-attachments/assets/4c2fccf7-c931-4e9c-a2d2-a6bcc9d640a1)

To turn on the ai feature, you need to modify the following sections in
application.udf

![image](https://github.com/user-attachments/assets/d88755af-c86e-4eb3-a717-59a69b74200e)

For example, to turn on the openai:

![image](https://github.com/user-attachments/assets/588de609-806e-46f8-abea-6a08030243fb)


Here is a part of the example report.

![image](https://github.com/user-attachments/assets/3911a558-497f-45bc-a948-1a7a3a671a85)

![image](https://github.com/user-attachments/assets/f8fa5284-5a5b-4d70-a18b-283a2b3c612f)
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
This PR enhances the report generation functionality by integrating
comprehensive operator results handling, allowing for more detailed and
informative reports. This PR is a continuation and enhancement of the
previous PR, which can be found at the following link:
#2770

The file was modified in this PR: ReportGenerationService
getAllOperatorResults(operatorIds: string[]): Collects all operator
results from the workflow, processes them, and generates an HTML report
containing both the workflow snapshot and the results for each operator.
The final report is automatically downloaded with a file name derived
from the workflow name.

retrieveOperatorInfoReport(operatorId: string,allResults: { operatorId:
string; html: string }[]): Fetches and processes the result for a given
operator, generating an HTML snippet that is included in the final
report. Handles different result types, including paginated results and
snapshot results.

generateReportAsHtml(workflowSnapshot: string, allResults: string[],
workflowName: string): Generates a comprehensive HTML file containing
the workflow snapshot and all operator results, then triggers a download
of the report. The file name is created using the workflow name,
ensuring easy identification of the report.

The file was changed in this PR: MenuComponent
onClickGenerateReport: Displays a notification indicating that the
report generation has started, collects the operator results using
getAllOperatorResults from ReportGenerationService, and then calls
generateReportAsHtml to generate and download the comprehensive HTML
report.

Operation Process: Click the button below to generate the report with
detailed operator results and the workflow snapshot.

![image](https://github.com/user-attachments/assets/38311e39-cda1-4c85-a4f2-80d4f4a092fc)

Here is a part of the example report.

![image](https://github.com/user-attachments/assets/e93b10b4-347a-4ce1-aa8b-45d943b56c21)

![image](https://github.com/user-attachments/assets/128aa56a-867f-4ee3-a15e-8f7fe32a5cd5)
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
…ion (#2807)

This PR enhances the report generation functionality by adding Operator
JSON and Comments Section. This PR is a continuation and enhancement of
the previous PR, which can be found at the following link:
#2770 and
#2792

1. The file was modified in this PR: ReportGenerationService

retrieveOperatorInfoReport(operatorId: string,allResults: { operatorId:
string; html: string }[]):
Implements a 'Toggle Detail' button beneath each operator, allowing
users to expand and view the operator's corresponding JSON, formatted
using a JSON viewer.
Adds a comments section below each operator, enabling users to leave
their own comments. It can be use

2. generateReportAsHtml(workflowSnapshot: string, allResults: string[],
workflowName: string):

Generates a comprehensive HTML file containing the workflow snapsho, all
operator results, operator details, and comments section ,then triggers
a download of the report.
add 'Download Workflow JSON' button, allowing user download the whole
JSON file directly from the report.

Operation Process: Click the button below to generate the report with
detailed operator results and the workflow snapshot.

![image](https://github.com/user-attachments/assets/737a7087-7997-40f6-b1eb-931f139399e6)

Here is a part of the example report.

![image](https://github.com/user-attachments/assets/82bc91e8-0d25-4d2b-97d1-8f844552329e)

![image](https://github.com/user-attachments/assets/93f98a15-bc1c-45d5-a5ee-31953e00491f)
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
This PR enhances the report generation functionality by adding animation
during the process. This PR is a continuation and enhancement of the
previous PR:

Adding a button to generate a report for a workflow:
#2770
Enhancing Report Generation by adding Operator Results:
#2792
Enhancing Report Generation by Adding Operator Json and Comments Section
: #2807
Ai Flag: #2818 and
#2808

Key Changes:

**menu.component.ts:** 
At the start, notification.blank is called to display a message, and
notification.remove is used to remove it at the end. Upon successful
generation, this.notificationService.success is invoked.

**notification.service.ts:** 
notification.blank and notification.remove have been added.

Screenshot of the notification:

![image](https://github.com/user-attachments/assets/76f01cfd-dd52-4ba5-8f87-d2703473e82e)

![image](https://github.com/user-attachments/assets/a0a06876-275d-4062-a62a-0b423488107c)
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
#2816)

This PR enhances the report generation functionality by
addingStory-teller Ai based on Ai flag. This PR is a continuation and
enhancement of the previous PR:
Adding a button to generate a report for a workflow: #2770 
Enhancing Report Generation by adding Operator Results: #2792 
Enhancing Report Generation by Adding Operator Json and Comments Section
: #2807
Ai Flag: #2818 and
#2808

**New Methods:**
checkAiAssistantEnabled():
Validates whether the AI Assistant feature is enabled by checking the
availability of the required API key. This function ensures that
subsequent AI-based functionalities are executed only when the AI
Assistant is available.

generateComment(operatorInfo: any):
Generates insightful comments for each operator using OpenAI’s GPT
model, tailored for a highly educated audience but one that might not
have deep statistical knowledge. The comments are plain text, enhancing
the overall readability and value of the report.

generateSummaryComment(operatorInfo: any):
Produces a concise, insightful summary comment that highlights key
findings, trends, and areas of improvement across the workflow, focusing
particularly on UDFs. This function is crucial for providing a
comprehensive understanding of the workflow to users.

**Enhanced Methods:**
retrieveOperatorInfoReport(operatorId: string, allResults: { operatorId:
string; html: string }[]):
Implements the checkAiAssistantEnabled, generateComment, and
generateSummaryComment functions to enrich the operator information
section in the generated reports. The function now adds a "Toggle
Detail" button beneath each operator, allowing users to expand and view
the operator’s corresponding JSON, formatted using a JSON viewer.
Additionally, a comments section is added below each operator, enabling
users to leave or view AI-generated comments.

generateReportAsHtml(workflowSnapshot: string, allResults: string[],
workflowName: string):
Generates a comprehensive HTML file containing the workflow snapshot,
all operator results, operator details, and comments. This method
integrates AI-generated comments and a summary section at the end of the
report. It also introduces a "Download Workflow JSON" button, allowing
users to download the entire workflow JSON file directly from the
report.

**Operation Process:** 
Click the button below to generate the report with detailed operator
results and the workflow snapshot.

![image](https://github.com/user-attachments/assets/4c2fccf7-c931-4e9c-a2d2-a6bcc9d640a1)

To turn on the ai feature, you need to modify the following sections in
application.udf

![image](https://github.com/user-attachments/assets/d88755af-c86e-4eb3-a717-59a69b74200e)

For example, to turn on the openai:

![image](https://github.com/user-attachments/assets/588de609-806e-46f8-abea-6a08030243fb)


Here is a part of the example report.

![image](https://github.com/user-attachments/assets/3911a558-497f-45bc-a948-1a7a3a671a85)

![image](https://github.com/user-attachments/assets/f8fa5284-5a5b-4d70-a18b-283a2b3c612f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants