original_docstring: 
          Fetches the top n identified actions of the bot for a given time
  
          :param month: default is current month and max is last 6 months
          :param collection: collection to connect to
          :param top_n: The first n number of most occurring actions
          :return: list of actions and their counts
          
docstring: Fetches the top n identified actions of the bot for a given time
docstring_tokens: Fetches the top n identified actions of the bot for a given time
code: def top_n_actions(collection: Text, month: int = 1, top_n: int = 10):
  
          """
          Fetches the top n identified actions of the bot for a given time
  
          :param month: default is current month and max is last 6 months
          :param collection: collection to connect to
          :param top_n: The first n number of most occurring actions
          :return: list of actions and their counts
          """
          client, message = HistoryProcessor.get_mongo_connection()
          with client as client:
              try:
                  db = client.get_database()
                  conversations = db.get_collection(collection)
                  values = list(
                      conversations.aggregate([
                          {"$unwind": {"path": "$events", "includeArrayIndex": "arrayIndex"}},
                          {"$match": {"events.timestamp": {"$gte": Utility.get_timestamp_previous_month(month)}}},
                          {"$match": {"events.event": "action"}},
                          {"$match": {"events.name": {"$nin": ['action_listen', 'action_session_start']}}},
                          {"$project": {"action": "$events.name", "_id": 0}},
                          {"$group": {"_id": "$action", "count": {"$sum": 1}}},
                          {"$sort": {"count": -1}},
                          {"$limit": top_n}
                        ]))
  
                  return values, message
              except Exception as e:
                  logger.error(e)
                  raise AppException(e)
code_tokens: def top_n_actions ( collection : Text , month : int = 1 , top_n : int = 10 ) : client , message = HistoryProcessor . get_mongo_connection ( ) with client as client : try : db = client . get_database ( ) conversations = db . get_collection ( collection ) values = list ( conversations . aggregate ( [ { "$unwind" : { "path" : "$events" , "includeArrayIndex" : "arrayIndex" } } , { "$match" : { "events.timestamp" : { "$gte" : Utility . get_timestamp_previous_month ( month ) } } } , { "$match" : { "events.event" : "action" } } , { "$match" : { "events.name" : { "$nin" : [ 'action_listen' , 'action_session_start' ] } } } , { "$project" : { "action" : "$events.name" , "_id" : 0 } } , { "$group" : { "_id" : "$action" , "count" : { "$sum" : 1 } } } , { "$sort" : { "count" : - 1 } } , { "$limit" : top_n } ] ) ) return values , message except Exception as e : logger . error ( e ) raise AppException ( e )
short_docstring: Fetches the top n identified actions of the bot for a given time
short_docstring_tokens: Fetches the top n identified actions of the bot for a given time
comment: """
          Fetches the top n identified actions of the bot for a given time
  
          :param month: default is current month and max is last 6 months
          :param collection: collection to connect to
          :param top_n: The first n number of most occurring actions
          :return: list of actions and their counts
          """