fix(dash): fix hardcoded paths and refactor duplicate model functions#78
Open
harsshks wants to merge 1 commit intoruxailab:mainfrom
Open
fix(dash): fix hardcoded paths and refactor duplicate model functions#78harsshks wants to merge 1 commit intoruxailab:mainfrom
harsshks wants to merge 1 commit intoruxailab:mainfrom
Conversation
…e model functions
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
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
C:\Users\SITAM MEUR\...paths withpathlib.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
data_dir.exists()) withst.error()+st.stop()beforeos.listdir()— gives a clear, actionable message instead of a bare crashst.stop()afterFileNotFoundErroron CSV load (prevents further rendering with no data)st.success("Data loaded successfully!")for positive feedback♻️ Refactor (DRY)
model_for_mouse_x()andmodel_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
random_state=42totrain_test_splitfor consistent results across runs🐛 Edge Case Fix
Related