Skip to content

Feature/report panel#708

Draft
dalestee wants to merge 54 commits into
MAIF:masterfrom
dalestee:feature/report-panel
Draft

Feature/report panel#708
dalestee wants to merge 54 commits into
MAIF:masterfrom
dalestee:feature/report-panel

Conversation

@dalestee

Copy link
Copy Markdown
Collaborator

Description

Refactors the report generation system by replacing the legacy implementation with a new modular smart_report architecture, and updates related documentation, assets, tutorials, and tests.

Main changes

Modular report engine introduced

  • Added a new smart_report implementation organized by responsibilities (core orchestration, rendering blocks, layout assembly, validation, and static assets).
  • Implemented a block-based configuration flow to make report composition more flexible and maintainable.
  • Improved separation of concerns between orchestration logic and rendering logic.

Legacy report implementation removed

  • Removed old legacy report files and templates that were tied to the previous architecture.
  • Cleaned up obsolete code paths and tests related to the deleted implementation.

Report UI and generated output improvements

  • Updated report front-end assets (CSS and JS) for better readability and responsiveness.
  • Refreshed visuals (including branding elements such as logo/color styling) for a more consistent report output.

Documentation, tutorials, and examples updated

  • Updated documentation pages and README content to describe the new report workflow.
  • Added or updated images and examples to reflect the new report generation behavior.
  • Updated tutorial and configuration examples to use the new report structure.

Test suite and integration updates

  • Added and updated tests for the new report architecture and panel behavior.
  • Removed outdated tests tied to legacy report behavior.
  • Included related cleanup and minor fixes across nearby modules impacted by the refactor.

@guerinclement guerinclement self-requested a review June 17, 2026 08:47
Comment thread pyproject.toml Outdated
"numba>=0.60.0",
"numpy>=2.0.0,<2.6.0",
"pandas>=2.2.2,<4.0.0",
"panel>=1.8.10",

@guerinclement guerinclement Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

quick remark: you should move this dependency in the "report" optional section below (and remove the now unnecessary deps it contains)

Comment thread shapash/explainer/smart_explainer.py Outdated
Comment on lines +1795 to +1801
ReportBlockMixin.__init__(
report_runtime,
explainer=self,
x_train=x_train,
y_train=y_train,
y_test=y_test,
config=config,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you should not do that.
the user is expected to provide an instance of its own BlockMixin class fully initialized.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you can check at the begining of the generate_report method if x_train/y_train/y_test are inconsistent with something like:

    if block_instance is not None and type(block_instance) is ReportBlockMixin:
            if (
                (block_instance.x_train_init.equals(x_train))
                or (block_instance.y_train != y_train)
                or (block_instance.y_test != y_test)
            ):
                print("blabla")

Comment thread shapash/report/core.py Outdated

_assign_section_ids(cfg["sections"])

runtime.render_block = lambda block_cfg: render_block(runtime, block_cfg)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why did not you simply make render_block a method of the ReportBlockMixin class?

Comment thread shapash/report/panel_support.py Outdated
Comment on lines +18 to +21
def report_css_text() -> str:
"""Load report CSS once for Panel report export."""
css_path = Path(__file__).resolve().parent / "report_styles.css"
return css_path.read_text(encoding="utf-8")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it would be nice to allow the user to use its own css sheet.
maybe through the conf yaml file?

@guerinclement

Copy link
Copy Markdown
Collaborator

My opinion is that the "Key"/"Value" headers are unnecessary in this section.
I would remove them but we can discuss that.

image

@guerinclement

Copy link
Copy Markdown
Collaborator

I suggest to remove the index column and use "Parameter"/"Value" as a header instead of "parameter key"/"parameter value"

image

@guerinclement

guerinclement commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Try to move the plotly menu, or the graph legend, to another place so they don't overlap
image

Comment on lines +24 to +28
@lru_cache(maxsize=1)
def report_js_text() -> str:
"""Load report JavaScript once for Panel report export."""
js_path = Path(__file__).resolve().parent / "report_script.js"
return js_path.read_text(encoding="utf-8")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It seems that the js is used to make the menu buttons work.
Try to use the panel builtin instead

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I 've checked, and the js is used to track scroll position to highlight on the side menu where the user currently is.

Comment thread shapash/report/panel_support.py Outdated
Comment on lines +31 to +36
def apply_report_css() -> None:
"""Register smart-report CSS in Panel global configuration."""
_enable_panel_plotly()
css = report_css_text()
if css not in pn.config.raw_css:
pn.config.raw_css.append(css)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this could be integrated in the generate_report function

Comment thread shapash/report/panel_support.py Outdated
Comment on lines +39 to +42
def make_plotly_pane(fig) -> pn.pane.Plotly:
"""Build a responsive Plotly pane for report blocks."""
_enable_panel_plotly()
return pn.pane.Plotly(fig, config={"responsive": True}, sizing_mode="stretch_width")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you can move this into the block decorator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants