original_docstring: 
          Fallback count for bot.
  
          Counts the number of times, the agent was unable to provide a response to users
  
          :param collection: collection to connect to
          :param month: default is current month and max is last 6 months
          :param fallback_action: fallback action configured for bot
          :param nlu_fallback_action: nlu fallback configured for bot
          :return: list of visitor fallback
          
docstring: Fallback count for bot.
  Counts the number of times, the agent was unable to provide a response to users
docstring_tokens: Fallback count for bot . Counts the number of times the agent was unable to provide a response to users
code: def visitor_hit_fallback(collection: Text,
                               month: int = 1,
                               fallback_action: str = 'action_default_fallback',
                               nlu_fallback_action: str = None):
  
          """
          Fallback count for bot.
  
          Counts the number of times, the agent was unable to provide a response to users
  
          :param collection: collection to connect to
          :param month: default is current month and max is last 6 months
          :param fallback_action: fallback action configured for bot
          :param nlu_fallback_action: nlu fallback configured for bot
          :return: list of visitor fallback
          """
          client, message = HistoryProcessor.get_mongo_connection()
          message = ' '.join([message, f', collection: {collection}'])
          default_actions = Utility.load_default_actions()
          with client as client:
              db = client.get_database()
              conversations = db.get_collection(collection)
              fallback_counts, total_counts = [], []
              try:
                  fallback_counts = list(conversations.aggregate([{"$unwind": "$events"},
                                                                  {"$match": {"events.event": "action",
                                                                              "events.name": {"$nin": default_actions},
                                                                              "events.timestamp": {
                                                                          "$gte": Utility.get_timestamp_previous_month(
                                                                                      month)}}},
                                                                  {"$match": {'$or': [{"events.name": fallback_action},
                                                                                      {
                                                                                  "events.name": nlu_fallback_action}]}},
                                                                  {"$group": {"_id": None,
                                                                              "fallback_count": {"$sum": 1}}},
                                                                  {"$project": {"fallback_count": 1, "_id": 0}}
                                                                  ], allowDiskUse=True))
  
                  total_counts = list(conversations.aggregate([{"$unwind": "$events"},
                                                               {"$match": {"events.event": "action",
                                                                           "events.name": {"$nin": default_actions},
                                                                           "events.timestamp": {
                                                                           "$gte": Utility.get_timestamp_previous_month(
                                                                                   month)}}},
                                                               {"$group": {"_id": None, "total_count": {"$sum": 1}}},
                                                               {"$project": {"total_count": 1, "_id": 0}}
                                                               ], allowDiskUse=True))
  
              except Exception as e:
                  logger.error(e)
                  message = '\n'.join([message, str(e)])
              if not (fallback_counts and total_counts):
                  fallback_count = 0
                  total_count = 0
              else:
                  fallback_count = fallback_counts[0]['fallback_count'] if fallback_counts[0]['fallback_count'] else 0
                  total_count = total_counts[0]['total_count'] if total_counts[0]['total_count'] else 0
              return (
                  {"fallback_count": fallback_count, "total_count": total_count},
                  message,
              )
code_tokens: def visitor_hit_fallback ( collection : Text , month : int = 1 , fallback_action : str = 'action_default_fallback' , nlu_fallback_action : str = None ) : client , message = HistoryProcessor . get_mongo_connection ( ) message = ' ' . join ( [ message , f', collection: {collection}' ] ) default_actions = Utility . load_default_actions ( ) with client as client : db = client . get_database ( ) conversations = db . get_collection ( collection ) fallback_counts , total_counts = [ ] , [ ] try : fallback_counts = list ( conversations . aggregate ( [ { "$unwind" : "$events" } , { "$match" : { "events.event" : "action" , "events.name" : { "$nin" : default_actions } , "events.timestamp" : { "$gte" : Utility . get_timestamp_previous_month ( month ) } } } , { "$match" : { '$or' : [ { "events.name" : fallback_action } , { "events.name" : nlu_fallback_action } ] } } , { "$group" : { "_id" : None , "fallback_count" : { "$sum" : 1 } } } , { "$project" : { "fallback_count" : 1 , "_id" : 0 } } ] , allowDiskUse = True ) ) total_counts = list ( conversations . aggregate ( [ { "$unwind" : "$events" } , { "$match" : { "events.event" : "action" , "events.name" : { "$nin" : default_actions } , "events.timestamp" : { "$gte" : Utility . get_timestamp_previous_month ( month ) } } } , { "$group" : { "_id" : None , "total_count" : { "$sum" : 1 } } } , { "$project" : { "total_count" : 1 , "_id" : 0 } } ] , allowDiskUse = True ) ) except Exception as e : logger . error ( e ) message = '\n' . join ( [ message , str ( e ) ] ) if not ( fallback_counts and total_counts ) : fallback_count = 0 total_count = 0 else : fallback_count = fallback_counts [ 0 ] [ 'fallback_count' ] if fallback_counts [ 0 ] [ 'fallback_count' ] else 0 total_count = total_counts [ 0 ] [ 'total_count' ] if total_counts [ 0 ] [ 'total_count' ] else 0 return ( { "fallback_count" : fallback_count , "total_count" : total_count } , message , )
short_docstring: Fallback count for bot.
short_docstring_tokens: Fallback count for bot .
comment: """
          Fallback count for bot.
  
          Counts the number of times, the agent was unable to provide a response to users
  
          :param collection: collection to connect to
          :param month: default is current month and max is last 6 months
          :param fallback_action: fallback action configured for bot
          :param nlu_fallback_action: nlu fallback configured for bot
          :return: list of visitor fallback
          """