cmp.viz.reports module

Definitions of classes and functions for building Connectome Mapper reports

Ongoing…

References

Based on fMRIprep v1.3.2 report builder.

class cmp.viz.reports.Element(name, title=None)[source]

Bases: object

Just a basic component of a report

class cmp.viz.reports.Report(path, config, out_dir, run_uuid, out_filename='report.html', sentry_sdk=None)[source]

Bases: object

The full report object

generate_report()[source]
index(config)[source]
Parameters

config

index_error_dir(error_dir)[source]

Crawl subjects crash directory for the corresponding run, report to sentry, and populate self.errors.

class cmp.viz.reports.Reportlet(name, file_pattern=None, title=None, description=None, raw=False)[source]

Bases: cmp.viz.reports.Element

A reportlet has title, description and a list of graphical components

class cmp.viz.reports.SubReport(name, reportlets=None, title='')[source]

Bases: cmp.viz.reports.Element

SubReports are sections within a Report

cmp.viz.reports.generate_name_title(filename)[source]
Parameters

filename

cmp.viz.reports.generate_reports(subject_list, output_dir, work_dir, run_uuid, sentry_sdk=None)[source]

A wrapper to run_reports on a given subject_list

cmp.viz.reports.order_by_run(subreport)[source]
Parameters

subreport

cmp.viz.reports.run_reports(reportlets_dir, out_dir, subject_label, run_uuid, sentry_sdk=None)[source]

Runs the reports >>> import os >>> from shutil import copytree >>> from tempfile import TemporaryDirectory >>> filepath = os.path.dirname(os.path.realpath(__file__)) >>> test_data_path = os.path.realpath(os.path.join(filepath, … ‘../data/tests/work’)) >>> curdir = os.getcwd() >>> tmpdir = TemporaryDirectory() >>> os.chdir(tmpdir.name) >>> data_dir = copytree(test_data_path, os.path.abspath(‘work’)) >>> os.makedirs(‘out/fmriprep’, exist_ok=True) >>> run_reports(os.path.abspath(‘work/reportlets’), … os.path.abspath(‘out’), … ‘01’, ‘madeoutuuid’) 0 >>> os.chdir(curdir) >>> tmpdir.cleanup()