|
15 | 15 | import { globToRegExp, SEPARATOR_PATTERN } from '@std/path' |
16 | 16 | import type { GenericSchema, Schema } from '../types/schema.ts' |
17 | 17 | import type { BIDSContext } from '../schema/context.ts' |
18 | | -import type { lookupModality } from '../schema/modalities.ts' |
19 | 18 | import type { CheckFunction } from '../types/check.ts' |
20 | 19 | import { lookupEntityLiteral } from './filenameValidate.ts' |
21 | 20 |
|
22 | 21 | const CHECKS: CheckFunction[] = [ |
23 | | - datatypeFromDirectory, |
24 | 22 | findRuleMatches, |
25 | 23 | hasMatch, |
26 | 24 | cleanContext, |
@@ -126,29 +124,6 @@ function matchStemRule(node, context): boolean { |
126 | 124 | return true |
127 | 125 | } |
128 | 126 |
|
129 | | -export async function datatypeFromDirectory(schema, context) { |
130 | | - const subEntity = schema.objects.entities.subject.name |
131 | | - const sesEntity = schema.objects.entities.session.name |
132 | | - const parts = context.file.path.split(SEPARATOR_PATTERN) |
133 | | - const datatypeIndex = parts.length - 2 |
134 | | - if (datatypeIndex < 1) { |
135 | | - return Promise.resolve() |
136 | | - } |
137 | | - const dirDatatype = parts[datatypeIndex] |
138 | | - if (dirDatatype === 'phenotype') { |
139 | | - // Phenotype is a pseudo-datatype for now. |
140 | | - context.datatype = dirDatatype |
141 | | - return Promise.resolve() |
142 | | - } |
143 | | - for (const key in schema.rules.modalities) { |
144 | | - if (schema.rules.modalities[key].datatypes.includes(dirDatatype)) { |
145 | | - context.modality = key |
146 | | - context.datatype = dirDatatype |
147 | | - return Promise.resolve() |
148 | | - } |
149 | | - } |
150 | | -} |
151 | | - |
152 | 127 | export function hasMatch(schema, context) { |
153 | 128 | if ( |
154 | 129 | context.filenameRules.length === 0 && |
|
0 commit comments