Matrix Revolutions (and Download) – Part 3

In the first and second parts of this series, we talked about how to grab all the data we need about The Matrix trilogy from the web using the Qlik REST connector.  We also performed sentiment analysis and set up the technical prerequisites such as fonts and extensions.  Now we’re ready to build the QlikView app and finally make the download available at the bottom of the page.  Let’s go!

The Extract App – Edit Script (Scripts, Sentiment, REST)

I have already talked about all of the separate processes to extract scripts, perform sentiment analysis and connect using the REST connector.  To keep things simple, I have condensed this all into one app.  It’s all been commented also.  The app is included in the download pack, named makeitqlik – Extract REST The Matrix Trilogy (Final).qvw

[sociallocker id=”1174″]

Probably the main point of note is regarding the Sentiment Analysis using the Aylien Connector.  You are more than welcome to try this using the included comments and instructions in the script, but i would recommend that if all you’re interested in is seeing how the app loads, just keep the Sentiment – Extract and Store tab commented out and use the existing QVDs i already created.  The code is commented out by default, just uncomment if you want to give it a try.

Also note that it’s vital that you have Qlik Web Connectors (QlikWebConnectors.exe) running for the Aylien calls to work correctly.

The other thing to note is that you will need your API key from themoviedb that we configured in Part 2.  You will need to update the variable vTheMovieDBAPIKey in the Variables tab of Edit Script.

The Final App – Edit Script (Load QVDs)

The Final app is included in the download app, and is named makeitqlik – The Matrix Trilogy (Final).qvw 

The Edit Script section is pretty straightforward – it just loads in the QVDs that we created during the Extract process, including the following QVDs:

  • Matrix_Cast.qvd
  • Matrix_Dialogue.qvd
  • Matrix_Movie.qvd
  • Matrix_Sentiment_Analysis1.qvd
  • Matrix_Sentiment_Analysis2.qvd
  • Matrix_Sentiment_Analysis3.qvd

Your data model should end up like the below when the reload is complete.  Note that all QVDs needed are included if you’re not interested in going through the Extract process itself.

Final QlikView data model for The Matrix Trilogy app

Now that we’ve loaded the data in, let’s take a look at the app.

The App

A couple of key points regarding the app in general:

  1. The background is set as the Document Default and uses the image Matrix3.jpg, which is a muted version of the iconic ‘Matrix Rain’
  2. The tabrow is hidden, and all navigation is done using Button objects.  This is a great technique to use in other apps for navigation.

Pills Tab

The Pills tab

Fonts – Miltown

Let’s start by talking about fonts.  You will notice that both of the core fonts (OCR A Extended and Miltown) are being used in this tab and throughout the app.

In the above, MATRIX TRILOGY is in Miltown font, as well as TAKE THE RED PILL and TAKE THE BLUE PILL.

The absolute key thing to note is that all text using Miltown must be in upper case.  That appears to be the case that has been programmed to replicate the Matrix fonts.  Lower case will give unpredictable and unreadable output 🙂  Also, the font looks better, the bigger it is, so I’ve tried to literally maximise that.

For every separate word of text using Miltown, you need to use a separate text object.  That’s because the space character ‘ ‘ manifests itself as a font variation on the screen, and just does not look right at all.  If you look at MATRIX and TRILOGY, you’ll see that they are 2 separate texts objects carefully positioned.

Fonts – OCR A Extended

OCR A Extended is the other main font in this app.  There’s not much to say about it except it’s really cool!

It’s All About Transparency

This app is all about transparency settings on objects.  A few good examples on this tab.  If you look at the red and blue pills, you will see these are  Button objects with partial transparency set.  You’ll also notice that if you shift them out of the way, there are separate text objects sitting underneath containing the “Take The Red Pill” and “Take The Blue Pill” text.  It’s a pretty cool effect that allows transparency through to the core background image on the tab whilst still glowing through the button “text” nicely.

You will also see that all of the Text objects being used have borders turned off and transparency set to 100%.  This allows us to maximise the effect of the ultra-cool Matrix Rain background and gives the app a nicely futuristic look.

Trilogy Tab

When you enter this tab and don’t have any selections made, you’re met with the a prompt to Select a movie to “Enter The Matrix”.  If you take a look at the “To” and “Enter The Matrix” textbox properties, you will see they are set to conditionally show when not vMovieSelected. vMovieSelected is defined as:

=GetSelectedCount(Movie) = 1

So basically, when you select a single movie, these text boxes will disappear and be replaced by the core objects on the page.


The Full Fat version of the Trilogy tab

Speaking of Selections…

You might notice that the Movie selections above looks a little different from a normal selection, right?  Did you know that you can style your listboxes?  That’s nice, but way cool when you can make it look like the actual Matrix 🙂  So, this is a listbox with Single Column unticked, and the Selection Style Override set to Corner Tag in the Presentation tab of the List Box Properties, as well as the Background set to 100% transparency.

List box properties to create a transparent, Matrix-esque look

The Matrix Reloaded box you can see on the left is a fully transparent text object with green borders and Layer in the Layout tab set to Bottom.  Inside, you have a bunch of transparent textboxes to represent the Release Date etc along with the values needed from the data model.

Every Picture Tells a Story

The Synopsis and Cast box is a bit of an illusion of several objects.  The movie poster image is loaded dynamically from the web for each movie, and if you have a look at the textbox properties, you’ll see that it’s pulling the poster_path_u0 field, and the Representation is set to Image, not Text.

