Esempio n. 1
0
def insert_into_log(project_id,
                    user_id,
                    op_type,
                    location=None,
                    freetext=None):
    # valid operation types
    operation_type_array = [
        "rename_root", "create_neuron", "rename_neuron", "remove_neuron",
        "move_neuron", "create_group", "rename_group", "remove_group",
        "move_group", "create_skeleton", "rename_skeleton", "remove_skeleton",
        "move_skeleton", "split_skeleton", "join_skeleton", "reroot_skeleton",
        "change_confidence"
    ]

    if not op_type in operation_type_array:
        return {'error': 'Operation type {0} not valid'.format(op_type)}

    new_log = Log()
    new_log.user_id = user_id
    new_log.project_id = project_id
    new_log.operation_type = op_type
    if not location is None:
        new_log.location = location
    if not freetext is None:
        new_log.freetext = freetext

    new_log.save()
Esempio n. 2
0
def insert_into_log(project_id,
                    user_id,
                    op_type,
                    location=None,
                    freetext=None):
    """ Inserts a new entry into the log table. If the location parameter is
    passed, it is expected to be an iteratable (list, tuple).
    """
    # valid operation types
    operation_type_array = [
        "rename_root", "create_neuron", "rename_neuron", "remove_neuron",
        "move_neuron", "create_group", "rename_group", "remove_group",
        "move_group", "create_skeleton", "rename_skeleton", "remove_skeleton",
        "move_skeleton", "split_skeleton", "join_skeleton", "reroot_skeleton",
        "change_confidence", "reset_reviews"
    ]

    if not op_type in operation_type_array:
        return {'error': 'Operation type {0} not valid'.format(op_type)}

    new_log = Log()
    new_log.user_id = user_id
    new_log.project_id = project_id
    new_log.operation_type = op_type
    if not location is None:
        new_log.location = Double3D(*location)
    if not freetext is None:
        new_log.freetext = freetext

    new_log.save()
Esempio n. 3
0
def insert_into_log(project_id: Union[int, str],
                    user_id,
                    op_type: str,
                    location=None,
                    freetext=None) -> Optional[Dict[str, str]]:
    """ Inserts a new entry into the log table. If the location parameter is
    passed, it is expected to be an iteratable (list, tuple).
    """
    # valid operation types
    operation_type_array = [
        "rename_root", "create_neuron", "rename_neuron", "remove_neuron",
        "move_neuron", "create_group", "rename_group", "remove_group",
        "move_group", "create_skeleton", "rename_skeleton", "remove_skeleton",
        "move_skeleton", "split_skeleton", "join_skeleton", "reroot_skeleton",
        "change_confidence", "reset_reviews"
    ]

    if op_type not in operation_type_array:
        raise ValueError(f'Operation type {op_type} not valid')

    new_log = Log()
    new_log.user_id = user_id
    new_log.project_id = project_id
    new_log.operation_type = op_type
    if location is not None:
        new_log.location = Double3D(*location)
    if freetext is not None:
        new_log.freetext = freetext

    new_log.save()
    return None
Esempio n. 4
0
def insert_into_log(project_id, user_id, op_type, location=None, freetext=None):
    """ Inserts a new entry into the log table. If the location parameter is
    passed, it is expected to be an iteratable (list, tuple).
    """
    # valid operation types
    operation_type_array = [
        "rename_root",
        "create_neuron",
        "rename_neuron",
        "remove_neuron",
        "move_neuron",

        "create_group",
        "rename_group",
        "remove_group",
        "move_group",

        "create_skeleton",
        "rename_skeleton",
        "remove_skeleton",
        "move_skeleton",

        "split_skeleton",
        "join_skeleton",
        "reroot_skeleton",

        "change_confidence",

        "reset_reviews"
    ]

    if not op_type in operation_type_array:
        return {'error': 'Operation type {0} not valid'.format(op_type)}

    new_log = Log()
    new_log.user_id = user_id
    new_log.project_id = project_id
    new_log.operation_type = op_type
    if location is not None:
        new_log.location = Double3D(*location)
    if freetext is not None:
        new_log.freetext = freetext

    new_log.save()
Esempio n. 5
0
def insert_into_log(project_id, user_id, op_type, location=None, freetext=None):
    # valid operation types
    operation_type_array = [
        "rename_root",
        "create_neuron",
        "rename_neuron",
        "remove_neuron",
        "move_neuron",

        "create_group",
        "rename_group",
        "remove_group",
        "move_group",

        "create_skeleton",
        "rename_skeleton",
        "remove_skeleton",
        "move_skeleton",

        "split_skeleton",
        "join_skeleton",
        "reroot_skeleton",

        "change_confidence"
    ]

    if not op_type in operation_type_array:
        return {'error': 'Operation type {0} not valid'.format(op_type)}

    new_log = Log()
    new_log.user_id = user_id
    new_log.project_id = project_id
    new_log.operation_type = op_type
    if not location is None:
        new_log.location = location
    if not freetext is None:
        new_log.freetext = freetext

    new_log.save()