Skip to content

Introduce typed artifact system for explainer and explorer outputs#766

Open
Irozuku wants to merge 8 commits into
developfrom
feat/explainer-output-artifacts
Open

Introduce typed artifact system for explainer and explorer outputs#766
Irozuku wants to merge 8 commits into
developfrom
feat/explainer-output-artifacts

Conversation

@Irozuku

@Irozuku Irozuku commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduces a typed artifact contract for all renderable component outputs. Explainers and explorers previously returned ad hoc shapes (lists of plotly JSON strings, {data, type, config} dicts), which hardwired the frontend to plotly and blocked explainers whose natural output is text, tables, or images. Every explainer plot() and explorer get_results() now returns a list of typed artifacts (plotly, table, text, image) with a single wire format {type, payload, title}, rendered by one shared frontend component. Legacy persisted results keep working through a normalization layer.


Type of Change

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

Changes (by file)

  • DashAI/back/core/artifacts.py: new pydantic artifact hierarchy (Artifact, PlotlyArtifact, TableArtifact with highlightable cells, TextArtifact, ImageArtifact with from_dashai_image bridge), from_dict via discriminated union, and normalize_artifacts upgrading legacy explainer strings and legacy explorer dicts.
  • DashAI/back/explainability/global_explainer.py, local_explainer.py: plot() contract is now List[Artifact].
  • DashAI/back/explainability/explainers/{kernel_shap,partial_dependence,permutation_feature_importance}.py: figures wrapped in PlotlyArtifact; KernelShap titles each instance ("Instance N").
  • DashAI/back/job/explainer_job.py: pickles normalized artifact dicts (never live objects); local explanation file renamed .json -> .pickle (content was always pickle).
  • DashAI/back/exploration/base_explorer.py + the 14 concrete explorers: get_results() returns artifacts (plotly explorers, describe/row tables built server side, wordcloud as native image).
  • DashAI/back/api/api_v1/endpoints/{explainers,explorers,pipelines}.py: responses normalized, so old pickles and legacy plugin components still render.
  • DashAI/front/src/components/shared/ArtifactRenderer.jsx: shared renderer for all four artifact types, grouping consecutive same-title artifacts per instance (plot + text summary shown together, one selector entry per instance).
  • DashAI/front/src/utils/artifactVisualizerData.jsx: maps artifacts onto the existing explorer visualizers (plotly toolbar, material-react-table, image).
  • DashAI/front/src/components/{explainers/ExplainersPlot,notebooks/explorer/useExplorerResults,explorations/explorers/DetailTabs/Results,pipelines/results/ResultsExploration}.jsx: consumers migrated to the artifact list response.
  • DashAI/front/src/types/artifact.ts, api/{explainer,explorer}.ts: shared IArtifact type; response typings fixed.
  • tests/back/core/test_artifacts.py: round-trip, validation, and normalization coverage (25 tests).

Testing

  • uv run pytest tests/back/ and cd DashAI/front && yarn build.
  • Back compat: an explanation or exploration created before this branch must still render (normalization on the read path).
  • Local explainer with many instances: selector shows one entry per instance; plot and text render stacked.

Notes

  • Plot files stay pickled (dicts only) so one read path serves old and new files; migrating to JSON files is deferred.
  • The wire format is intentionally neutral: it is shared by explainers and explorers and is the input contract for the future story() responsibility.

@Irozuku Irozuku added enhancement New feature or request front Frontend work back Backend work labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

back Backend work enhancement New feature or request front Frontend work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant