QlikConsersationService - qlik-bots/QlikBotNet GitHub Wiki

This class handles all natual language messages, including Qlik related messages.

An NLP model(Dialogflow/LUIS) is trained to understand specific questions like “what is the sales for today?”, “what is the KPI for xxx”. This class has a QlikNLP instance and QlikSense instance(in QlikSenseEasy).

After it receives a message, it passes the message to QlikNLP for interpretation. It will receive a intent and entity object from NLP. Base on the object it receives, it then get objects from a QlikSense server. Finally, pass the final message back to Qlik Telegram instance.

Users.cs

public class QSUsers

Container for QS user management. Also take care of saving and loading of QS users.

QSUsers.QSUsers()

Constructor.

QSUsers.ReadFromCSV(string FileName)

Load.

QSUsers.WriteToCSV(string FileName)

Save.

QSUsers.GetUser(string UserId)

Check if user exist and return a QSUser object.

QSUsers.AddUser(string UserId, string UserName = "", string QSUserId = "", string QSUserDir = "", string QSUserName = "", string LastAccess = "", bool Allowed = true)

Add.

public class QSConversationSummaryItem

Contains five public properties: Intent, Measure, Dimension, Element and Times.

QSConversationSummary

Container for multiple QSConversationSummaryItem(s). Properties are all List object. There are 6 properties: Measure, MeasureByDimension, MeasureForElement, Top, Bottom, Filter.

Public class QSUser

Qlik sense user object. contains Qlik sense ID, Qlik sense name, telegram ID, telegram Name, last access info, and state information etc.

QSUser.TimeSincePreviousAccess()

Get time since previous access.

QSUser.TimeSinceLastArgument()

Get time since previous arguement.

QSUser.FromCsv(string csvLine)

Parse a string to QSUser object.

QSUser.ToCsv(QSUser U)

Parse a QSUser object to string.

QSUser.SummarizeHistory()

Convert all conversation history into conversation summary.

TelegramConversation namespace

TelegramConversation.cs

public enum ResponseAction

None, OpenApp, ShowKPI, ShowDimension, ShowMeasure, ShowSheet, ShowStory.

public class ResponseOptions

Contains title, ID and response action.

public class Response

Response object. Contains text message, NLP prediction object, Qlik sense object etc. This is the final form of response before being passed back to telegram class and sent to user as message.

TelegramConversation.TelegramConversation(string ApiAiKey, string Language = "Spanish")

Constructor

TelegramConversation.TelegramConversation(string LuisURL, string LuisAppID, string LuisKey)

Constructor

TelegramConversation.ReplySync(string inText, QSUser Usr)

Process async reply function.

TelegramConversation.Reply(string inText, QSUser Usr)

This is a async function. It processes the inText+user info then returns a response object.One of the key functions in this class.

TelegramConversation.ProcessAction(QSUser Usr, ResponseAction Action, string Value)

Currently only does openApp action.

TelegramConversation.ShowAMeasure(string MeasureName, QSUser Usr)

Create a response for showAMeasure request.

TelegramConversation.ShowMeasureByDimension(ref string MeasureName, ref string DimensionName, QSUser Usr)

Create a response for ShowMeasureByDimensionrequest.

TelegramConversation.ShowSheet(string SheetID, QSUser Usr)

Create a response for ShowSheetrequest.

TelegramConversation.ShowStory(string StoryID, QSUser Usr)

Create a response for ShowStory request.

TelegramConversation.ClearFilters(QSUser Usr, string DimensionName = "")

Clears filter in Qlik sense and create a response.

TelegramConversation.CreateSummarySheet(QSUser Usr)

Create a summary sheet and returns the sheet ID.

TelegramConversation.CreateChart(QSUser Usr, string ChartType, string Measure, string Dimension, string Dimension2 = "", string Dimension3 = "", string Measure2 = "", string Measure3 = "", string Element = "")

Create a chart and shown to user. Also used by showMeasureByDimension.

TelegramConversation.UnderstandSentence(QSUser Usr, string Message)

Pass message to NLP/Direct command. and process the message/object returned accordingly. Key function in this class.

TelegramConversation.DetectDirectCommand(string Message)

Check if message is a direct command. If yes, NLP will not be used.

TelegramConversation.GetMeasureValue(QSApp qa, string Measure, string UserName = "")

Get value of a measure.

TelegramConversation.GetKpiValue(QSApp qa, ref string Kpi, string UserName = "")

Get value of a KPI.

TelegramConversation.GetChart(QSApp qa, ref string Measure, ref string Dimension, string UserName, ref string MsgToSpeak, ref QSFoundObject ChartFound)

Get the url of a chart base on measure and dimension.

TelegramConversation.GetTextChart(QSDataList[] Data, int NumBuckets = 5)

TelegramConversation.GetRanking(QSApp qa, ref string Measure, ref string Dimension, string UserName,bool Descending = true, double? MeasureThreshold = null)

Gets top ranked or bottom ranked data.

TelegramConversation.InterpretData(QSApp qa, QSDataList[] gl, string Measure, string Dimension, string AppExpression, string AppDimension,bool Descending = true)

Convert data to message.

TelegramConversation.InterpretDataRanking(QSApp qa, QSDataList[] gl, string Measure, string Dimension, string AppExpression,string AppDimension, bool Descending = true, double? MeasureThreshold = null)

Used with GetRanking

TelegramConversation.GetFilteredMeasure(QSApp qa, ref string Measure, List Filters = null, string UserName = "")

TelegramConversation.GetFilteredList(QSApp qa, ref string Dimension, List Filters = null, string UserName = "")

TelegramConversation.CreateListOfElements(QSApp qa, QSDataList[] gl, string Dimension)

TelegramConversation.GetTextList(QSDataList[] Data, int NumBuckets = 5)

TelegramConversation.ApplyFilter(QSApp qa, string Filter, string FilterValue)