Dynamic images pulled from the web in a textbox

This means that you do need internet access to get at these images, but i figured it was better to get the most up to date version of the image from the web than Bundle Load the images into the app itself.  There’s no reason you couldn’t Bundle Load these in if you felt like it!

The Cast part is an explicit text object (looks much better and easier to format than cramming into a Caption on a chart) and a straight table using the Dark Style, with transparency turned up to full on most settings.

Matrix style transparent straight table settings

Another thing on this straight table – the Cast image is pulled directed from the web.  The cast images (profile_path field) are stored in different sizes, so we’re tapping into the right size (the 185 dimension ones) using an expression set to Image Representation.

Properties for the Cast straight table

Script Tab

The Script Tab including Word Cloud and FirstSortedValue() magic!

Down the left hand side, we have some listboxes with similar Corner Tag settings as for the Movie selection.

The Longest Quote section is all built around the cool FirstSortedValue function, which returns the value from the expression specified in value that corresponds to the result of sorting the sort_weight argument.

=FirstSortedValue([Mapped Character], -Len(Dialogue),1) & ‘ (‘ & FirstSortedValue(Len(Dialogue), -Len(Dialogue),1) & ‘ chars)’ & ‘ – ‘ & FirstSortedValue(Movie, -Len(Dialogue),1)

Here, we’re working out the Character, dialogue length and Movie name with the longest Dialogue i.e. -Len(Dialogue) for the current selections, and then displaying to the user.  The quote is then displayed using a similar method based on the Dialogue field.

Who’s Talking Most doesn’t need too much explanation – it’s just measuring the number of dialogue sequences against the average length of that dialogue.

Most Popular Characters is using the Word Cloud extension that we downloaded in Part 2.  To add and view the extension, you need to be in WebView mode, right click, Add New Sheet Object and find the Word Cloud extension object.  Then you can just drag it on.  You can see the Property settings for the Word Cloud below, but remember you can only edit these in WebView, and if you go out of WebView, you will be met with the rather glamorous “Unknown charttype” error 🙂

Adding the Word Cloud extension and setting Properties

Sentiment Tab

Well, that’s Positive!

We spent quiet a bit of time earlier in the project creating Sentiment Analysis on our movie dialogue and this is where we start to look at that in more detail.

FirstSortedValue() is in action again in the Most Confident Quote section.  It’s now working it’s magic based on the Quote with the most extreme Sentiment Polarity Confidence.  Worth noting here that if FirstSortedValue() matches 2 expressions with the same exact value, it returns now, so there’s a small bit of mitigation code in there to fractionally adjust the Sentiment Polarity Confidence based on the Row number.  This helps to keep things running smoothly, see expression below:

=FirstSortedValue([Mapped Character], -[Sentiment Polarity Confidence] + (0.00001/Row), 1) & ‘ (‘ & FirstSortedValue(Len(Dialogue), -[Sentiment Polarity Confidence] + (0.00001/Row), 1) & ‘ chars)’ & ‘ – ‘ & FirstSortedValue(Movie, -[Sentiment Polarity Confidence] + (0.00001/Row), 1)

Oh, I’m not so bad once you get to know me.

That may be true, Agent Smith, but how much can we trust what you are saying?  The Positive/Negative Quotes – Confidence charts help us to identify not only volume, but the confidence that we can have in what a character is telling us.  For example, if we look at Matrix Revolutions  and concentrate on Oracle, we can see that she has the highest Number of Positive Quotes.  Moreover, we can trust that she’s giving us her message with more confidence than most characters with a 74% confidence on Positive messages and 70% on Negative ones.

If we compare with Neo for example, in the same movie, we can see that he’s being pretty cryptic with his Positive comments, with only a 47% confidence that he is actually being positive!  Fits quite nicely with Neo’s persona in the movie, wouldn’t you say?  If we look at some of the quotes in question, you can understand why the sentiment engine classified them as barely positive.  The below quote only garnered a 39% Sentiment Confidence score of being classified as positive.  Neo just can’t make up his mind!

“I’ll be okay. It’s all right, Trin. But I think you’re gonna have to drive.”

Point to note regarding the Sentiment analysis, is that i have used some Set Analysis to ensure that only characters that have more than 5 quotes over the duration of the Trilogy are included in the analysis, otherwise minor characters that only said the word “sure” were popping to the top of the Most Confident quotes, when in reality, they really don’t matter.  So it’s worth just bearing in mind the volume, polarity and confidence of the quotes you’re looking at when drawing conclusions.  I’m sure that could be weighted somehow if you’re interested 🙂

The final part of this tab gives you the granular detail of all the Dialogue in the Trilogy, so if you’re interested in the guts, Export to Excel away.  Hopefully these tools give you a great jumping off point to delve into favourite characters and quotes from the Trilogy!

Did you always know? Oh no. No, I didn’t. But I believed. I believed.

The final dialogue from Revolutions serves as your cue to download the Matrix Trilogy QlikView project pack.  I had a wonderful time creating this app, and i’d really interested to hear what you think.  Without further ado the download link is below and please come back to makeitqlik for more exciting projects in the future!

Download Pack

Until next time, continue to makeitqlik!




Add a Comment

Your email address will not be published. Required fields are marked *