Example #1
0
def removeAnnotation(exp_id, annotations_id, instance_id):
    annotations_db_tools.remove_annotation(session, annotations_id,
                                           instance_id)
    session.commit()
    if user_exp:
        exp = update_curr_exp(exp_id)
        filename = path.join(exp.output_dir(), 'user_actions.log')
        file_exists = path.isfile(filename)
        mode = 'a' if file_exists else 'w'
        to_print = ','.join(map(str, [datetime.datetime.now(),
                                      'remove_annotation', instance_id]))
        with open(filename, mode) as f:
            f.write(to_print)
    return ''
Example #2
0
def changeFamilyLabel(exp_id, annotations_id, label, family):
    annotations_db_tools.change_family_label(session, annotations_id, label,
                                             family)
    session.commit()
    if user_exp:
        exp = update_curr_exp(exp_id)
        filename = path.join(exp.output_dir(), 'user_actions.log')
        file_exists = path.isfile(filename)
        mode = 'a' if file_exists else 'w'
        to_print = ','.join(map(str, [datetime.datetime.now(),
                                      'change_family_label', family, label]))
        with open(filename, mode) as f:
            f.write(to_print)
    return ''
Example #3
0
def mergeFamilies(exp_id, annotations_id, label, families, new_family):
    families = families.split(',')
    annotations_db_tools.merge_families(session, annotations_id, label,
                                        families, new_family)
    session.commit()
    if user_exp:
        exp = update_curr_exp(exp_id)
        filename = path.join(exp.output_dir(), 'user_actions.log')
        file_exists = path.isfile(filename)
        mode = 'a' if file_exists else 'w'
        to_print = ','.join(
            map(str, [datetime.datetime.now(), 'merge_families', new_family] +
                families))
        with open(filename, mode) as f:
            f.write(to_print)
    return ''
Example #4
0
def updateAnnotation(exp_id, annotations_id, iter_num, instance_id, label,
                     family, method):
    iter_num = None if iter_num == 'None' else int(iter_num)
    annotations_db_tools.update_annotation(session, annotations_id,
                                           instance_id, label, family,
                                           iter_num, method)
    session.commit()
    if user_exp:
        exp = update_curr_exp(exp_id)
        filename = path.join(exp.output_dir(), 'user_actions.log')
        file_exists = path.isfile(filename)
        mode = 'a' if file_exists else 'w'
        to_print = ','.join(map(str, [datetime.datetime.now(),
                                      'update_annotation',
                                      iter_num, instance_id, label, family,
                                      method]))
        with open(filename, mode) as f:
            f.write(to_print)
    return ''