Introducing Aster Lens
Aster Lens is a new interactive Web application for Aster 5.10. It allows Users to find, view, and share results from their nPathViz and cFilterViz functions. It’s a quantum leap forward compared to the old way of visualizing where the answer set would provide you with a URL that you have to Copy/Paste into a Web browser. This presentation will cover the basics on how to setup, configure and use Aster Lens.
Aster Lens is included in the 5.10 release. To get started, download the Aster 5.10 Release Notes (Product ID: B700-1003-510K) for software/hardware requirements. There is also a Webinar ‘Unveiling Aster Lens’ that is now on InfoHub at: http://sharepoint.teradata.com/infohub/aster/default.aspx. Check out these resources before you install.
Although it is recommended to install on the Queen, I installed on one of the Workers without incident. I manually installed via a BIN file named AsterLensInstaller.bin. During the initial install process, you will receive the following Welcome screen:
The first paragraph is good advice. You will need to go to /opt/AsterLens/asterlens and edit the asterlens.properties file to point to the IP address of the Aster Queen. In my case, I changed the following line: aster.host1=100.100.100.100 and typed in the correct IP address of the Queen: aster.host1=192.168.100.100
The install consists of four Steps as follows:
Step 1 of the install gives you the option of installing example Charts in Aster Lens. It doesn’t cost any extra, so I opted to install these. Step 2 creates the visualization catalog table. If you edited your asterlens.properties file correctly, then they should be created without incident. Step 3 installs the example Charts. This typically takes the longest amount of time. Finally Step 4 starts Apache Tomcat.
After the install process, I would recommend reviewing the examples-script.sql file to see how the initial seed tables and Charts are created. This file is located under /opt/AsterLens/Examples.
Navigating the Interface
You logon to Aster Lens via a Web browser. The URL is: http://<IP-address-where-installed-Lens>/asterlens/portal/login. The default credentials are admin/admin, but it is recommended you setup a LDAP configuration if possible. After logon, you’ll see a page similar to below:
In the left vertical pane, you have 2 captions: RESULTS and CATEGORIES.
RESULTS gives you two options: RECENT RESULTS and ALL RESULTS is just that. It shows you every Chart that exists in the nCluster.
CATEGORIES are a way to partition your Charts. Essentially, it’s a landing area for your charts. For example, I could group Charts by Department, Owner, or Function. By default, the Abandonment Carts Example and Cart Conversion Example are created when you install Aster Lens.
The right pane displays the existing Charts. The thumbnail icons are called ‘Cards’ which display a Graphic of the Chart type (Sankey, Chord, Tree, Sigma, or 3rd party). Optionally, you can go to ‘List View’ which provides an Excel-like interface. The button bar above the Charts allows you to Filter by time, Sort or Search on tags. 3rd party Charts will have to be downloaded to visualize in their respective open-source applications; more on that later.
Perhaps the most click object in the right-hand pane is the REFRESH button. As you test Aster Lens by creating new Charts, they won’t be default immediately appear in Aster Lens. You’ll need to click the REFRESH button to update the cache so you can see your new ‘Card.’
Creating new Categories in Aster Lens
New charts are stored under the CATEGORIES header in Aster Lens. As you noticed in the above graphic, there were 4 Categories to choose. The first two categories listed were created during the install process, and I manually created the bottom two. Here’s the code that was run from the install script to create the two hard-coded Categories:
insert into aster_lens_catalog values(1,'aster_lens','cart_abandonment', 'Cart Abandonment Example');
insert into aster_lens_catalog values(2,'aster_lens','sales_completed', 'Cart Conversion Example');
Values added are:
ID: Integer value that determines the order of the Category name that is displayed in Aster Lens GUI
Schema: Always ‘aster_lens’
Visualization table: This is where your new Chart will be housed
Category: This is the name that will display in the Aster Lens GUI
I manually created the Marks Examples and cFilterViz Examples categories myself by running the following code:
INSERT into ASTER_LENS_CATALOG values (3, 'aster_lens', 'Webinars', 'Marks Examples');
INSERT into ASTER_LENS_CATALOG values (4, 'aster_lens', 'Marks_Stuff', 'cFilterViz Examples');
As shown above, to add new categories, you add a new number (1 and 2 were created for the Abandonment Carts Example and Cart Conversion Example categories so you should start at 3 and increment by 1 for other Categories. ‘aster_lens’ is the schema. The third value represents the VISUALIZATION table. This is where the BLOB (the actual content of the Chart) will be stored. And the 4th value signifies the Category name that will be displayed under the CATEGORIES header in the GUI. The integer number you enter in the INSERT statement tells you the order in which it will be displayed. Hence the ‘Marks Examples’ category is listed 3rd in the Web page.
One note of caution here. After INSERTing a new Catalog, you may receive an error when opening up the Aster Lens web page afterwards. I got around this issue by doing a Soft Restart of Aster via the Aster Management Console.
When a user creates a new Chart, they have to point to one of the VISUALIZATION tables listed in the ASTER_LENS_CATALOG. The Visualization table points to the Category that the Chart will be under in the GUI. So let’s move on to the next section to see how this is accomplished when a User creates a Chart.
Creating new Charts
Creating new Charts isn’t that much different than the pre-5.10 days. All you have to do is add one additional line of code. Here’s how it works:
The very first Chart you create for a new Category, you will have to add a CREATE TABLE clause to your code as follows:
CREATE TABLE Aster_lens.Marks_Stuff distribute by hash(id) as
(SELECT * from nPathViz on (….
After the 1st chart is defined for a Category, all other Charts for that Category will need nothing more than a simple INSERT clause as shown below:
INSERT into aster_lens.Marks_Stuff select * from nPathViz(on(………
Of course, if you wanted to be use the preexisting Visualization tables that were hard-coded during the install process (‘cart_abandonment’ and ‘sales_completed’), all you would need would be an INSERT clause since these Categories have already been seeded with existing Charts.
What happens if you forget your CREATE TABLE or INSERT clause? You’ll get something like this:
If Aster Lens is properly configured, you should get the follow Result set:
One more thing. As a best practice going forward, I would recommend naming both the Visualization table and the Category name the same when doing the above INSERTs. This removes any doubt by the User creating a Chart what the Visualization table name is. All they would have to do is logon to Aster Lens, and the name of the Category is the name they would use in their INSERT clause during the Chart creation (As the Administrator, I always do the first CREATE TABLE statement for a new Category. This means anyone else adding a Chart this Category just has to use the INSERT clause)
Anatomy of a Chart
When you click on the ‘Card’ thumbnail, the Chart opens to display a 3-paned window as follows:
- Title: From ‘title’ argument in the SQL-MR code
- Header: Various parameters typically sourced from arguments in SQL-MR code
- Chart: Can be one of various chart types
Here is a snippet of the code that created the above Chart:
INSERT into Webinars
select * from nPathViz(on(….
partition by 1 graph_type('chord') frequency_col('freq') path_col('path')
arguments('start_date=09/27/2011', 'end_date=09/28/2011', 'owner=ASTER', 'tags=Breaking Bad')
title('Chord-Channel Surf 20 minutes before Breaking Bad'));
Three Cool things you can do with Charts
1. Creating Multiple Charts with one SQL-statment
You can create multiple Charts with one SQL-MR nPathViz statement using the PARTITION BY clause. As shown by the graphic below, I PARTITION BY store_id. I have 2 stores in my input table so 2 Charts will be produced in Aster Lens. By the way, the ACCUMULATE argument in the below code means I want to display the storeid value in Title suffix.
2. Adding Aggregates in the Header section of the Chart
This functionality allows you to add an Aggregate (ie: Min, Max, Sum, etc) to the Header of the Chart. It requires an additional ON clause in the SQL-MR code as shown below:
insert into Aggr_cfilter (select * FROM cFilterViz (ON cfilter_output_sales as input partition by storeid ON (select storeid, max(z_score) from cfilter_output_sales group by storeid) as aggregates partition by storeid score_col('score') item1_col('col1_item1') item2_col('col1_item2')cnt1_col('cnt1') cnt2_col('cnt2')arguments ('start date=04/20/1958', 'owner=Juli Nimitz', 'tags=product')title('Aggr_Store_$$$') subtitle ('To Discover cross sell potential') accumulate('storeid')));
Note that I used a CREATE TABLE statement instead of a INSERT. This is because Aggregate Charts must have their own Table structure (to hold the additional column value). In my case, I am aggregating on STORE_ID so want to find the maximum count for each store. Here’s an example showing the difference between 1 ON clause (non-aggregate chart) and 2 ON clauses (aggregated chart):
3. Viewing third-party application Charts
Aster Lens allows for third party visualization applications to display cFilterViz charts. Aster Lens supports both gexf and graphviz format. For example, in my SQL-MR code, I would define ‘graph_type=(‘gexf’)’. To view the Chart, I need to click the DOWNLOAD button so you can select the 3rd party application (in our case, Gephi) so it can be viewed. Here’s the process:
Visualizing your Answer set is a great way to see insights you might have overlooked. It allows you to see ‘the forest through the trees.’ And Aster Lens is the tool that brings Visualization to life. Consumers can now find, share and search for Charts in a simple GUI interface. And it enables a central repository for the enterprise to publish and share their Charts as need. Plus it provides a mechanism to display the Chart and the metadata together (ie: Owner of the Chart, Date chart was run, Start-End dates of the data in the chart, etc.). What’s not to like??