Пример #1
0
 def load_demographics(self, file):
     f = codecs.open(file, 'r', 'utf-8')
     reader = csv.reader(f)
     line_ctr = 0
     for row in reader:
         # table title
         if line_ctr < 1:
             table_ttl = dict(zip(row, range(len(row))))
             line_ctr += 1
             continue
         if len(row) == 0:
             continue
         pval = Patient()
         pid = row[table_ttl['ID']]
         pval.age = row[table_ttl['AGE']]
         pval.gender = row[table_ttl['GENDER']]
         pval.edu_year = row[table_ttl['EDUCATION YEAR']]
         pval.duration = row[table_ttl['DURATION(MONTH)']]
         self.patient_info[pid] = pval
         line_ctr += 1
     f.close()