[importers] Make the stores' relate method compatible with the new API: add the subjtype kwarg.
authorDimitri Papadopoulos <dimitri.papadopoulos@cea.fr>
Fri, 05 Jul 2013 17:52:22 +0200
changeset 291 dce1255ccd02
parent 290 177b5a9ca313
child 292 bb11a190f109
[importers] Make the stores' relate method compatible with the new API: add the subjtype kwarg.
importers/localizer.py
--- a/importers/localizer.py	Tue Jul 16 14:01:40 2013 +0200
+++ b/importers/localizer.py	Fri Jul 05 17:52:22 2013 +0200
@@ -435,8 +435,8 @@
         measure['related_study'] = study.eid
         measure['filepath'] = osp.relpath(measure['filepath'], start=root_dir)
         measure = store.create_entity('GenomicMeasure', **measure)
-        store.relate(measure.eid, 'concerns', subject.eid, 'GenomicMeasure')
-        store.relate(gen_assessment.eid, 'generates', measure.eid, 'Assessment')
+        store.relate(measure.eid, 'concerns', subject.eid, subjtype='GenomicMeasure')
+        store.relate(gen_assessment.eid, 'generates', measure.eid, subjtype='Assessment')
 
         # Anat & fMRI ############################################################
         # anat assessment
@@ -452,9 +452,9 @@
             # Get the relative filepath
             scan_anat['filepath'] = osp.relpath(scan_anat['filepath'], start=root_dir)
             scan_anat = store.create_entity('Scan', **scan_anat)
-            store.relate(scan_anat.eid, 'concerns', subject.eid, 'Scan')
+            store.relate(scan_anat.eid, 'concerns', subject.eid, subjtype='Scan')
             store.relate(scan_anat.eid, 'uses_device', device_id)
-            store.relate(anat_assessment.eid, 'generates', scan_anat.eid, 'Assessment')
+            store.relate(anat_assessment.eid, 'generates', scan_anat.eid, subjtype='Assessment')
         # fmri assessment
         fmri_assessment = import_assessment(sid, 'fmri', study.eid)
         fmri_assessment = store.create_entity('Assessment', **fmri_assessment)
@@ -468,9 +468,9 @@
             # Get the relative filepath
             scan_fmri['filepath'] = osp.relpath(scan_fmri['filepath'], start=root_dir)
             scan_fmri = store.create_entity('Scan', **scan_fmri)
-            store.relate(scan_fmri.eid, 'concerns', subject.eid, 'Scan')
+            store.relate(scan_fmri.eid, 'concerns', subject.eid, subjtype='Scan')
             store.relate(scan_fmri.eid, 'uses_device', device_id)
-            store.relate(fmri_assessment.eid, 'generates', scan_fmri.eid, 'Assessment')
+            store.relate(fmri_assessment.eid, 'generates', scan_fmri.eid, subjtype='Assessment')
 
         # c-maps & t-maps #####################################################
         for dtype, label in (('c', 'c_maps'), ('t', 't_maps')):
@@ -489,9 +489,9 @@
                 # Get the relative filepath
                 scan['filepath'] = osp.relpath(scan['filepath'], start=root_dir)
                 scan = store.create_entity('Scan', **scan)
-                store.relate(scan.eid, 'concerns', subject.eid, 'Scan')
+                store.relate(scan.eid, 'concerns', subject.eid, subjtype='Scan')
                 store.relate(scan.eid, 'uses_device', device_id)
-                store.relate(assessment.eid, 'generates', scan.eid, 'Assessment')
+                store.relate(assessment.eid, 'generates', scan.eid, subjtype='Assessment')
                 store.relate(scan.eid, 'external_resources', con_res.eid)
                 store.relate(scan.eid, 'external_resources', dm_res.eid)
 
@@ -507,9 +507,9 @@
         # Get the relative filepath
         scan['filepath'] = osp.relpath(scan['filepath'], start=root_dir)
         scan = store.create_entity('Scan', **scan)
-        store.relate(scan.eid, 'concerns', subject.eid, 'Scan')
+        store.relate(scan.eid, 'concerns', subject.eid, subjtype='Scan')
         store.relate(scan.eid, 'uses_device', device_id)
-        store.relate(assessment.eid, 'generates', scan.eid, 'Assessment')
+        store.relate(assessment.eid, 'generates', scan.eid, subjtype='Assessment')
 
         # Questionnaire run ###################################################
         assessment = import_assessment(sid, 'questionnaire', study.eid)
@@ -523,8 +523,8 @@
         for answer in answers:
             answer['questionnaire_run'] = run.eid
             answer = store.create_entity('Answer', **answer)
-        store.relate(run.eid, 'concerns', subject.eid, 'QuestionnaireRun')
-        store.relate(assessment.eid, 'generates', run.eid, 'Assessment')
+        store.relate(run.eid, 'concerns', subject.eid, subjtype='QuestionnaireRun')
+        store.relate(assessment.eid, 'generates', run.eid, subjtype='Assessment')
 
     # Flush/Commit
     if sqlgen_store: