scout/commands/delete/delete_command.py
def case(context, institute, case_id, display_name):
    """Delete a case and it's variants from the database"""
    adapter = context.obj['adapter']
    if not (case_id or display_name):
        click.echo("Please specify what case to delete")
        context.abort()

    if display_name:
        if not institute:
            click.echo("Please specify the owner of the case that should be "
                       "deleted with flag '-i/--institute'.")
            context.abort()
        case_id = "{0}-{1}".format(institute, display_name)

    LOG.info("Running deleting case {0}".format(case_id))
    case = adapter.delete_case(
        case_id=case_id,
        institute_id=institute,
        display_name=display_name
    )

    if case.deleted_count == 1:
        adapter.delete_variants(case_id=case_id, variant_type='clinical')
        adapter.delete_variants(case_id=case_id, variant_type='research')
    else:
        LOG.warning("Case does not exist in database")
        context.abort()
def case(context, institute, case_id, display_name):
    """Delete a case and it's variants from the database"""
    adapter = context.obj['adapter']
    if not (case_id or display_name):
        click.echo("Please specify what case to delete")
        context.abort()

    if display_name:
        if not institute:
            click.echo("Please specify the owner of the case that should be "
                       "deleted with flag '-i/--institute'.")
            context.abort()
        case_id = "{0}-{1}".format(institute, display_name)

    LOG.info("Running deleting case {0}".format(case_id))
    case = adapter.delete_case(
        case_id=case_id,
        institute_id=institute,
        display_name=display_name
    )

    if case.deleted_count == 1:
        adapter.delete_variants(case_id=case_id, variant_type='clinical')
        adapter.delete_variants(case_id=case_id, variant_type='research')
    else:
        LOG.warning("Case does not exist in database")
        context.abort()
Delete a case and it's variants from the database