You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Address the various blank and incomplete tsv lines - #1502
A curly-brace reference can be n/a or blank in a row (spec 3.2.9.3
rules 3 and 10), so the sidecar check now also tries each reference
removed and reports TAG_EXPRESSION_REPEATED for those combinations.
{HED} has the removal as its only substitution, so strings that
reference it are checked again. A repeat found by several combinations
is reported once.
A .tsv line after the first that is empty, or has a different number
of tab-separated cells than the first line, is now TABULAR_INVALID
(spec 3.2.10, Appendix B reasons e and f), reported by its file line
in stage 0 so the rows are not validated. Lines end at LF or CRLF.
The file still loads, records the lines in BaseInput.line_problems,
and refuses assemble. Pins spec_tests/hed-tests to 0a07fe0.
Closeshed-standard#1475.
A tabular file is validated only when it has a HED column or a sidecar
with HED annotations (specification 3.2.10). Pins the existing behavior.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
pandas finds no columns in a file that starts with two or more empty
lines, and the file was then treated as empty before its column names
were set. The first line is one blank column name (specification
3.2.10), so it is now reported with the empty lines and cell counts.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Reference expansion generates exponentially many redundant combinations and materializes the entire Cartesian product, making small sidecars expensive to validate and risking memory exhaustion.
This PR strengthens HED tabular validation by reporting blank and incomplete TSV lines before validating annotations. It also expands sidecar repeated-expression checks to include removed references.
Changes:
Record empty and wrong-width TSV lines, report their file locations, and block assembly.
Check sidecar substitutions with references removed and deduplicate repeated-expression reports.
Add regression tests and document the validation changes.
File
Description
tests/validator/test_spreadsheet_validator.py
Tests line errors, stage ordering, and file-line reporting.
tests/validator/test_sidecar_validator.py
Tests removed-reference substitutions and repeat deduplication.
tests/tools/bids/test_bids_file_group.py
Tests malformed lines with invalid sidecars and HED eligibility.
tests/models/test_base_input.py
Covers line scanning, loading, and assembly refusal.
Each reference name is one substitution, since replace_ref replaces
every occurrence; 20 occurrences of one reference made 3**20
combinations. The combinations are generated lazily, filled ones
first, instead of sorting the whole product in memory.
Only CR directly before LF ends a line. find_line_problems no longer
strips a CR from the last line, and pandas reads with an LF line
terminator, so its rows match the line check and a lone CR no longer
shifts later row numbers.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Newline-only named tables lose their blank header during fallback, leaving blank_columns empty and incorrectly bypassing TABULAR_INVALID (c) validation even with an annotating sidecar.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Preserve blank headers for newline-only named tables
hed/models/base_input.py:912
For a named table containing only LF or CRLF, this early return discards the recorded blank header, leaving blank_columns empty and skipping TABULAR_INVALID (c), even with an annotating sidecar. Preserve header_cells through the fallback for named input; genuinely empty text is already handled above. Update the newline-only expectation in tests/models/test_base_input.py:568-569 to expect a blank column.
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
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.
No description provided.