original_docstring: 
          List conversation events.
  
          Loads list of conversation events from chat history
  
          :param month: default is current month and max is last 6 months
          :param collection: collection to connect to
          :param sender_id: user id
          :return: list of conversation events
          
docstring: List conversation events.
  Loads list of conversation events from chat history
docstring_tokens: List conversation events . Loads list of conversation events from chat history
code: def fetch_user_history(collection: Text, sender_id: Text, month: int = 1):
  
          """
          List conversation events.
  
          Loads list of conversation events from chat history
  
          :param month: default is current month and max is last 6 months
          :param collection: collection to connect to
          :param sender_id: user id
          :return: list of conversation events
          """
          client, message = HistoryProcessor.get_mongo_connection()
          message = ' '.join([message, f', collection: {collection}'])
          with client as client:
              try:
                  db = client.get_database()
                  conversations = db.get_collection(collection)
                  values = list(conversations
                                .aggregate([{"$match": {"sender_id": sender_id}},
                                            {"$unwind": {"path": "$events", "includeArrayIndex": "arrayIndex"}},
                                            {"$match": {"events.timestamp": {"$gte": Utility.get_timestamp_previous_month(month)}}},
                                            {"$match": {"events.event": {"$in": ["user", "bot", "action"]}}},
                                            {"$group": {"_id": None, "events": {"$push": "$events"}}},
                                            {"$project": {"_id": 0, "events": 1}}])
                                )
                  if values:
                      return (
                          values[0]['events'],
                          message
                      )
                  return [], message
              except ServerSelectionTimeoutError as e:
                  logger.error(e)
                  raise AppException(f'Could not connect to tracker: {e}')
              except Exception as e:
                  logger.error(e)
                  raise AppException(e)
code_tokens: def fetch_user_history ( collection : Text , sender_id : Text , month : int = 1 ) : client , message = HistoryProcessor . get_mongo_connection ( ) message = ' ' . join ( [ message , f', collection: {collection}' ] ) with client as client : try : db = client . get_database ( ) conversations = db . get_collection ( collection ) values = list ( conversations . aggregate ( [ { "$match" : { "sender_id" : sender_id } } , { "$unwind" : { "path" : "$events" , "includeArrayIndex" : "arrayIndex" } } , { "$match" : { "events.timestamp" : { "$gte" : Utility . get_timestamp_previous_month ( month ) } } } , { "$match" : { "events.event" : { "$in" : [ "user" , "bot" , "action" ] } } } , { "$group" : { "_id" : None , "events" : { "$push" : "$events" } } } , { "$project" : { "_id" : 0 , "events" : 1 } } ] ) ) if values : return ( values [ 0 ] [ 'events' ] , message ) return [ ] , message except ServerSelectionTimeoutError as e : logger . error ( e ) raise AppException ( f'Could not connect to tracker: {e}' ) except Exception as e : logger . error ( e ) raise AppException ( e )
short_docstring: List conversation events.
short_docstring_tokens: List conversation events .
comment: """
          List conversation events.
  
          Loads list of conversation events from chat history
  
          :param month: default is current month and max is last 6 months
          :param collection: collection to connect to
          :param sender_id: user id
          :return: list of conversation events
          """