scout/server/blueprints/cases/views.py
def pdf_case_report(institute_id, case_name):
    """Download a pdf report for a case"""

    institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
    data = controllers.case_report_content(store, institute_obj, case_obj)

    # add coverage report on the bottom of this report
    if current_app.config.get('SQLALCHEMY_DATABASE_URI'):
        data['coverage_report'] = controllers.coverage_report_contents(store, institute_obj, case_obj, request.url_root)

    # workaround to be able to print the case pedigree to pdf
    if case_obj.get('madeline_info') is not None:
        with open(os.path.join(cases_bp.static_folder, 'madeline.svg'), 'w') as temp_madeline:
            temp_madeline.write(case_obj['madeline_info'])

    html_report = render_template('cases/case_report.html', institute=institute_obj, case=case_obj, format='pdf', **data)
    return render_pdf(HTML(string=html_report), download_filename=case_obj['display_name']+'_'+datetime.datetime.now().strftime("%Y-%m-%d")+'_scout.pdf')
def pdf_case_report(institute_id, case_name):
    """Download a pdf report for a case"""

    institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
    data = controllers.case_report_content(store, institute_obj, case_obj)

    # add coverage report on the bottom of this report
    if current_app.config.get('SQLALCHEMY_DATABASE_URI'):
        data['coverage_report'] = controllers.coverage_report_contents(store, institute_obj, case_obj, request.url_root)

    # workaround to be able to print the case pedigree to pdf
    if case_obj.get('madeline_info') is not None:
        with open(os.path.join(cases_bp.static_folder, 'madeline.svg'), 'w') as temp_madeline:
            temp_madeline.write(case_obj['madeline_info'])

    html_report = render_template('cases/case_report.html', institute=institute_obj, case=case_obj, format='pdf', **data)
    return render_pdf(HTML(string=html_report), download_filename=case_obj['display_name']+'_'+datetime.datetime.now().strftime("%Y-%m-%d")+'_scout.pdf')
Download a pdf report for a case