Skip to content

Fix chart window positions after dropping invalid data rows - #414

Draft
xiaoheiai4719-collab wants to merge 2 commits into
shiyu-coder:masterfrom
xiaoheiai4719-collab:dot/fix-webui-cleaned-row-index
Draft

xiaoheiai4719-collab wants to merge 2 commits into
shiyu-coder:masterfrom
xiaoheiai4719-collab:dot/fix-webui-cleaned-row-index

Conversation

@xiaoheiai4719-collab

Copy link
Copy Markdown

Summary

The custom-date prediction endpoint passes df[mask].index[0] into the chart renderer, which slices with iloc. When CSV cleanup removes invalid rows, those index labels no longer equal row positions. As a result, the chart shows different history from the predictor input and shifts the plotted prediction/actual timestamps.

Use the first matching row position rather than its index label. Data cleaning and model inputs remain unchanged.

Validation

  • python -m pytest -q tests/test_webui_chart_window.py: 3 passed; before the fix, 2 failed and 1 passed.
  • Real CSV loading, Flask request handling, and Plotly serialization are exercised. Only model inference and result persistence are stubbed.
  • Tests cover intact data and one or two dropped leading rows, checking displayed history, values, and prediction/actual timestamps against the predictor inputs.
  • python -m ruff check --isolated --select E4,E7,E9,F tests/test_webui_chart_window.py
  • python -m py_compile webui/app.py tests/test_webui_chart_window.py
  • git diff --check

The optional Web UI dependencies are required to run these tests; the module skips when they are absent. Three existing Plotly/pandas deprecation warnings are emitted. No models were downloaded or run.

AI assistance: OpenAI assisted with source inspection, implementation, and regression tests.

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

Labels

None yet

1 participant