[importers] Make the stores' relate methods compatible with the new API: add the subjtype kwarg.
authorDimitri Papadopoulos <dimitri.papadopoulos@cea.fr>
Thu, 18 Jul 2013 07:42:20 +0200
changeset 331 ac7e00cf9a04
parent 330 53092a59a87c
child 332 728dd6457310
[importers] Make the stores' relate methods compatible with the new API: add the subjtype kwarg.
importers/imagen.py
--- a/importers/imagen.py	Wed Jul 17 21:25:17 2013 +0200
+++ b/importers/imagen.py	Thu Jul 18 07:42:20 2013 +0200
@@ -470,7 +470,7 @@
     if not scan_infos.get('label') or not scan_infos.get('filepath'):
         return
     scan_eid = store.create_entity('Scan', **scan_infos).eid
-    store.relate(assessment_eid, 'generates', scan_eid, 'Assessment')
+    store.relate(assessment_eid, 'generates', scan_eid, subjtype='Assessment')
     # Add external resource
     filepath = scan.findall('%sfile' % XNAT)[0]
     if format_filepath(filepath.get('URI')):
@@ -582,7 +582,7 @@
             continue
         if assessor.get('%stype' % XSI) in FREESURFER_TYPES:
             measure_eid = build_freesurfer_analysis(store, tree, assessor, study_eid, subject_eid)
-            store.relate(assessment_eid, 'generates', measure_eid, 'Assessment')
+            store.relate(assessment_eid, 'generates', measure_eid, subjtype='Assessment')
             continue
         resource = assessor.findall('%(a)sresources/%(a)sresource' % {'a': XNAT})
         if resource:
@@ -598,7 +598,7 @@
            mri_eid = store.create_entity('MRIData').eid
            assessor_scan_infos['has_data'] = mri_eid
            assessor_scan_eid = store.create_entity('Scan', **assessor_scan_infos).eid
-           store.relate(assessment_eid, 'generates', assessor_scan_eid, 'Assessment')
+           store.relate(assessment_eid, 'generates', assessor_scan_eid, subjtype='Assessment')
         else:
             # This xml node only contains scores, e.g. badrpData
             scan_eid = seen_scan_types.get(assessor.get('base_scan_type', None))
@@ -865,7 +865,7 @@
     store.relate(subject_eid, 'concerned_by', assessment_eid)
     store.relate(center_eid, 'holds', assessment_eid)
     if measure_eid:
-        store.relate(assessment_eid, 'generates', measure_eid, 'Assessment')
+        store.relate(assessment_eid, 'generates', measure_eid, subjtype='Assessment')
     # Files
     for extres_infos in iterate_external_resources(store, experiment, study_eid):
         if extres_infos.get('filepath'):