How to analyze the data from tracker events db

Hi,

I used tracker_store to store the conversation in sqlite db. But when I queried the events table, it is difficult to analyze the data. It has too much information and stored in a format, which is difficult to interpret.

Is it possible to take only selected data, especially from the data field (text, intent name, confidence) as well as type_name in a different table? This will help us to analyze the questions for which the Bot couldn’t respond properly.

Any help is greatly appreciated!!!

{"event": "user", "timestamp": 1635786308.4820378, "text": "Hi", "parse_data": {"intent": {"id": -9204443980609379941, "name": "greet", "confidence": 0.9943744540214539}, "entities": [], "text": "Hi", "message_id": "840f149b1b164595b5f7337a08be75cc", "metadata": {}, "intent_ranking": [{"id": -9204443980609379941, "name": "greet", "confidence": 0.9943744540214539}, {"id": 7897185509236808054, "name": "affirm", "confidence": 0.0033705902751535177}, {"id": 6333526711079021391, "name": "goodbye", "confidence": 0.0005133352242410183}, {"id": 7387942895536493345, "name": "Agri_role_only", "confidence": 0.0004108810389880091}, {"id": 6454199406070029610, "name": "mood_great", "confidence": 0.0003981619083788246}, {"id": 8102569156785441440, "name": "option1", "confidence": 0.00024302180099766701}, {"id": -90554067107575790, "name": "only_nutrient", "confidence": 0.00022492994321510196}, {"id": -9061429848448343375, "name": "only_crop", "confidence": 0.00021938339341431856}, {"id": -2168372780928401955, "name": "deny", "confidence": 0.00014103327703196555}, {"id": 8262967115686264830, "name": "bot_challenge", "confidence": 0.00010421311890240759}], "response_selector": {"all_retrieval_intents": [], "default": {"response": {"id": null, "responses": null, "response_templates": null, "confidence": 0.0, "intent_response_key": null, "utter_action": "utter_None", "template_name": "utter_None"}, "ranking": []}}}, "input_channel": "cmdline", "message_id": "840f149b1b164595b5f7337a08be75cc", "metadata": {}}

@rsklearner you can follow to solutions.

  1. You third party open source like Dashboards | Grafana Labs to connect sqlite db or any other data and create some dashboard. PS: check some tutorial videos on youtube, how you can connect the database with grafana.

  2. You can install rasa x and can analyse the data or conversation of bot user and even check the out of scope using NLU inbox or insights. PS: you can follow this thread for clean installation, just follow the steps and ignore which you have already installed : Installing rasa - #7 by nik202

Do let me know, if you having some issue. Good Luck. If this solve your query, please remember to close this thread for other readers and for your own reference. Thanks.

1 Like

Aside from Nik’s good answer, I want to clarify why the tracker is like that and how to properly use it to get what you want without using external tools.

As it should, since anyone could want to query anything from the tracker.

When you see it like that one one line, it is difficult to interpret indeed. But this is JSON format, which is made to be easily readable by both humans and computers. A bit of prettifying and it becomes like that:

{
    "event":"user",
    "timestamp":1635786308.4820378,
    "text":"Hi",
    "parse_data":{
        "intent":{
            "id":-9204443980609379941,
            "name":"greet",
            "confidence":0.9943744540214539
        },
        "entities":[
            
        ],
        "text":"Hi",
        "message_id":"840f149b1b164595b5f7337a08be75cc",
        "metadata":{
            
        },
        "intent_ranking":[
            {
                "id":-9204443980609379941,
                "name":"greet",
                "confidence":0.9943744540214539
            },
            {
                "id":7897185509236808054,
                "name":"affirm",
                "confidence":0.0033705902751535177
            },
            {
                "id":6333526711079021391,
                "name":"goodbye",
                "confidence":0.0005133352242410183
            },
            {
                "id":7387942895536493345,
                "name":"Agri_role_only",
                "confidence":0.0004108810389880091
            },
            {
                "id":6454199406070029610,
                "name":"mood_great",
                "confidence":0.0003981619083788246
            },
            {
                "id":8102569156785441440,
                "name":"option1",
                "confidence":0.00024302180099766701
            },
            {
                "id":-90554067107575790,
                "name":"only_nutrient",
                "confidence":0.00022492994321510196
            },
            {
                "id":-9061429848448343375,
                "name":"only_crop",
                "confidence":0.00021938339341431856
            },
            {
                "id":-2168372780928401955,
                "name":"deny",
                "confidence":0.00014103327703196555
            },
            {
                "id":8262967115686264830,
                "name":"bot_challenge",
                "confidence":0.00010421311890240759
            }
        ],
        "response_selector":{
            "all_retrieval_intents":[
                
            ],
            "default":{
                "response":{
                    "id":null,
                    "responses":null,
                    "response_templates":null,
                    "confidence":0.0,
                    "intent_response_key":null,
                    "utter_action":"utter_None",
                    "template_name":"utter_None"
                },
                "ranking":[
                    
                ]
            }
        }
    },
    "input_channel":"cmdline",
    "message_id":"840f149b1b164595b5f7337a08be75cc",
    "metadata":{
        
    }
}

You could write your own Python function that processes the tracker dictionary and returns the data you want in whatever format you choose. For example:

def format_tracker(tracker):
    return {
        'text': tracker['text'],
        'intent': tracker['parse_data']['intent']['name'],
        'confidence': int(tracker['parse_data']['intent']['confidence'] * 1000)/100
    }

# format_tracker(tracker) =>
#   {'text': 'Hi', 'intent': 'greet', 'confidence': 99.4}
2 Likes

@ChrisRahme Thank you for the information! This is helpful.

@nik202 Thankyou for the info! I’ve the bot in my local and it uses DB, so I hope I cannot use Rasa X. Will explore on your point 1.

@rsklearner No worries! If you having some doubt do let me know and as soon as your issue solved, please close this thread as a solution for others and for your own reference. Good Luck!

1 Like