[importers/random] Fix importer so that related_study holds between Assessments and Studies
authorVladimir Popescu <vladimir.popescu@logilab.fr>
Mon, 15 Jul 2013 15:59:05 +0200
changeset 285 bc1b051a853c
parent 284 6b889bd4625d
child 286 2a23efeb6217
[importers/random] Fix importer so that related_study holds between Assessments and Studies
importers/random.py
--- a/importers/random.py	Wed Jul 17 12:12:21 2013 +0200
+++ b/importers/random.py	Mon Jul 15 15:59:05 2013 +0200
@@ -49,6 +49,7 @@
     date = random_date()
     assessment = store.create_entity('Assessment', identifier=u'%s_%s' % (label, subject_eid),
                                      datetime=date, protocol=u'Demo questionnaire')
+    store.relate(assessment.eid, 'related_study', study_eid, subtype='Assessment')
     store.relate(center_eid, 'holds', assessment.eid)
     store.relate(subject_eid, 'concerned_by', assessment.eid)
     user_ident = nr.randint(10)
@@ -69,6 +70,7 @@
     date = random_date()
     assessment = store.create_entity('Assessment', identifier=u'genomics_%s' % subject_eid,
                                      datetime=date, protocol=u'Demo genomics')
+    store.relate(assessment.eid, 'related_study', study_eid, subjtype='Assessment')
     store.relate(center_eid, 'holds', assessment.eid)
     store.relate(subject_eid, 'concerned_by', assessment.eid)
     measure = store.create_entity('GenomicMeasure', identifier=u'genomic_measure_%s' % subject_eid,
@@ -83,6 +85,7 @@
     date = random_date()
     assessment = store.create_entity('Assessment', identifier=u'anat_%s' % subject_eid,
                                      datetime=date, protocol=u'Demo anat')
+    store.relate(assessment.eid, 'related_study', study_eid, subjtype='Assessment')
     store.relate(center_eid, 'holds', assessment.eid)
     store.relate(subject_eid, 'concerned_by', assessment.eid)
     mri_data = store.create_entity('MRIData',
@@ -104,6 +107,7 @@
     date = random_date()
     assessment = store.create_entity('Assessment', identifier=u'fmri_%s' % subject_eid,
                                      datetime=date, protocol=u'Demo fmri')
+    store.relate(assessment.eid, 'related_study', study_eid, subjtype='Assessment')
     store.relate(center_eid, 'holds', assessment.eid)
     store.relate(subject_eid, 'concerned_by', assessment.eid)
     mri_data = store.create_entity('MRIData',
@@ -125,6 +129,7 @@
     date = random_date()
     assessment = store.create_entity('Assessment', identifier=u'cmap_%s' % subject_eid,
                                      datetime=date, protocol=u'Demo c map')
+    store.relate(assessment.eid, 'related_study', study_eid, subjtype='Assessment')
     store.relate(center_eid, 'holds', assessment.eid)
     store.relate(subject_eid, 'concerned_by', assessment.eid)
     for ind, label in enumerate((u'Audio-Video', u'Text reading', u'Video reading',