File tree 1 file changed +17
-10
lines changed
src/nidm/experiment/tools
1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -193,16 +193,23 @@ def main():
193
193
id_field = None
194
194
for key , value in column_to_terms .items ():
195
195
if "isAbout" in value :
196
- for isabout_key , isabout_value in value ["isAbout" ].items ():
197
- if isabout_key in ("url" , "@id" ):
198
- if isabout_value == Constants .NIDM_SUBJECTID ._uri :
199
- key_tuple = eval (key )
200
- # id_field=key
201
- id_field = key_tuple .variable
202
- # make sure id_field is a string for zero-padded subject ids
203
- # re-read data file with constraint that key field is read as string
204
- df = pd .read_csv (args .csv_file , dtype = {id_field : str })
205
- break
196
+ for concept in value ["isAbout" ]:
197
+ for isabout_key , isabout_value in concept .items ():
198
+ if isabout_key in ("url" , "@id" ):
199
+ if isabout_value == Constants .NIDM_SUBJECTID ._uri :
200
+ # get variable name from NIDM JSON file format:
201
+ # DD(source=assessment_name, variable=column)
202
+ id_field = (
203
+ key .split ("variable" )[1 ]
204
+ .split ("=" )[1 ]
205
+ .split (")" )[0 ]
206
+ .lstrip ("'" )
207
+ .rstrip ("'" )
208
+ )
209
+ # make sure id_field is a string for zero-padded subject ids
210
+ # re-read data file with constraint that key field is read as string
211
+ df = pd .read_csv (args .csv_file , dtype = {id_field : str })
212
+ break
206
213
207
214
# if we couldn't find a subject ID field in column_to_terms, ask user
208
215
if id_field is None :
You can’t perform that action at this time.
0 commit comments