def list_annotations(image_pid,assignment_pid=None): if assignment_pid is not None: return jsonr(list(my(ANNOTATION_STORE).list_annotations(image=image_pid,assignment=assignment_pid))) else: return jsonr(list(my(ANNOTATION_STORE).list_annotations(image=image_pid)))
def fetch_assignment(assignment_pid): return jsonr(my(ASSIGNMENT_STORE).fetch_assignment(assignment_pid))
def fetch_annotation(pid): return jsonr(my(ANNOTATION_STORE).fetch_annotation(pid))
def deprecate_annotation(pid): if not 'username' in session: abort(401) return jsonr(my(ANNOTATION_STORE).deprecate_annotation(pid))
def list_categories(mode,scope=None): return jsonr(list(my(CATEGORIES).list_categories(mode,scope)))
def category_autocomplete(mode,scope=None): stem = request.values['term'] return jsonr(list(stem_search(stem,mode,scope)))
def list_idmodes(): return jsonr({'idmodes': my(ASSIGNMENT_STORE).list_idmodes()})
def list_assignments(): return jsonr({'assignments': my(ASSIGNMENT_STORE).list_assignments()})
def set_status(assignment_id,image_id,status,post_status=None): assignment_id = urllib.unquote(assignment_id) status = urllib.unquote_plus(status) my(ASSIGNMENT_STORE).set_status(assignment_id,image_id,status) return jsonr(dict(status='OK',new_image_status=status))
def find_image(offset,status,post_status=None,assignment_pid=None): return jsonr(dict(offset=my(ASSIGNMENT_STORE).find_image(assignment_pid,offset,status,post_status)))
def list_images(limit,offset,assignment_pid,status=None): return jsonr(list(my(ASSIGNMENT_STORE).list_images(assignment_pid,limit,offset,status)))