original_docstring: 
          Computes the trend for conversation count
  
          :param collection: collection to connect to
          :param month: default is 6 months
          :return: dictionary of counts of bot conversations for the previous months
          
docstring: Computes the trend for conversation count
docstring_tokens: Computes the trend for conversation count
code: def total_conversation_range(collection: Text, month: int = 6):
  
          """
          Computes the trend for conversation count
  
          :param collection: collection to connect to
          :param month: default is 6 months
          :return: dictionary of counts of bot conversations for the previous months
          """
  
          client, message = HistoryProcessor.get_mongo_connection()
          message = ' '.join([message, f', collection: {collection}'])
          with client as client:
              db = client.get_database()
              conversations = db.get_collection(collection)
              total = []
              try:
                  total = list(
                      conversations.aggregate([
                          {"$unwind": {"path": "$events", "includeArrayIndex": "arrayIndex"}},
                          {"$match": {"events.timestamp": {"$gte": Utility.get_timestamp_previous_month(month)}}},
                          {"$addFields": {"month": {"$month": {"$toDate": {"$multiply": ["$events.timestamp", 1000]}}}}},
  
                          {"$group": {"_id": {"month": "$month", "sender_id": "$sender_id"}}},
                          {"$group": {"_id": "$_id.month", "count": {"$sum": 1}}},
                          {"$project": {"_id": 1, "count": 1}}
                      ]))
  
              except Exception as e:
                  logger.error(e)
                  message = '\n'.join([message, str(e)])
              total_users = {d['_id']: d['count'] for d in total}
              return (
                  {"total_conversation_range": total_users},
                  message
              )
code_tokens: def total_conversation_range ( collection : Text , month : int = 6 ) : client , message = HistoryProcessor . get_mongo_connection ( ) message = ' ' . join ( [ message , f', collection: {collection}' ] ) with client as client : db = client . get_database ( ) conversations = db . get_collection ( collection ) total = [ ] try : total = list ( conversations . aggregate ( [ { "$unwind" : { "path" : "$events" , "includeArrayIndex" : "arrayIndex" } } , { "$match" : { "events.timestamp" : { "$gte" : Utility . get_timestamp_previous_month ( month ) } } } , { "$addFields" : { "month" : { "$month" : { "$toDate" : { "$multiply" : [ "$events.timestamp" , 1000 ] } } } } } , { "$group" : { "_id" : { "month" : "$month" , "sender_id" : "$sender_id" } } } , { "$group" : { "_id" : "$_id.month" , "count" : { "$sum" : 1 } } } , { "$project" : { "_id" : 1 , "count" : 1 } } ] ) ) except Exception as e : logger . error ( e ) message = '\n' . join ( [ message , str ( e ) ] ) total_users = { d [ '_id' ] : d [ 'count' ] for d in total } return ( { "total_conversation_range" : total_users } , message )
short_docstring: Computes the trend for conversation count
short_docstring_tokens: Computes the trend for conversation count
comment: """
          Computes the trend for conversation count
  
          :param collection: collection to connect to
          :param month: default is 6 months
          :return: dictionary of counts of bot conversations for the previous months
          """