Skip to content

Commit 2f67e4f

Browse files
authored
Merge pull request #1230 from VisLab/fix_extras
Fixing the dependabot and legacy schema loading
2 parents e2aacd0 + 1b8c417 commit 2f67e4f

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
33
- package-ecosystem: "github-actions"
4-
directory: "/"
4+
directory: "/.github/workflows"
55
target-branch: "main"
66
schedule:
77
interval: "weekly"

hed/schema/schema_io/df_util.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,12 @@ def load_dataframes(filenames):
236236
loaded_dataframe = pd.read_csv(filename, sep="\t", dtype=str, na_filter=False)
237237
loaded_dataframe = loaded_dataframe.rename(columns=constants.EXTRAS_CONVERSIONS)
238238

239+
# For legacy schema compatibility, add missing required columns with empty values
240+
# instead of raising an error. Compliance checking will validate new schemas.
239241
columns_not_in_loaded = dataframes[key].columns[~dataframes[key].columns.isin(loaded_dataframe.columns)]
240-
# and not dataframes[key].columns.isin(loaded_dataframe.columns).all():
241242
if columns_not_in_loaded.any():
242-
raise HedFileError(
243-
HedExceptions.SCHEMA_LOAD_FAILED,
244-
f"Required column(s) {list(columns_not_in_loaded)} missing from {filename}. "
245-
f"The required columns are {list(dataframes[key].columns)}",
246-
filename=filename,
247-
)
243+
for col in columns_not_in_loaded:
244+
loaded_dataframe[col] = ""
248245
dataframes[key] = loaded_dataframe
249246
elif os.path.exists(filename):
250247
# Handle the extra files if they are present.

spec_tests/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ spec_tests/
2020
├── test_sidecar.json # Already present
2121
├── test_errors.py # Tests HED validation against spec
2222
├── test_hed_cache.py # Tests HED schema caching
23-
└── test_bids_datasets.py # Tests BIDS dataset validation
23+
├── test_bids_datasets.py # Tests BIDS dataset validation
24+
└── try_loading_all_schemas.py # Manual script to test schema loading
2425
```
2526

2627
## Setup Instructions

spec_tests/hed-examples

Submodule hed-examples updated 131 files

0 commit comments

Comments
 (0)