Introduce typed artifact system for explainer and explorer outputs#766
Open
Irozuku wants to merge 8 commits into
Open
Introduce typed artifact system for explainer and explorer outputs#766Irozuku wants to merge 8 commits into
Irozuku wants to merge 8 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 explainerplot()and explorerget_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
Changes (by file)
DashAI/back/core/artifacts.py: new pydantic artifact hierarchy (Artifact,PlotlyArtifact,TableArtifactwith highlightable cells,TextArtifact,ImageArtifactwithfrom_dashai_imagebridge),from_dictvia discriminated union, andnormalize_artifactsupgrading legacy explainer strings and legacy explorer dicts.DashAI/back/explainability/global_explainer.py,local_explainer.py:plot()contract is nowList[Artifact].DashAI/back/explainability/explainers/{kernel_shap,partial_dependence,permutation_feature_importance}.py: figures wrapped inPlotlyArtifact; 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: sharedIArtifacttype; response typings fixed.tests/back/core/test_artifacts.py: round-trip, validation, and normalization coverage (25 tests).Testing
uv run pytest tests/back/andcd DashAI/front && yarn build.Notes
story()responsibility.