Skip to content

Add visualization recommender, UI controls and chart-job fallback#49

Merged
rad1092 merged 1 commit intomainfrom
codex/add-recommendation-visualization-features
Feb 15, 2026
Merged

Add visualization recommender, UI controls and chart-job fallback#49
rad1092 merged 1 commit intomainfrom
codex/add-recommendation-visualization-features

Conversation

@rad1092
Copy link
Copy Markdown
Owner

@rad1092 rad1092 commented Feb 15, 2026

Motivation

  • Provide question-driven visualization guidance so the UI can suggest chart types and rationale for common intents (trend, comparison, relationship, quality, etc.).
  • Allow users to opt into recommended visualizations and make chart generation robust by returning useful tabular fallbacks when plotting fails.

Description

  • Add bitnet_tools/viz_recommender.py with recommend_chart_types(question) that returns an intent, recommended chart types, and a textual reason (includes default overview).
  • Extend bitnet_tools/visualize.py to accept an optional selected_chart_types parameter, support line charts, and propagate selection through create_multi_charts().
  • Add POST /api/viz/recommend and enhance /api/charts/jobs in bitnet_tools/web.py to accept selected_chart_types or auto-select via the recommender; implement _build_chart_fallback() and make _run_chart_job() return a preview/summary fallback instead of hard failing on chart errors.
  • Update UI (bitnet_tools/ui/index.html, bitnet_tools/ui/app.js) with a “시각화 옵션 보기” button, a recommendation panel showing intent/recommended charts/reason, and send the selected/recommended chart types when starting chart jobs.
  • Add tests: tests/test_viz_recommender.py for recommendation consistency and an API contract test in tests/test_web.py for /api/viz/recommend.

Testing

  • Compiled modules successfully with python -m py_compile bitnet_tools/visualize.py and python -m py_compile bitnet_tools/web.py (succeeded).
  • Static check of the UI script with node --check bitnet_tools/ui/app.js (succeeded).
  • Ran unit tests with pytest -q tests/test_viz_recommender.py tests/test_web.py and all tests passed (19 passed).

Codex Task

@rad1092 rad1092 merged commit 4d9b7c5 into main Feb 15, 2026
4 checks passed
@rad1092 rad1092 deleted the codex/add-recommendation-visualization-features branch February 15, 2026 05:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65d6cefc38

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bitnet_tools/ui/app.js
appState.chartJob.files = payloadFiles;

const queued = await postJson('/api/charts/jobs', { files: payloadFiles }, '차트 작업 생성');
const rec = appState.vizRecommendation || await fetchVizRecommendation();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Recompute chart recommendation for the current question

This reuses appState.vizRecommendation if it exists, so after a user fetches recommendations once and then edits the question, startChartsJob() still sends the old selected_chart_types. Because /api/charts/jobs only auto-recommends when selected_chart_types is empty, the stale list overrides the new question and can generate charts for the wrong intent.

Useful? React with 👍 / 👎.

Comment thread bitnet_tools/web.py
Comment on lines +785 to +786
if selected_chart_types is not None and not isinstance(selected_chart_types, list):
return self._send_json(self._error_payload('selected_chart_types must be a list'), HTTPStatus.BAD_REQUEST)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate each selected chart type as a string

The endpoint only checks that selected_chart_types is a list, but downstream chart generation normalizes entries with c.strip().lower() in create_file_charts(). If a client sends non-string items (for example [1]), the job is accepted and later fails inside chart generation instead of returning a clear 400 validation error, which makes client bugs look like chart-engine failures.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant