hed-validator
v3.15.5
Published
A JavaScript validator for HED (Hierarchical Event Descriptor) strings.
Downloads
5,789
Readme
hed-validator
This package contains a JavaScript validator for HED (hierarchical event descriptor) strings.
HED is a system for annotating events using comma-separated path strings. Any type of event can be annotated using HED-type syntax. The HED annotation strategy is very general and a standardized vocabulary in the form of a HED schema enables annotation of events in an understandable, machine-actionable format.
Additional library schemas with specialized vocabularies needed for particular subfields are under development.
HED validation occurs at several levels. Syntactic validation checks that HED strings comply with the required syntax, but not whether tags comply with the additional requirements of a HED schema.
Semantic validation verifies validity at many levels:
- Tag-level validation checks that tags are in the schema and have correct units and value type.
- String-level validation performs additional checks for correctness. In this implementation, tag-level and string-level validation occur at the same time.
- Event-level validation checks that the entire assembled HED annotation for an event is valid. This includes checks for required tags, duplicate tags, top-level tags, top-level tag groups, and unique tags. This usually implies the existence of an events file and an accompanying JSON sidecar so that annotations for different columns of an events file can be assembled into a single string.
- Dataset-level validation parses out the definitions
and checks that the needed definitions are present and not duplications.
Dataset-level validation also checks for
Onset
-Offset
tag consistency.
The current version of hed-validator
performs both syntactic and semantic validation.
Because full validation of all the features of HED-3G (versions >= 8.0.0) requires full knowledge
of an events file and its merged sidecars, the hed-validator
currently only exposes its interface
at the dataset level.
The current focus of the hed-validator
package is to support full validation of HED in
BIDS datasets.
HED validation is currently also supported in an online version of the HED validator, which is implemented in Python and developed in a public GitHub repository. Validation and other HED operations are also available through web-services and a docker module.
Usage from JavaScript
The JavaScript version of the HED validator, implemented in this package, is meant primarily to be called during validation of BIDS datasets and is called by the bids-validator. This package has been deployed on npm as hed-validator.
To use the hed-validator
, you must install the npm hed-validator
package and add:
import hedValidator from 'hed-validator'
to your JavaScript program.
A sample of current hed-validator
usage can be found in the BIDS validator in
hed.js
.