Skip to content

Commit

Permalink
Merge pull request #235 from VisLab/revised-validator
Browse files Browse the repository at this point in the history
Removal of unused portions of code
  • Loading branch information
VisLab authored Dec 23, 2024
2 parents dcee6f0 + 346d59c commit c595b0f
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 994 deletions.
6 changes: 2 additions & 4 deletions bids/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import buildBidsSchemas from './schema'
import { buildBidsSchemas } from './schema'
import validateBidsDataset from './validate'
import { BidsJsonFile, BidsSidecar } from './types/json'
import { BidsTabularFile, BidsTsvFile } from './types/tsv'
import { BidsTsvFile } from './types/tsv'
import BidsDataset from './types/dataset'
import { BidsHedIssue, BidsIssue } from './types/issues'
import BidsHedSidecarValidator from './validator/sidecarValidator'
Expand All @@ -10,7 +10,6 @@ import BidsHedTsvValidator from './validator/tsvValidator'
export {
BidsDataset,
BidsTsvFile,
BidsTabularFile,
BidsJsonFile,
BidsSidecar,
BidsIssue,
Expand All @@ -24,7 +23,6 @@ export {
export default {
BidsDataset,
BidsTsvFile,
BidsTabularFile,
BidsJsonFile,
BidsSidecar,
BidsIssue,
Expand Down
2 changes: 1 addition & 1 deletion bids/types/dataset.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export class BidsDataset {
/**
* The dataset's event file data.
* @type {BidsEventFile[]}
* @type {BidsTsvFile[]}
*/
eventData
/**
Expand Down
39 changes: 18 additions & 21 deletions bids/types/tsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,29 @@ export class BidsTsvElement {
*/
hedString

/**
* The ParsedHedString representation of this row
* @type {ParsedHedString}
*/
parsedHedString

/**
* The file this row belongs to.
* The file this row belongs to (usually just the path).
* @type {Object}
*/
file

/**
* The onset represented by this row or a NaN.
* @type {Number}
*/
onset

/**
* The line number(s) (including the header) represented by this row.
*/
tsvLine

/**
* Constructor.
*
Expand Down Expand Up @@ -141,7 +153,12 @@ export class BidsTsvElement {
* A row in a BIDS TSV file.
*/
export class BidsTsvRow extends BidsTsvElement {
/**
* The map of column name to value for this row.
* @type {Map<string, string>}
*/
rowCells

/**
* Constructor.
*
Expand All @@ -156,23 +173,3 @@ export class BidsTsvRow extends BidsTsvElement {
this.rowCells = rowCells
}
}

/**
* A BIDS events.tsv file.
*
* @deprecated Use {@link BidsTsvFile}. Will be removed in version 4.0.0.
*/
export class BidsEventFile extends BidsTsvFile {
/**
* Constructor.
*
* @param {string} name The name of the event TSV file.
* @param {string[]} potentialSidecars The list of potential JSON sidecars.
* @param {object} mergedDictionary The merged sidecar data.
* @param {{headers: string[], rows: string[][]}|string} tsvData This file's TSV data.
* @param {object} file The file object representing this file.
*/
constructor(name, potentialSidecars, mergedDictionary, tsvData, file) {
super(name, tsvData, file, potentialSidecars, mergedDictionary)
}
}
35 changes: 0 additions & 35 deletions tests/utils/map.spec.js

This file was deleted.

17 changes: 0 additions & 17 deletions utils/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,3 @@ export function recursiveMap(fn, array) {
return fn(array)
}
}

/**
* Apply a function recursively to an array.
*
* @template T,U
* @param {function(T, U[]): U} fn The function to apply.
* @param {T[]} array The array to map.
* @param {U[]} [issues] An optional array to collect issues.
* @returns {U[]} The mapped array.
*/
export function recursiveMapNew(fn, array, issues = []) {
if (Array.isArray(array)) {
return array.map((element) => recursiveMap(fn, element, issues))
} else {
return fn(array, issues)
}
}
32 changes: 0 additions & 32 deletions utils/hedData.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import lt from 'semver/functions/lt'

import ParsedHedTag from '../parser/parsedHedTag'
import { TagSpec } from '../parser/tokenizer'

/**
* Determine the HED generation for a base schema version number.
*
Expand All @@ -18,32 +15,3 @@ export const getGenerationForSchemaVersion = function (version) {
return 3
}
}

export const mergeParsingIssues = function (previousIssues, currentIssues) {
for (const [key, currentIssue] of Object.entries(currentIssues)) {
previousIssues[key] = previousIssues[key] !== undefined ? previousIssues[key].concat(currentIssue) : currentIssue
}
}

/**
* Get the parent tag objects for a given short tag.
*
* @param {Schemas} hedSchemas The HED schema collection.
* @param {string} shortTag A short-form HED 3 tag.
* @returns {Map<Schema, ParsedHedTag>} A Map mapping a {@link Schema} to a {@link ParsedHedTag} object representing the full tag.
*/
export const getParsedParentTags = function (hedSchemas, shortTag) {
const parentTags = new Map()
for (const [schemaNickname, schema] of hedSchemas.schemas) {
try {
const parentTag = new ParsedHedTag(
new TagSpec(shortTag, 0, shortTag.length - 1, schemaNickname),
hedSchemas,
shortTag,
)
parentTags.set(schema, parentTag)
// eslint-disable-next-line no-empty
} catch (e) {}
}
return parentTags
}
11 changes: 0 additions & 11 deletions utils/hedStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ export const getTagSlashIndices = function (tag) {
return indices
}

/**
* Get the levels of a tag.
*
* @param {string} tag A HED tag string.
* @returns {string[]} The levels of this tag.
*/
export const getTagLevels = function (tag) {
const tagSlashIndices = getTagSlashIndices(tag)
return tagSlashIndices.map((tagSlashIndex) => tag.slice(0, tagSlashIndex))
}

/**
* Get the last part of a HED tag.
*
Expand Down
51 changes: 0 additions & 51 deletions utils/map.js

This file was deleted.

Loading

0 comments on commit c595b0f

Please sign in to comment.