def add_image_description(self, description: str): get_mongo_client()['sessions'].update( {'_id': self.session_id}, {'$set': { 'image': { 'description': description } }})
def add_image(self, image_type: str, image: bytes): get_mongo_client()['sessions'].update( {'_id': self.session_id}, {'$set': { 'image': { 'type': image_type, 'content': image } }})
def add_target_frame(self, frame_id: int): get_mongo_client()['sessions'].update({'_id': self.session_id}, {'$push': { 'frames': frame_id }})
def clear_image(self): get_mongo_client()['sessions'].update({'_id': self.session_id}, {'$unset': { 'image': None }})
def _get_session(self): return get_mongo_client()['sessions'].find_one( {'_id': self.session_id})
def _start_new_session(self): timestamp = dt.datetime.utcnow() get_mongo_client()['sessions'].insert({ '_id': self.session_id, 'timestamp': timestamp })