def review_connection_reset(connection_name, connection_id): connection_service.reset_records(user_service.get_current_username(), connection_id) doc = connection_service.get_next_record( user_service.get_current_username(), connection_id) regex_filters = regex_filter_service.get_regex_filters(connection_id) return { 'connection_name': connection_name, 'connection_url': connection_id, 'regex_filters': regex_filters, 'previous': None, 'progress': {}, 'document': doc, 'history': [], }
def reviewer_next(project_url_name, annotation_id, subproject_url_name=None): project_name = urllib.parse.unquote_plus(project_url_name) subproject_name = urllib.parse.unquote_plus(subproject_url_name) if subproject_url_name else None username = user_service.get_current_username() annotation_service.mark_annotation_completed(project_name, username, annotation_id) annot = annotation_service.get_next_annotation(project_name, username, subproject_name) return _make_reviewer_response(annot, project_name, subproject_name)
def _make_reviewer_response(annot, project_name, subproject_name): username = user_service.get_current_username() subproject = None if subproject_name: subproject = { 'name': subproject_name, 'name_url': urllib.parse.quote_plus(subproject_name) } if annot: return flask.render_template('review/reviewer.html', **{ 'user': user_service.get_current_user(), 'project': project_service.get_project_details(project_name), 'document': annot, 'history': history_service.get_history_for_link(project_name, username, subproject_name=subproject_name), 'previous': history_service.get_previous_annotation_id(project_name, username, annot['annotation_id'], subproject_name=subproject_name), 'progress': abu_service.get_abu_progress(project_name, username, subproject_name), 'subproject': subproject, }) else: return flask.render_template('review/done.html', **{ 'user': user_service.get_current_user(), 'project': project_service.get_project_details(project_name), 'history': history_service.get_history_for_link(project_name, username, subproject_name=subproject_name), 'previous': None, })
def add_regex(project_url_name): errors = [] data = flask.request.get_json() project_name = urllib.parse.unquote_plus(project_url_name) highlight_service.add_highlight(user_service.get_current_username(), project_name, data['regex']) return { 'errors': errors, }
def create_connection(): data = flask.request.get_json() success, message = connection_service.create_connection( user_service.get_current_username(), **data) return { 'status': success, 'message': message, }
def review_connection_mark_done(connection_name, connection_id, name_url): errors = [] connection_service.mark_done(connection_id, urllib.parse.unquote_plus(name_url), user_service.get_current_username()) return { 'errors': errors, }
def review_connection_update(connection_name, connection_id, name_url): data = flask.request.get_json() errors = [] connection_service.update_tbc(connection_id, urllib.parse.unquote_plus(name_url), user_service.get_current_username(), **data) return { 'errors': errors, }
def remove_regex(project_url_name): errors = [] data = flask.request.get_json() project_name = urllib.parse.unquote_plus(project_url_name) res = highlight_service.remove_highlight(user_service.get_current_username(), project_name, data['regex']) if res: errors.append(res) return { 'errors': errors, }
def build(): return { 'user': user_service.get_display_name(), 'projects': user_service.get_projects(), 'tools': tool_service.get_all_tools(), 'connections': connection_service.get_connections( user_service.get_current_username()), }
def project_home(project_url_name): project_name = urllib.parse.unquote_plus(project_url_name) return { 'user': user_service.get_current_user(), 'project_details': project_service.get_project_details(project_name), 'subprojects': project_service.get_subprojects(project_name), 'review_details': abu_service.get_abu_details( project_name, user_service.get_current_username(), ), 'tools': tool_service.get_all_tools(), 'annotation_summary': annotation_service.get_annotation_responses( project_name, user_service.get_current_username(), ) }
def add_regex_filter(connection_id, regex, include, exclude, ignore): conn = Connection.objects(id=connection_id).first() rx_filter = Filter( connection_id=connection_id, username=user_service.get_current_username(), project_name=conn.project_name, connection_name=conn.connection_name, regex=regex, include_flag=include, exclude_flag=exclude, ignore_flag=ignore, active=True, ) rx_filter.save() return []
def reviewer_specific(project_url_name, annotation_id, subproject_url_name=None): project_name = urllib.parse.unquote_plus(project_url_name) subproject_name = urllib.parse.unquote_plus(subproject_url_name) if subproject_url_name else None annot = annotation_service.get_annotation_by_id(project_name, annotation_id, user_service.get_current_username(), subproject_name) return _make_reviewer_response(annot, project_name, subproject_name)
def review_connection_add_response(connection_name, connection_id): data = flask.request.get_json() errors = connection_service.add_response( user_service.get_current_username(), connection_id, data['response']) return {'errors': errors}