Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BciPy Report #325

Merged
merged 4 commits into from
May 30, 2024
Merged

Add BciPy Report #325

merged 4 commits into from
May 30, 2024

Conversation

tab-cmd
Copy link
Contributor

@tab-cmd tab-cmd commented May 27, 2024

Overview

Add BciPy reporting functionality using reportlab. This PR implements extendable Report and ReportSection classes that can be used to generate a PDF report. Two report sections are tested,

  • SignalReportSection (MNE ERP Plots used in offline analysis)
  • SessionReportSection (Any Dict to be displayed in the report)

Ticket

https://www.pivotaltracker.com/story/show/185944301

Contributions

  • report.py: Add Report, ReportSection, SignalReportSection, SessionReportSection.

Test

  • make test-all
  • Ran demo_visualization.py adding a breakpoint at the end. Importing the needed classes (from bcipy.helpers.report import Report, SignalReport, SessionReport) and running:
    report = Report('.')
    session = {'session': 1, 'date': '2021-10-01'}
    session_text = SessionReportSection(session)
    report.add(session_text)
    sr = SignalReportSection(figure_handles)
    report.add(sr)
    report.compile()
    report.save()

This will output the following:
BciPyReport.pdf

Documentation

  • Are documentation updates required? In-line, README, or documentation? Yes.

Changelog

  • Is the CHANGELOG.md updated with your detailed changes? done!

...

def _create_header(self) -> Flowable:
...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the _compile and _create_header methods are intended to be called by an external class (Report), should this still have a leading underscore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention is that it should not be called individually, but only on a final build. The create header is something that should only be called internally. I will remove the underscore to compile and add a note in the docstring.

...


class SignalReport(ReportSection):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is always hard. It would be more consistent to name this SignalReportSection, since it subclasses ReportSection rather than Report. Alternatively we could rename Report to ReportBuilder or something like that.

@tab-cmd tab-cmd merged commit 0cf22ec into 2.0.0rc4 May 30, 2024
6 checks passed
@tab-cmd tab-cmd deleted the bci-fit-report branch November 4, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants