Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Un-define the unspecified Context.data #1823

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions bids-validator/src/schema/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import {
ContextSubject,
ContextAssociations,
ContextNiftiHeader,
ContextData,
} from '../types/context.ts'
import { BIDSFile } from '../types/file.ts'
import { FileTree } from '../types/filetree.ts'
import { ColumnsMap } from '../types/columns.ts'
import { BIDSEntities, readEntities } from './entities.ts'
import { DatasetIssues } from '../issues/datasetIssues.ts'
import { parseTSV } from '../files/tsv.ts'
import { parseBval, parseBvec } from '../files/dwi.ts'
import { loadHeader } from '../files/nifti.ts'
import { buildAssociations } from './associations.ts'
import { ValidatorOptions } from '../setup/options.ts'
Expand Down Expand Up @@ -68,7 +66,6 @@ export class BIDSContext implements Context {
columns: ColumnsMap
associations: ContextAssociations
nifti_header?: ContextNiftiHeader
data?: ContextData

constructor(
fileTree: FileTree,
Expand Down Expand Up @@ -174,27 +171,6 @@ export class BIDSContext implements Context {
}
}

// Currently un-specified bit of context needed for bval/bvec
async loadData(): Promise<void> {
let parser
if (this.file.path.endsWith('.bval')) {
parser = parseBval
} else if (this.file.path.endsWith('.bvec')) {
parser = parseBvec
}
if (parser) {
this.data = await this.file
.text()
.then(parser as (value: string) => number[][])
.then((data) => {
return {
n_rows: data.length,
n_cols: data ? data[0].length : 0,
}
}).then((ret) => {console.log(ret); return ret})
}
}

async loadColumns(): Promise<void> {
if (this.extension !== '.tsv') {
return
Expand Down Expand Up @@ -222,7 +198,6 @@ export class BIDSContext implements Context {
this.loadSidecar(),
this.loadColumns(),
this.loadAssociations(),
this.loadData(),
])
this.loadNiftiHeader()
}
Expand Down
5 changes: 0 additions & 5 deletions bids-validator/src/types/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ export interface ContextNiftiHeader {
qform_code: number
sform_code: number
}
export interface ContextData {
n_cols?: number
n_rows?: number
}
export interface Context {
dataset: ContextDataset
subject: ContextSubject
Expand All @@ -104,5 +100,4 @@ export interface Context {
columns: object
json: object
nifti_header?: ContextNiftiHeader
data?: ContextData
}
Loading