Quiz Sense – Who wants to be a Qlikionnaire?

BorisCreative1 Comment

Hey everyone, for my inaugural post on this blog I want to introduce you to an idea I had at the beginning of last week: Quiz Sense. It’s a pun of Qlik Sense and – well – quiz. It’s a Telegram and Qlik Sense based game that connects to your Sense Server and then generates Questions based on master dimensions and measures from a specific app. It gives players 3 lives to answer these questions correctly and awards scorestreaks for successfully answering successive questions. You can try it here and download the application here.

As a professional being passionate about data, technology and Qlik’s products I love to play and experiment with the platform. Another technology that I love to tinker with are lingual interfaces – especially chatbots. Everyone uses a smartphone these days and an interface that allows you to just ask a question and get the answer is one of the most natural ways to interact with and obtain information. Another more business focussed culmination of this would be an experimental alerting solution I built.

No one – that I know off – has built a Quiz based on business data yet though. So here’s Quiz Sense

Quiz Sense… uh… BUT WHY??!

My standard answer to this question normally is: “Why not?!”, but in this case I’ll give you a few points as to what I consider could be a use for this:

  • Gamification is a grand way to engage people with things they may be less passionate about. By giving out a quiz that asks players questions about who is the biggest customer, what was the conversion rate in a specific year or similar may encourage them to more closely look at numbers, names and facts and therefore make them better acquainted with data in their environment

  • Questions that a line manager might ask “What was last years revenue in South Carolina?” or “What was the maximum freight for our Costumer Bob’s Building Supplies?” can be answered rapidly if you have software like Qlik Sense. So engaging people unfamiliar with Qlik Software with Quiz Sense and giving them the Qlik Sense app on a screen next to it will show them how easy one can find these answers if they have the right tool.

There might be more… if you have ideas, I’ll be happy to hear about them in the comments or via Social Media. For me however “Why not?” is enough for now ;-).

OK,I get it – I think – so how does this work?

Quiz Sense is made up of four main components:

  1. Game and Database (game logic and information handling)
  2. Bot (Telegram handlers)
  3. Qlik Sense Interface (enigma.js methods)

The entire code is written in typescript and runs on node.js. To run your own copy do the following:

  1. Download the repo (see above)
  2. Extract and run npm install from inside the main directory (where package.json is)
  3. Enter the configuration for your telegram bot and Qlik Sense connection in ./config/config.ts
  4. Run tsc in the main directory to compile your code.
  5. Run node dist/app.js

If you run this in a Qlik Sense Server environment, make sure to export the appropriate Certificates from your server and uncomment the certificate loader in ./qs/qs.ts.

Before I run you through the application, here’s a disclaimer: Obviously, anything you do, you do at your own risk.

Here’s an architectural overview of the app:

and here’s the story:

Once you start the game Quiz Sense will connect to the Qlik Sense app specified in the config using enigma.js and pull all master dimensions and measures from the app. It will then randomly select one of each and create a hypercube session object for this combination. Upon receiving the hypercube’s layout a random value within the cube will be a selected and the information returned.

This data is then taken and converted into a question: One of 3 options is selected at random (A, B or C) and the correct value is assigned. The game then generates 2 wrong options, distributes them to the remaining letters and ultimately passes the question on to the chatbot. The last step in question generation, is saving the question to the database and wait for the answer.

The chatbot component is made up of two main parts: One handles messages. This is used to send the initial “New Game” button and also works as a fail safe: should the game get stuck just send a message and you’ll get another „New Game“ Button. It will also log users so that high scores and games can be kept track of.

The other, far more important, component is the callback query handler. This element handles New Game requests and – more importantly – question feedback. If a player picks an answer this part of the game will check if that answer was correct. If that is the case, the user will get a score based on the number of consecutive correct answers (for every 3 correct answers one gets 50 more points per correct answer) and is then sent a new question as described above.

Should the answer be wrong the score streak will be knocked down one tier and the player loses a life. Should no lives be left, the game ends, the score gets recorded and the player can start over. If the player has lives left over, he gets a new question.

The event handling here is split between database (db.ts) and bot (bot.ts) methods:

and

And that is pretty much it. There are a couple of more houskeeping and query methods, especially in db.ts which are used for pulling and pushing data from and to SQLite.

So, what now?

In summary we have built a quiz around a Qlik Sense app that allows users to have a game of trivia based on the data and elements available within this app. Without too much effort a couple of additional features could/will be added:

  • One could pick the 1st entry of the hypercube to ask questions like “which is the top [dimension] by [measure] and then offer the first line value and 2 random other ones to scan for top performing customers/products/months/dates etc. This way there wouldn’t only be numerical (or NaN ;-)) answer options.

  • One could add field selections or more dimensions to the question/hypercube generation process to create multidimensional problems.

  • Make the app a variable component. This enables more variety but offers a level of complexity with users and what apps they can access in mind.

  • A Highscore list (That WILL be done)

I hope you like the idea. Let me know if you do. Let me know if you don’t. Happy hacking!!

One Comment on “Quiz Sense – Who wants to be a Qlikionnaire?”

Schreibe einen Kommentar zu Fred Schonenberg Antworten abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.