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

[SCHEMA] harmonize into dirs, ids, ids_phenotype for "subjects" and "sessions" #1981

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion src/schema/SCHEMA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.4-dev
0.12.0-dev
16 changes: 8 additions & 8 deletions src/schema/meta/context.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ properties:
description: 'Collections of subjects in dataset'
type: object
required:
- sub_dirs
- dirs
additionalProperties: false
properties:
sub_dirs:
dirs:
description: 'Subjects as determined by sub-* directories'
type: array
items:
type: string
participant_id:
ids:
description: 'The participant_id column of participants.tsv'
type: array
items:
type: string
phenotype:
ids_phenotype:
description: 'The union of participant_id columns in phenotype files'
type: array
items:
Expand All @@ -96,20 +96,20 @@ properties:
description: 'Collections of sessions in subject'
type: object
required:
- ses_dirs
- dirs
additionalProperties: false
properties:
ses_dirs:
dirs:
description: 'Sessions as determined by ses-* directories'
type: array
items:
type: string
session_id:
ids:
description: 'The session_id column of sessions.tsv'
type: array
items:
type: string
phenotype:
ids_phenotype:
description: 'The union of session_id columns in phenotype files'
type: array
items:
Expand Down
8 changes: 4 additions & 4 deletions src/schema/rules/checks/dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SubjectFolders:
selectors:
- path == '/dataset_description.json'
checks:
- length(dataset.subjects.sub_dirs) > 0
- length(dataset.subjects.dirs) > 0

# 49
ParticipantIDMismatch:
Expand All @@ -24,7 +24,7 @@ ParticipantIDMismatch:
selectors:
- path == '/participants.tsv'
checks:
- allequal(sorted(columns.participant_id), sorted(dataset.subjects.sub_dirs))
- allequal(sorted(columns.participant_id), sorted(dataset.subjects.dirs))

# 51
PhenotypeSubjectsMissing:
Expand All @@ -35,9 +35,9 @@ PhenotypeSubjectsMissing:
level: error
selectors:
- path == '/dataset_description.json'
- type(dataset.subjects.phenotype) != 'null'
- type(dataset.subjects.ids_phenotype) != 'null'
checks:
- allequal(sorted(dataset.subjects.phenotype), sorted(dataset.subjects.sub_dirs))
- allequal(sorted(dataset.subjects.ids_phenotype), sorted(dataset.subjects.dirs))

# 214
SamplesTSVMissing:
Expand Down
8 changes: 4 additions & 4 deletions tools/typescript/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ Deno.test('generateTypes() supports generic array type', () => {
Deno.test('generateTypes() supports typed array type', () => {
const file = createSourceFile('test.ts')
file.statements = generateTypes({
sub_dirs: {
dirs: {
description: 'Subjects as determined by sub-*/ directories',
type: 'array',
items: { type: 'string' },
},
})

assertEquals(print(file), 'sub_dirs: string[];\n')
assertEquals(print(file), 'dirs: string[];\n')
})

// Object without defined properties
Expand Down Expand Up @@ -134,7 +134,7 @@ Deno.test('generateTypes() supports object trees', () => {
description: 'Collections of subjects in dataset',
type: 'object',
properties: {
sub_dirs: {
dirs: {
description: 'Subjects as determined by sub-*/ directories',
type: 'array',
items: { type: 'string' },
Expand All @@ -148,7 +148,7 @@ Deno.test('generateTypes() supports object trees', () => {
assertEquals(
print(file),
`export interface DatasetSubjects {
sub_dirs: string[];
dirs: string[];
}
export interface Dataset {
dataset_description: object;
Expand Down