Esempio n. 1
0
File: view.py Progetto: zabano/dx
def show_reports():

    form = FlaskForm()
    if form.validate_on_submit():

        vcf_id = request.form['vcfs'].split(',')[0]
        url = urlparse.urlparse(request.form['url'])
        args = MultiDict(urlparse.parse_qsl(url.query))
        response = jsonapi.get_related(db, args, 'vcfs', vcf_id, 'calls')
        title = request.form.get('title')
        if response.status == requests.codes.ok:
            report = Report(title)
            report.vcfs = [VCF.query.get(vcf_id)]
            report.creator = current_user
            report.project = Project.query.get(request.form.get('project'))
            report.panels = Panel.query.filter(Panel.id.in_(request.form.get('panels').split(','))).all()
            report.fisher = request.form.get('fisher')
            report.artifact = request.form.get('artifact')
            report.frequency = request.form.get('frequency')
            report.depth = request.form.get('depth')
            report.content = cPickle.dumps(response.document)
            db.add(report)
            try:
                db.commit()
            except SQLAlchemyError:
                flash("Error saving report: '{0}'. Please try again later.".format(title), category='danger')
            else:
                flash("Report: '{0}' saved successfully.".format(title), category='success')

    admin = current_user.is_authenticated and PERMISSION.MANAGE_REPORT_REQUEST in current_user.permissions
    return render_template('reports/index.html', admin=admin)
Esempio n. 2
0
def get_project_categories(project_id):
    response = jsonapi.get_related(db.session, request.args, 'project-categories', project_id, 'project')
    return jsonify(response.document), response.status
Esempio n. 3
0
def get_project(project_id):
    response = jsonapi.get_related(db.session, request.args, 'projects', project_id, 'members')
    return jsonify(response.document), response.status
Esempio n. 4
0
def get_variant_gene_targets(variant_id):
    response = jsonapi.get_related(db, request.args, 'variants', variant_id, 'targets')
    return jsonify(response.document), response.status
Esempio n. 5
0
def get_subject_vcfs(subject_id):
    response = jsonapi.get_related(db, request.args, 'subjects', subject_id, 'vcfs')
    return jsonify(response.document), response.status
Esempio n. 6
0
def get_user_address(user_id):
    response = jsonapi.get_related(db.session, request.args, 'users', user_id,
                                   'address')
    return jsonify(response.document), response.status
Esempio n. 7
0
File: vcfs.py Progetto: zabano/dx
def get_vcf_calls(vcf_id):
    response = jsonapi.get_related(db, request.args, 'vcfs', vcf_id, 'calls')
    return jsonify(response.document), response.status
Esempio n. 8
0
def get_project(project_id):
    response = jsonapi.get_related(db.session, request.args, 'projects',
                                   project_id, 'members')
    return jsonify(response.document), response.status
Esempio n. 9
0
def get_user_survey_checkbox_choices(user_survey_id):
    response = jsonapi.get_related(db.session, request.args, 'user-surveys',
                                   user_survey_id, 'checkbox-choices')
    return jsonify(response.document), response.status
Esempio n. 10
0
def get_project_reports(project_id):
    response = jsonapi.get_related(db, request.args, 'projects', project_id, 'reports')
    return jsonify(response.document), response.status
Esempio n. 11
0
def get_user_survey_radio_fields(user_survey_id):
    response = jsonapi.get_related(db.session, request.args, 'user-surveys',
                                   user_survey_id, 'radio-fields')
    return jsonify(response.document), response.status
Esempio n. 12
0
def get_core_posts(core_id):
    response = jsonapi.get_related(db.session, request.args, 'cores', core_id, 'posts')
    return jsonify(response.document), response.status
Esempio n. 13
0
File: genes.py Progetto: zabano/dx
def get_gene_gene_targets(gene_id):
    response = jsonapi.get_related(db, request.args, 'genes', gene_id, 'targets')
    return jsonify(response.document), response.status
Esempio n. 14
0
def get_user_survey_radio_fields(user_survey_id):
    response = jsonapi.get_related(db.session, request.args, 'user-surveys', user_survey_id, 'radio-fields')
    return jsonify(response.document), response.status
Esempio n. 15
0
def get_project_categories(project_id):
    response = jsonapi.get_related(db.session, request.args,
                                   'project-categories', project_id, 'project')
    return jsonify(response.document), response.status
Esempio n. 16
0
def get_user_survey_checkbox_choices(user_survey_id):
    response = jsonapi.get_related(db.session, request.args, 'user-surveys', user_survey_id, 'checkbox-choices')
    return jsonify(response.document), response.status
Esempio n. 17
0
def get_user_address(user_id):
    response = jsonapi.get_related(db.session, request.args, 'users', user_id, 'address')
    return jsonify(response.document), response.status