Skip to content

Commit 917ddb7

Browse files
committed
RF(schema): harmonize into dirs, ids, ids_phenotype
Current names duplicate their "domain" (subject_ or session_), inconsistent in plurality (_id although for all ids), and not clear really what 'phenotype' corresponds to without reading the description. With proposed change there is no duplication of the domain, consistency in plurality (albeit 'id' is an abbreviation so 'ids' is a non-word), and IMHO clearer meaning in `ids_phenotype`. This would also allow for generalization across other entities in a perspective bids-standard/bids-2-devel#54 - where then any entity with folders for its level could have `dirs`. Also it could come handy to determine `ids` for some other entities in tests. Ref: bids-standard/bids-validator#94 (comment) TODOs - [ ] introduce corresponding changes to bids-validator
1 parent d5516be commit 917ddb7

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/schema/meta/context.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ properties:
6767
description: 'Collections of subjects in dataset'
6868
type: object
6969
required:
70-
- sub_dirs
70+
- dirs
7171
additionalProperties: false
7272
properties:
73-
sub_dirs:
73+
dirs:
7474
description: 'Subjects as determined by sub-* directories'
7575
type: array
7676
items:
7777
type: string
78-
participant_id:
78+
ids:
7979
description: 'The participant_id column of participants.tsv'
8080
type: array
8181
items:
8282
type: string
83-
phenotype:
83+
ids_phenotype:
8484
description: 'The union of participant_id columns in phenotype files'
8585
type: array
8686
items:
@@ -96,20 +96,20 @@ properties:
9696
description: 'Collections of sessions in subject'
9797
type: object
9898
required:
99-
- ses_dirs
99+
- dirs
100100
additionalProperties: false
101101
properties:
102-
ses_dirs:
102+
dirs:
103103
description: 'Sessions as determined by ses-* directories'
104104
type: array
105105
items:
106106
type: string
107-
session_id:
107+
ids:
108108
description: 'The session_id column of sessions.tsv'
109109
type: array
110110
items:
111111
type: string
112-
phenotype:
112+
ids_phenotype:
113113
description: 'The union of session_id columns in phenotype files'
114114
type: array
115115
items:

src/schema/rules/checks/dataset.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SubjectFolders:
1111
selectors:
1212
- path == '/dataset_description.json'
1313
checks:
14-
- length(dataset.subjects.sub_dirs) > 0
14+
- length(dataset.subjects.dirs) > 0
1515

1616
# 49
1717
ParticipantIDMismatch:
@@ -24,7 +24,7 @@ ParticipantIDMismatch:
2424
selectors:
2525
- path == '/participants.tsv'
2626
checks:
27-
- allequal(sorted(columns.participant_id), sorted(dataset.subjects.sub_dirs))
27+
- allequal(sorted(columns.participant_id), sorted(dataset.subjects.dirs))
2828

2929
# 51
3030
PhenotypeSubjectsMissing:
@@ -35,9 +35,9 @@ PhenotypeSubjectsMissing:
3535
level: error
3636
selectors:
3737
- path == '/dataset_description.json'
38-
- type(dataset.subjects.phenotype) != 'null'
38+
- type(dataset.subjects.ids_phenotype) != 'null'
3939
checks:
40-
- allequal(sorted(dataset.subjects.phenotype), sorted(dataset.subjects.sub_dirs))
40+
- allequal(sorted(dataset.subjects.ids_phenotype), sorted(dataset.subjects.dirs))
4141

4242
# 214
4343
SamplesTSVMissing:

tools/typescript/generate.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ Deno.test('generateTypes() supports generic array type', () => {
5353
Deno.test('generateTypes() supports typed array type', () => {
5454
const file = createSourceFile('test.ts')
5555
file.statements = generateTypes({
56-
sub_dirs: {
56+
dirs: {
5757
description: 'Subjects as determined by sub-*/ directories',
5858
type: 'array',
5959
items: { type: 'string' },
6060
},
6161
})
6262

63-
assertEquals(print(file), 'sub_dirs: string[];\n')
63+
assertEquals(print(file), 'dirs: string[];\n')
6464
})
6565

6666
// Object without defined properties
@@ -134,7 +134,7 @@ Deno.test('generateTypes() supports object trees', () => {
134134
description: 'Collections of subjects in dataset',
135135
type: 'object',
136136
properties: {
137-
sub_dirs: {
137+
dirs: {
138138
description: 'Subjects as determined by sub-*/ directories',
139139
type: 'array',
140140
items: { type: 'string' },
@@ -148,7 +148,7 @@ Deno.test('generateTypes() supports object trees', () => {
148148
assertEquals(
149149
print(file),
150150
`export interface DatasetSubjects {
151-
sub_dirs: string[];
151+
dirs: string[];
152152
}
153153
export interface Dataset {
154154
dataset_description: object;

0 commit comments

Comments
 (0)