scout/commands/export/case.py
def cases(context, case_id, institute, reruns, finished, causatives, research_requested,
          is_research, status, json):
    """Interact with cases existing in the database."""
    adapter = context.obj['adapter']

    models = []
    if case_id:
        case_obj = adapter.case(case_id=case_id)
        if case_obj:
            models.append(case_obj)
        else:
            LOG.info("No case with id {}".format(case_id))

    else:
        models = adapter.cases(collaborator=institute, reruns=reruns,
                           finished=finished, has_causatives=causatives,
                           research_requested=research_requested,
                           is_research=is_research, status=status)
        models = [case_obj for case_obj in models]
        if len(models) == 0:
            LOG.info("No cases could be found")

    if json:
        click.echo(dumps(models))
        return

    for model in models:
        pp(model)
def cases(context, case_id, institute, reruns, finished, causatives, research_requested,
          is_research, status, json):
    """Interact with cases existing in the database."""
    adapter = context.obj['adapter']

    models = []
    if case_id:
        case_obj = adapter.case(case_id=case_id)
        if case_obj:
            models.append(case_obj)
        else:
            LOG.info("No case with id {}".format(case_id))

    else:
        models = adapter.cases(collaborator=institute, reruns=reruns,
                           finished=finished, has_causatives=causatives,
                           research_requested=research_requested,
                           is_research=is_research, status=status)
        models = [case_obj for case_obj in models]
        if len(models) == 0:
            LOG.info("No cases could be found")

    if json:
        click.echo(dumps(models))
        return

    for model in models:
        pp(model)
Interact with cases existing in the database.