Skip to content

Comments

fix(dash): fix hardcoded paths and refactor duplicate model functions#78

Open
harsshks wants to merge 1 commit intoruxailab:mainfrom
harsshks:fix/dash-portable-paths-refactor
Open

fix(dash): fix hardcoded paths and refactor duplicate model functions#78
harsshks wants to merge 1 commit intoruxailab:mainfrom
harsshks:fix/dash-portable-paths-refactor

Conversation

@harsshks
Copy link

Summary

Fixes #76 — extends the approach proposed in #77 with additional code quality improvements.

Problem

dash.py contained hardcoded Windows-absolute paths that made the dashboard unusable on any machine other than the original developer's.

Changes Made

🐛 Bug Fix

  • Replaced hardcoded C:\Users\SITAM MEUR\... paths with pathlib.Path(__file__).resolve().parent — anchored to the script file itself, so it works on Windows, Linux, and macOS regardless of the working directory

🛡️ Better Error Handling

  • Added a directory existence check (data_dir.exists()) with st.error() + st.stop() before os.listdir() — gives a clear, actionable message instead of a bare crash
  • Added st.stop() after FileNotFoundError on CSV load (prevents further rendering with no data)
  • Added st.success("Data loaded successfully!") for positive feedback

♻️ Refactor (DRY)

  • Merged model_for_mouse_x() and model_for_mouse_y() (~120 lines each, nearly identical) into a single evaluate_models(X, Y, axis_label, models, model_names) function — removes ~85 lines of duplicated logic

🔒 Reproducibility

  • Added random_state=42 to train_test_split for consistent results across runs

🐛 Edge Case Fix

  • Added division-by-zero guard in radar chart metric normalization

Related

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.

[BUG] : Fix hardcoded file paths in dash.py to make dashboard portable across systems

1 participant