The dataset's root directory as an absolute path (Node.js context).
The BIDS file accessor.
The HED schemas used to validate this dataset.
Map of BIDS sidecar files that contain HED annotations.
Load and set the HED schemas for this dataset.
This method reads the dataset_description.json
file, extracts the HEDVersion
field,
and builds the HED schemas. The result is stored in BidsDataset.hedSchemas.
A promise that resolves to an array of issues encountered during schema loading.
Find and parse all JSON sidecar files in the dataset.
This method iterates through the dataset's files, identifies JSON sidecars with HED data, parses them into BidsSidecar objects, and stores them in BidsDataset.sidecarMap.
Note: This method does not validate the HED data within the sidecars; it only parses them.
A promise that resolves to an array of issues encountered during sidecar parsing.
Validate the full BIDS dataset for HED compliance.
This method validates all HED data in the dataset, including:
Note: If any of the sidecars have errors (not just warnings), the tsv files will not be validated. This is because a single error in a sidecar can result in errors on every line of a TSV file.
A promise that resolves to an array of issues found during validation.
Static
createFactory method to create a BidsDataset. This method, rather than the constructor should always be used to create a BidsDataset instance.
Note: This method will fail to create a BidsDataset if a valid HED schema cannot be loaded or any of the JSON sidecars cannot be loaded. It does not perform HED validation.
The root directory of the dataset or a file-like object.
The BidsFileAccessor class to use for accessing files.
A Promise that resolves to a two-element array containing the BidsDataset instance (or null if creation failed) and an array of issues.
A BIDS dataset.
This class organizes and provides access to the files and metadata within a BIDS dataset. It is designed to be used for HED validation of BIDS datasets.
The BidsDataset should not be created with the constructor. Instead, it should be created using the asynchronous BidsDataset.create factory method. This method handles the initial setup and file discovery.
BidsDataset creation will return a null dataset if any of the sidecars have invalid JSON, or it cannot find and load the needed HED schemas.
Example