Example #1
0
def samples():
    """List all samples."""
    per_page = current_app.config['ITEMS_PER_PAGE']
    page = int(request.args.get('page', 1))
    query = request.args.get('query')
    sample_q = db.samples(query_str=query)

    if sample_q.count() == 1:
        # send the user directly to the sample details
        sample_obj = sample_q.first()
        return redirect(url_for('.sample', sample_id=sample_obj.id))

    else:
        page = sample_q.paginate(page, per_page=per_page)
        return render_template('samples.html', page=page, query=query)
Example #2
0
def dashboard():
    """Show details for a case."""
    tot_samples = db.samples().count()
    sequenced = db.samples(sequenced=True).count()
    delivered = db.samples(delivered=True).count()
    invoiced = db.samples(invoiced=True).count()
    archived = db.samples(archived=True).count()
    genotyped = db.samples(genotyped=True).count()
    percents = dict(
        sequenced=(sequenced / tot_samples * 100),
        delivered=(delivered / tot_samples * 100),
        invoiced=(invoiced / tot_samples * 100),
        archived=(archived / tot_samples * 100),
        genotyped=(genotyped / tot_samples * 100),
    )
    failed = db.samples(maf_fail=True)
    to_rerun = db.cases(rerun=True)
    to_research = db.cases(research=True)
    return render_template('dashboard.html', samples=tot_samples,
                           percents=percents, failed=failed, reruns=to_rerun,
                           research=to_research)