Step 5: Visualizing Amazon Comprehend output in Amazon QuickSight
After storing the Amazon Comprehend results in tables, you can connect to and visualize the data with Amazon QuickSight. Amazon QuickSight is an AWS managed business intelligence (BI) tool for visualizing data. Amazon QuickSight makes it easy to connect to your data source and create powerful visuals. In this step, you connect Amazon QuickSight to your data, create visualizations that extract insights from the data, and publish a dashboard of visualizations.
Topics
Prerequisites
Before you begin, complete Step 4: Preparing the Amazon Comprehend output for data visualization.
Give Amazon QuickSight access
To import the data, Amazon QuickSight requires access to your Amazon Simple Storage Service (Amazon S3) bucket and Amazon Athena tables. To give Amazon QuickSight access to your data, you must be signed in as a QuickSight administrator and have access to edit the resource permissions. If you are unable to complete the following steps, review the IAM prerequisites from the overview page Tutorial: Analyzing insights from customer reviews with Amazon Comprehend.
To give Amazon QuickSight access to your data
-
Open the Amazon QuickSight console
. -
If this is the first time you have used Amazon QuickSight, the console prompts you to create a new administrator user by providing an email address. For Email address, enter the same email address as your AWS account. Choose Continue.
-
After signing in, choose your profile name in the navigation bar and choose Manage QuickSight. You must be signed in as an administrator to view the Manage QuickSight option.
-
Choose Security and permissions.
-
For QuickSight access to AWS services, choose Add or remove.
-
Choose Amazon S3.
-
From Select Amazon S3 buckets, choose your S3 bucket for both S3 Bucket and Write permissions for Athena Workgroup.
-
Choose Finish.
-
Choose Update.
Import the datasets
Before creating visualizations, you must add the sentiment and entities datasets to Amazon QuickSight. You do this with the Amazon QuickSight console. You import your unnested sentiment and unnested entities tables from Amazon Athena.
To import your datasets
-
Open the Amazon QuickSight console
. -
In the navigation bar, in Datasets, choose New dataset.
-
For Create a Data Set, choose Athena.
-
For Data source name, enter
reviews-sentiment-analysis
and choose Create data source. -
For Database, choose the database
comprehend-results
. -
For Tables, choose the sentiment table
sentiment_results_final
and then choose Select. -
Choose Import to SPICE for quicker analytics and choose Visualize. SPICE is QuickSight's in-memory calculation engine that provides faster analyses than direct querying when creating visualizations.
-
Return to the Amazon QuickSight console and choose Datasets. Repeat steps 1-7 to create an entities dataset, but make the following changes:
-
For Data source name, enter
reviews-entities-analysis
. -
For Tables, choose the entities table
entities_results_final
.
-
Create a sentiment visualization
Now that you can access your data in Amazon QuickSight, you can begin creating visualizations. You create a pie chart with the Amazon Comprehend sentiment data. The pie chart shows what proportion of the reviews are positive, neutral, mixed, and negative.
To visualize sentiment data
-
In the Amazon QuickSight console, choose Analyses and then choose New analysis.
-
From Your Data Sets, choose the sentiment dataset
sentiment_results_final
and then choose Create analysis. -
In the visual editor, in Fields list, choose sentiment.
Note
The values in the Fields list depend on the column names you used to create the tables in Amazon Athena. If you changed the provided column names in the SQL queries, the Fields list names will be different than the names used in these visualization examples.
-
For Visual types, choose Pie chart.
A pie chart similar to the following with positive, neutral, mixed, and negative sections is displayed. To see the count and percentage of a section, hover over it.
Create an entities visualization
Now create a second visualization with the entities dataset. You create a tree map of the distinct entities in the data. Each block in the tree map represents an entity, and the size of the block correlates to the number of times that the entity appears in the dataset.
To visualize entities data
-
In the Visualize control pane, next to Data set, choose the Add, edit, replace, and remove data sets icon.
-
Choose Add data set.
-
For Choose data set to add, choose your entities dataset
entities_results_final
from the list of datasets and choose Select. -
In the Visualize control pane, choose the Data set drop down menu and choose the entities dataset
entities_results_final
. -
In Fields list, choose entity.
-
For Visual types, choose Tree map.
A tree map similar to the following is displayed next to your pie chart. To see the count of a specific entity, hover over a block.
Publish a dashboard
After creating the visualizations, you can publish them as a dashboard. You can perform various tasks with a dashboard, such as sharing it with users in your AWS account, saving it as a PDF, or emailing it as a report (limited to the Enterprise edition of Amazon QuickSight). In this step, you publish the visualizations as a dashboard in your account.
To publish your dashboard
-
In the navigation bar, choose Share.
-
Choose Publish dashboard.
-
Choose Publish new dashboard as and enter the name
comprehend-analysis-reviews
for the dashboard. -
Choose Publish dashboard.
-
Close the Share dashboard with users pane by choosing the close button in the upper-right corner.
-
In the Amazon QuickSight console, in the navigation pane, choose Dashboards. A thumbnail of your new dashboard
comprehend-analysis-reviews
should appear under Dashboards. Choose the dashboard to view it.
You now have a dashboard with sentiment and entities visualizations that looks similar to the following example.
Tip
If you want to edit the visualizations in your dashboard, return to Analyses and edit the visualization that you want to update. Then, publish the dashboard again either as a new dashboard or as a replacement of the existing dashboard.
Clean up
After completing this tutorial, you might want to clean up any AWS resources you no longer want to use. Active AWS resources can continue to incur charges in your account.
The following actions can help prevent incurring ongoing charges:
-
Cancel your Amazon QuickSight subscription. Amazon QuickSight is a monthly subscription service. To cancel your subscription, see Canceling your subscription in the Amazon QuickSight User Guide.
-
Delete your Amazon S3 bucket. Amazon S3 charges you for storage. To clean up your Amazon S3 resources, delete your bucket. For information about deleting a bucket, see How do I delete an S3 Bucket? in the Amazon Simple Storage Service User Guide. Make sure that you save all of your important files before deleting your bucket.
-
Clear your AWS Glue Data Catalog. The AWS Glue Data Catalog charges you monthly for storage. You can delete your databases to prevent incurring ongoing charges. For information about managing your AWS Glue Data Catalog databases, see Working with databases on the AWS Glue console in the AWS Glue Developer Guide. Make sure that you export your data before clearing any databases or tables.