Skip to content

Commit 186c42d

Browse files
committed
modifying tests
1 parent 48e76ea commit 186c42d

File tree

3 files changed

+48
-73
lines changed

3 files changed

+48
-73
lines changed

bids2openminds/main.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,8 @@ def create_subjects(subject_id, layout_df, layout, collection, dataset_short_nam
339339
# dealing with condition that have no seasion
340340
if not sessions:
341341
state = omcore.SubjectState(
342-
lookup_label=f"{dataset_short_name_}{subject_name}".strip(),
343-
internal_identifier=f"{subject_name}".strip(
344-
)
342+
lookup_label=f"{dataset_short_name_}{subject_name}_ses-01".strip(),
343+
internal_identifier=None
345344
)
346345
collection.add(state)
347346
state_cache_dict[""] = state
@@ -351,8 +350,8 @@ def create_subjects(subject_id, layout_df, layout, collection, dataset_short_nam
351350
for session in sessions:
352351
if not (table_filter(table_filter(layout_df, session, "session"), subject, "subject").empty):
353352
state = omcore.SubjectState(
354-
lookup_label=f"{dataset_short_name_}{subject_name}_session-{session}".strip(),
355-
internal_identifier=f"{subject_name}_session-{session}".strip(
353+
lookup_label=f"{dataset_short_name_}{subject_name}_ses-{session}".strip(),
354+
internal_identifier=f"{subject_name}_ses-{session}".strip(
356355
)
357356
)
358357
collection.add(state)
@@ -385,9 +384,8 @@ def create_subjects(subject_id, layout_df, layout, collection, dataset_short_nam
385384
state = omcore.SubjectState(
386385
age=create_openminds_age(data_subject),
387386
handedness=handedness_openminds(data_subject),
388-
internal_identifier=f"{subject_name}".strip(
389-
),
390-
lookup_label=f"{dataset_short_name_}{subject_name}".strip()
387+
internal_identifier=None,
388+
lookup_label=f"{dataset_short_name_}{subject_name}_ses-01".strip()
391389
)
392390
collection.add(state)
393391
state_cache_dict[""] = state
@@ -398,8 +396,8 @@ def create_subjects(subject_id, layout_df, layout, collection, dataset_short_nam
398396
state = omcore.SubjectState(
399397
age=create_openminds_age(data_subject),
400398
handedness=handedness_openminds(data_subject),
401-
internal_identifier=f"{subject_name}_session-{session}".strip(),
402-
lookup_label=f"{dataset_short_name_}{subject_name}_session-{session}".strip()
399+
internal_identifier=f"{subject_name}_ses-{session}".strip(),
400+
lookup_label=f"{dataset_short_name_}{subject_name}_ses-{session}".strip()
403401
)
404402
collection.add(state)
405403
state_cache_dict[f"{session}"] = state

test/bids_examples_ds005.jsonld

Lines changed: 33 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
},
1414
"value": 28
1515
},
16-
"internalIdentifier": "sub-01_state-01",
17-
"lookupLabel": "MGT_sub-01_state-01"
16+
"lookupLabel": "sub-01_ses-01"
1817
},
1918
{
2019
"@id": "https://openminds.ebrains.eu/instances/unitOfMeasurement/year",
@@ -28,7 +27,7 @@
2827
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/male"
2928
},
3029
"internalIdentifier": "sub-01",
31-
"lookupLabel": "MGT_sub-01",
30+
"lookupLabel": "sub-01",
3231
"species": {
3332
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
3433
},
@@ -71,8 +70,7 @@
7170
},
7271
"value": 21
7372
},
74-
"internalIdentifier": "sub-02_state-01",
75-
"lookupLabel": "MGT_sub-02_state-01"
73+
"lookupLabel": "sub-02_ses-01"
7674
},
7775
{
7876
"@id": "_:000006",
@@ -81,7 +79,7 @@
8179
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/female"
8280
},
8381
"internalIdentifier": "sub-02",
84-
"lookupLabel": "MGT_sub-02",
82+
"lookupLabel": "sub-02",
8583
"species": {
8684
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
8785
},
@@ -110,8 +108,7 @@
110108
},
111109
"value": 27
112110
},
113-
"internalIdentifier": "sub-03_state-01",
114-
"lookupLabel": "MGT_sub-03_state-01"
111+
"lookupLabel": "sub-03_ses-01"
115112
},
116113
{
117114
"@id": "_:000009",
@@ -120,7 +117,7 @@
120117
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/female"
121118
},
122119
"internalIdentifier": "sub-03",
123-
"lookupLabel": "MGT_sub-03",
120+
"lookupLabel": "sub-03",
124121
"species": {
125122
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
126123
},
@@ -140,8 +137,7 @@
140137
},
141138
"value": 25
142139
},
143-
"internalIdentifier": "sub-04_state-01",
144-
"lookupLabel": "MGT_sub-04_state-01"
140+
"lookupLabel": "sub-04_ses-01"
145141
},
146142
{
147143
"@id": "_:000011",
@@ -150,7 +146,7 @@
150146
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/male"
151147
},
152148
"internalIdentifier": "sub-04",
153-
"lookupLabel": "MGT_sub-04",
149+
"lookupLabel": "sub-04",
154150
"species": {
155151
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
156152
},
@@ -170,8 +166,7 @@
170166
},
171167
"value": 20
172168
},
173-
"internalIdentifier": "sub-05_state-01",
174-
"lookupLabel": "MGT_sub-05_state-01"
169+
"lookupLabel": "sub-05_ses-01"
175170
},
176171
{
177172
"@id": "_:000013",
@@ -180,7 +175,7 @@
180175
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/female"
181176
},
182177
"internalIdentifier": "sub-05",
183-
"lookupLabel": "MGT_sub-05",
178+
"lookupLabel": "sub-05",
184179
"species": {
185180
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
186181
},
@@ -200,8 +195,7 @@
200195
},
201196
"value": 20
202197
},
203-
"internalIdentifier": "sub-06_state-01",
204-
"lookupLabel": "MGT_sub-06_state-01"
198+
"lookupLabel": "sub-06_ses-01"
205199
},
206200
{
207201
"@id": "_:000015",
@@ -210,7 +204,7 @@
210204
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/male"
211205
},
212206
"internalIdentifier": "sub-06",
213-
"lookupLabel": "MGT_sub-06",
207+
"lookupLabel": "sub-06",
214208
"species": {
215209
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
216210
},
@@ -230,8 +224,7 @@
230224
},
231225
"value": 24
232226
},
233-
"internalIdentifier": "sub-07_state-01",
234-
"lookupLabel": "MGT_sub-07_state-01"
227+
"lookupLabel": "sub-07_ses-01"
235228
},
236229
{
237230
"@id": "_:000017",
@@ -240,7 +233,7 @@
240233
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/female"
241234
},
242235
"internalIdentifier": "sub-07",
243-
"lookupLabel": "MGT_sub-07",
236+
"lookupLabel": "sub-07",
244237
"species": {
245238
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
246239
},
@@ -260,8 +253,7 @@
260253
},
261254
"value": 25
262255
},
263-
"internalIdentifier": "sub-08_state-01",
264-
"lookupLabel": "MGT_sub-08_state-01"
256+
"lookupLabel": "sub-08_ses-01"
265257
},
266258
{
267259
"@id": "_:000019",
@@ -270,7 +262,7 @@
270262
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/male"
271263
},
272264
"internalIdentifier": "sub-08",
273-
"lookupLabel": "MGT_sub-08",
265+
"lookupLabel": "sub-08",
274266
"species": {
275267
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
276268
},
@@ -290,8 +282,7 @@
290282
},
291283
"value": 19
292284
},
293-
"internalIdentifier": "sub-09_state-01",
294-
"lookupLabel": "MGT_sub-09_state-01"
285+
"lookupLabel": "sub-09_ses-01"
295286
},
296287
{
297288
"@id": "_:000021",
@@ -300,7 +291,7 @@
300291
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/female"
301292
},
302293
"internalIdentifier": "sub-09",
303-
"lookupLabel": "MGT_sub-09",
294+
"lookupLabel": "sub-09",
304295
"species": {
305296
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
306297
},
@@ -320,8 +311,7 @@
320311
},
321312
"value": 20
322313
},
323-
"internalIdentifier": "sub-10_state-01",
324-
"lookupLabel": "MGT_sub-10_state-01"
314+
"lookupLabel": "sub-10_ses-01"
325315
},
326316
{
327317
"@id": "_:000023",
@@ -330,7 +320,7 @@
330320
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/male"
331321
},
332322
"internalIdentifier": "sub-10",
333-
"lookupLabel": "MGT_sub-10",
323+
"lookupLabel": "sub-10",
334324
"species": {
335325
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
336326
},
@@ -350,8 +340,7 @@
350340
},
351341
"value": 20
352342
},
353-
"internalIdentifier": "sub-11_state-01",
354-
"lookupLabel": "MGT_sub-11_state-01"
343+
"lookupLabel": "sub-11_ses-01"
355344
},
356345
{
357346
"@id": "_:000025",
@@ -360,7 +349,7 @@
360349
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/male"
361350
},
362351
"internalIdentifier": "sub-11",
363-
"lookupLabel": "MGT_sub-11",
352+
"lookupLabel": "sub-11",
364353
"species": {
365354
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
366355
},
@@ -380,8 +369,7 @@
380369
},
381370
"value": 21
382371
},
383-
"internalIdentifier": "sub-12_state-01",
384-
"lookupLabel": "MGT_sub-12_state-01"
372+
"lookupLabel": "sub-12_ses-01"
385373
},
386374
{
387375
"@id": "_:000027",
@@ -390,7 +378,7 @@
390378
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/male"
391379
},
392380
"internalIdentifier": "sub-12",
393-
"lookupLabel": "MGT_sub-12",
381+
"lookupLabel": "sub-12",
394382
"species": {
395383
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
396384
},
@@ -410,8 +398,7 @@
410398
},
411399
"value": 22
412400
},
413-
"internalIdentifier": "sub-13_state-01",
414-
"lookupLabel": "MGT_sub-13_state-01"
401+
"lookupLabel": "sub-13_ses-01"
415402
},
416403
{
417404
"@id": "_:000029",
@@ -420,7 +407,7 @@
420407
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/female"
421408
},
422409
"internalIdentifier": "sub-13",
423-
"lookupLabel": "MGT_sub-13",
410+
"lookupLabel": "sub-13",
424411
"species": {
425412
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
426413
},
@@ -440,8 +427,7 @@
440427
},
441428
"value": 19
442429
},
443-
"internalIdentifier": "sub-14_state-01",
444-
"lookupLabel": "MGT_sub-14_state-01"
430+
"lookupLabel": "sub-14_ses-01"
445431
},
446432
{
447433
"@id": "_:000031",
@@ -450,7 +436,7 @@
450436
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/female"
451437
},
452438
"internalIdentifier": "sub-14",
453-
"lookupLabel": "MGT_sub-14",
439+
"lookupLabel": "sub-14",
454440
"species": {
455441
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
456442
},
@@ -470,8 +456,7 @@
470456
},
471457
"value": 20
472458
},
473-
"internalIdentifier": "sub-15_state-01",
474-
"lookupLabel": "MGT_sub-15_state-01"
459+
"lookupLabel": "sub-15_ses-01"
475460
},
476461
{
477462
"@id": "_:000033",
@@ -480,7 +465,7 @@
480465
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/female"
481466
},
482467
"internalIdentifier": "sub-15",
483-
"lookupLabel": "MGT_sub-15",
468+
"lookupLabel": "sub-15",
484469
"species": {
485470
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
486471
},
@@ -500,8 +485,7 @@
500485
},
501486
"value": 22
502487
},
503-
"internalIdentifier": "sub-16_state-01",
504-
"lookupLabel": "MGT_sub-16_state-01"
488+
"lookupLabel": "sub-16_ses-01"
505489
},
506490
{
507491
"@id": "_:000035",
@@ -510,7 +494,7 @@
510494
"@id": "https://openminds.ebrains.eu/instances/biologicalSex/male"
511495
},
512496
"internalIdentifier": "sub-16",
513-
"lookupLabel": "MGT_sub-16",
497+
"lookupLabel": "sub-16",
514498
"species": {
515499
"@id": "https://openminds.ebrains.eu/instances/species/homoSapiens"
516500
},
@@ -5530,7 +5514,6 @@
55305514
"repository": {
55315515
"@id": "_:000039"
55325516
},
5533-
"shortName": "MGT",
55345517
"studiedSpecimen": [
55355518
{
55365519
"@id": "_:000002"
@@ -5647,8 +5630,7 @@
56475630
{
56485631
"@id": "_:000229"
56495632
}
5650-
],
5651-
"shortName": "MGT"
5633+
]
56525634
}
56535635
]
56545636
}

0 commit comments

Comments
 (0)