Skip to content

Add export selector to Report#1702

Draft
ahuang11 wants to merge 19 commits into
mainfrom
improve_report_ui
Draft

Add export selector to Report#1702
ahuang11 wants to merge 19 commits into
mainfrom
improve_report_ui

Conversation

@ahuang11

@ahuang11 ahuang11 commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Builds upon #1701 to allow subsetting which subsections to download.

Area.mp4

The output:

image

In use:

dm.mp4
image

Base automatically changed from tweak_report_ux to main March 3, 2026 16:57
@ahuang11
ahuang11 requested a review from philippjfr March 6, 2026 18:12
@codecov

codecov Bot commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.29%. Comparing base (72297ab) to head (9d18a60).

Files with missing lines Patch % Lines
lumen/ai/report.py 82.14% 25 Missing ⚠️
lumen/tests/ai/test_report.py 98.03% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1702      +/-   ##
==========================================
+ Coverage   70.16%   70.29%   +0.13%     
==========================================
  Files         175      175              
  Lines       30093    30316     +223     
==========================================
+ Hits        21116    21312     +196     
- Misses       8977     9004      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ahuang11 ahuang11 added this to the v1.2.0 milestone Mar 24, 2026
Comment thread lumen/ai/report.py
@ahuang11

ahuang11 commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

Using:

import panel as pn
from lumen.ai.report import Action, Report, Section
from lumen.ai.editors import LumenEditor
from lumen.pipeline import Pipeline
from lumen.sources.duckdb import DuckDBSource
from lumen.views.base import VegaLiteView

pn.extension("tabulator", "vega")

class LoadDataAction(Action):
    async def _execute(self, context, **kwargs):
        source = DuckDBSource(tables={"penguins": "https://datasets.holoviz.org/penguins/v1/penguins.csv"})
        pipeline = Pipeline(source=source, table="penguins")
        return [pipeline.__panel__()], {"source": source}

class AnalyzeAction(Action):
    async def _execute(self, context, **kwargs):
        source = context["source"]
        avg_source = source.create_sql_expr_source(
            tables={"avg_data": "SELECT species, AVG(CAST(NULLIF(body_mass_g, 'NA') AS DOUBLE)) AS avg_mass FROM penguins GROUP BY species"}
        )
        pipeline = Pipeline(source=avg_source, table="avg_data")
        chart = VegaLiteView(
            pipeline=pipeline,
            spec={
                "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
                "mark": "bar",
                "encoding": {
                    "x": {"field": "species", "type": "nominal"},
                    "y": {"field": "avg_mass", "type": "quantitative"},
                },
            },
            sizing_mode="stretch_width",
        )
        return [LumenEditor(component=chart, title="Avg Body Mass by Species")], {}

report = Report(
    Section(LoadDataAction(title="Load"), AnalyzeAction(title="Analyze"), title="Penguins")
)
report.show()
image image image image

Comment thread lumen/ai/report.py

def _init_views(self):
views = self.param._header.rx()
self.views = self.param._header.rx()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why? Seems like this will trigger a bunch of events (needlessly).

Comment thread lumen/ai/report.py
self._prepared = False
self.status = "idle"
self._view[:] = []
self.views = []

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't think this is correct, it unlinks the rx.

Comment thread lumen/ai/report.py
views = list(self._header)
for task in self:
views += task.views
self.views = views

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Again, confused here, views should be managed entirely by the rx expression.

@philippjfr philippjfr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Quite worried about some of the changes here. A big part of making things here not be insane was to manage the views of a TaskGroup via rx expressions. This eliminated a ton of logic around ensuring that things are reset and synced appropriately. Based on what I've seen here this undoes a lot of that.

I haven't followed the exact details but I'm not sure why that logic had to change at all.

@ahuang11
ahuang11 marked this pull request as draft May 6, 2026 22:28
@ahuang11
ahuang11 marked this pull request as draft May 6, 2026 22:28
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