def delete_project(project_name): # Get the project id project_id = DBProxy.get_project_id(project_name) if project_id is None: return 'project not found', 'warning' # Delete sorting proxy and logs DBProxy.delete_sorting_proxy(project_name=project_name) # Delete doc pairs DBProxy.delete_doc_pairs(project_id) # Delete project itself DBProxy.delete_project(project_id) return f'project {project_name} deleted', 'success'
def process_doc_pairs(proxy, proxy_id): logging.info('in process_doc_pairs') project_id = DBProxy.get_project_id(proxy.project_name) all_pairs = DBProxy.get_completed_doc_pairs(project_id) if len(all_pairs) < len(proxy.get_round_list()): return 'not all pairs have been judged yet' # Submit all comparisons to proxy for pair in all_pairs: print(f'sending comparison for {pair}') if pair.doc1_id == pair.preferred_id: proxy.make_comparison(pair.doc1_id, pair.doc2_id) elif pair.doc2_id == pair.preferred_id: proxy.make_comparison(pair.doc1_id, pair.doc2_id) else: raise KeyError('docpair marked complete without indicating preferred_id') # DBProxy.update_proxy(proxy_id, proxy=proxy) DBProxy.delete_doc_pairs(project_id)