Skip to content

Commit

Permalink
Merge pull request #209 from VisLab/update-tokenizer
Browse files Browse the repository at this point in the history
Working on separating the data from the tests
  • Loading branch information
VisLab authored Nov 1, 2024
2 parents 9561c87 + 8182481 commit 90673fa
Show file tree
Hide file tree
Showing 28 changed files with 17,582 additions and 244 deletions.
12 changes: 6 additions & 6 deletions bids/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { BidsJsonFile, BidsSidecar } from './types/json'
import { BidsEventFile, BidsTabularFile, BidsTsvFile } from './types/tsv'
import BidsDataset from './types/dataset'
import { BidsHedIssue, BidsIssue } from './types/issues'
import BidsHedSidecarValidator from './validator/bidsHedSidecarValidator'
import BidsHedTsvValidator from './validator/bidsHedTsvValidator'
import SidecarValidator from './validator/sidecarValidator'
import TsvValidator from './validator/tsvValidator'

export {
BidsDataset,
Expand All @@ -16,8 +16,8 @@ export {
BidsSidecar,
BidsIssue,
BidsHedIssue,
BidsHedSidecarValidator,
BidsHedTsvValidator,
SidecarValidator,
TsvValidator,
buildBidsSchemas,
validateBidsDataset,
}
Expand All @@ -31,8 +31,8 @@ export default {
BidsSidecar,
BidsIssue,
BidsHedIssue,
BidsHedSidecarValidator,
BidsHedTsvValidator,
BidsHedSidecarValidator: SidecarValidator,
BidsHedTsvValidator: TsvValidator,
buildBidsSchemas,
validateBidsDataset,
}
4 changes: 2 additions & 2 deletions bids/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function buildBidsSchemas(datasetDescription, schemaDefinition) {
* @returns {SchemasSpec|null} The schema specification to be used to build the schemas, or null if the specification is missing.
* @throws {IssueError} If the schema specification is invalid.
*/
function buildSchemasSpec(datasetDescription, schemaDefinition) {
export function buildSchemasSpec(datasetDescription, schemaDefinition) {
if (schemaDefinition) {
return validateSchemasSpec(schemaDefinition)
} else if (datasetDescription.jsonData?.HEDVersion) {
Expand Down Expand Up @@ -104,4 +104,4 @@ function splitLibraryAndVersion(schemaVersion, originalVersion) {
return [library, version]
}

export default buildBidsSchemas
//export default buildBidsSchemas
4 changes: 2 additions & 2 deletions bids/types/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { sidecarValueHasHed } from '../utils'
import { parseHedString } from '../../parser/parser'
import ParsedHedString from '../../parser/parsedHedString'
import { BidsFile } from './basic'
import BidsHedSidecarValidator from '../validator/bidsHedSidecarValidator'
import SidecarValidator from '../validator/sidecarValidator'
import { IssueError } from '../../common/issues/issues'

const ILLEGAL_SIDECAR_KEYS = new Set(['hed', 'n/a'])
Expand All @@ -20,7 +20,7 @@ export class BidsJsonFile extends BidsFile {
jsonData

constructor(name, jsonData, file) {
super(name, file, BidsHedSidecarValidator)
super(name, file, SidecarValidator)
this.jsonData = jsonData
}
}
Expand Down
4 changes: 2 additions & 2 deletions bids/types/tsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BidsFile } from './basic'
import { convertParsedTSVData, parseTSV } from '../tsvParser'
import { BidsSidecar } from './json'
import ParsedHedString from '../../parser/parsedHedString'
import BidsHedTsvValidator from '../validator/bidsHedTsvValidator'
import TsvValidator from '../validator/tsvValidator'
import { IssueError } from '../../common/issues/issues'

/**
Expand Down Expand Up @@ -49,7 +49,7 @@ export class BidsTsvFile extends BidsFile {
* @param {object} mergedDictionary The merged sidecar data.
*/
constructor(name, tsvData, file, potentialSidecars = [], mergedDictionary = {}) {
super(name, file, BidsHedTsvValidator)
super(name, file, TsvValidator)

if (typeof tsvData === 'string') {
this.parsedTsv = parseTSV(tsvData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { generateIssue, IssueError } from '../../common/issues/issues'
/**
* Validator for HED data in BIDS JSON sidecars.
*/
export class BidsHedSidecarValidator {
export class SidecarValidator {
/**
* The BIDS sidecar being validated.
* @type {BidsSidecar}
Expand Down Expand Up @@ -143,4 +143,4 @@ export class BidsHedSidecarValidator {
}
}

export default BidsHedSidecarValidator
export default SidecarValidator
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BidsHedSidecarValidator from './bidsHedSidecarValidator'
import SidecarValidator from './sidecarValidator'
import { BidsHedIssue, BidsIssue } from '../types/issues'
import { BidsTsvEvent, BidsTsvRow } from '../types/tsv'
import { parseHedString } from '../../parser/parser'
Expand All @@ -12,7 +12,7 @@ import { validateHedString } from '../../validator/event/init'
/**
* Validator for HED data in BIDS TSV files.
*/
export class BidsHedTsvValidator {
export class TsvValidator {
/**
* The BIDS TSV file being validated.
* @type {BidsTsvFile}
Expand Down Expand Up @@ -55,10 +55,7 @@ export class BidsHedTsvValidator {
if (BidsIssue.anyAreErrors(parsingIssues)) {
return this.issues
}
const curlyBraceIssues = new BidsHedSidecarValidator(
this.tsvFile.mergedSidecar,
this.hedSchemas,
).validateCurlyBraces()
const curlyBraceIssues = new SidecarValidator(this.tsvFile.mergedSidecar, this.hedSchemas).validateCurlyBraces()
const hedColumnIssues = this._validateHedColumn()
this.issues.push(...curlyBraceIssues, ...hedColumnIssues)
if (BidsIssue.anyAreErrors(this.issues)) {
Expand Down Expand Up @@ -386,4 +383,4 @@ export class BidsHedTsvParser {
}
}

export default BidsHedTsvValidator
export default TsvValidator
Loading

0 comments on commit 90673fa

Please sign in to comment.