def public_trained_projects(organisation_name): """ :param organisation_name: :return: """ manager = ProjectManager() query = { "$and": [{ "organisation_name": organisation_name }, { "visibility": "public" }, { "ner.status": "trained" }, { "ir.status": "trained" }, { "masterBot": False }] } # query = {"$and": [{"visibility": "public"}, {"ner.status": "trained"}, {"ir.status": "trained"}, # {"masterBot": False}]} projection = {"name": 1, "serviceid": 1} data = manager.exists(query) if data: projects_to_import = manager.find(query, projection) logger.info("public trained projects found in PR DB") return projects_to_import else: return False
def user_trained_projects(userid): """ :param userid: :return: """ manager = ProjectManager() query = { "$and": [{ "createdBy": ObjectId(userid) }, { "ner.status": "trained" }, { "ir.status": "trained" }, { "visibility": "private" }, { "masterBot": False }] } # query = {"$and": [{"createdBy": ObjectId(userid)}, {"ner.status": "trained"}, {"ir.status": "trained"}, # {"visibility": "private"}]} projection = {"name": 1, "serviceid": 1} data = manager.exists(query) if data: projects_to_import = manager.find(query, projection) logger.info("user trained projects found in PR DB.") return projects_to_import else: return False