fix(docs): sort numeric summary columns containing "varies" sentinel#1118
Open
bkowshik wants to merge 2 commits into
Open
fix(docs): sort numeric summary columns containing "varies" sentinel#1118bkowshik wants to merge 2 commits into
bkowshik wants to merge 2 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.
What
Fix numeric sorting on the dataset summary tables (https://moabb.neurotechx.com/docs/dataset_summary.html). Clicking
Total_trials(and#Trials / class,#Runs) sorted lexicographically instead of numerically:Screenshot before the fix, sorted by
Total trials(last) column.Why
The
.sortableparadigm tables are initialized with a single sharedDataTable()call and no per-column config, so DataTables auto-detects each column's type. Auto-detection is all-or-nothing: a single non-numeric cell downgrades the whole column to string sorting. Several numeric columns carry thevariessentinel for datasets whose trial count isn't fixed, which poisoned detection.Prior art: #705 fixed this class of bug at the data layer (stripping unit suffixes, e.g.
512Hz->512). That approach is fragile — it only holds while every cell stays clean — and #868 reintroduced the bug withvariesrows. Unlike a unit suffix,variescarries real meaning and can't just be stripped, so the fix belongs in the sort engine.Fix
Register a custom DataTables column type
num-varies(docs/source/_static/js/sortable-numeric.js) that treats a column as numeric when every cell is a number or a known sentinel (varies, blank,n/a, ...), ordering sentinel rows as-Infinityso they sink to the bottom. Displayed text is unchanged —variesstill reads asvaries. Wired in viaconf.py. No CSV data changed.Screenshot after the fix, sorted by
Total trials(last) column.Verification
Sort-key logic verified against the real
summary_imagery.csvvalues; docs build green. Final check: clickTotal_trialsin the rendered page.