thbndi commited on
Commit
b2df33a
1 Parent(s): 65663cf

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +12 -11
Mimic4Dataset.py CHANGED
@@ -551,17 +551,18 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
551
  #chart
552
  if self.feat_chart:
553
  chart = data['Chart']
554
- charts=chart['val']
555
- feat=charts.keys()
556
- chart_val=[charts[key] for key in feat]
557
- chart_mean = [round(np.mean(c),3) for c in chart_val]
558
- feat_text = [(items[items['itemid']==f]['label']).to_string(index=False) for f in feat]
559
- template='{} for {}'
560
- chart_text = []
561
- for mean_val, feat_label in zip(chart_mean, feat_text):
562
- text = template.format(mean_val,feat_label)
563
- chart_text.append(text)
564
- chart_text='The chart events mesured are : ' + '; '.join(chart_text)
 
565
  else:
566
  chart_text=''
567
 
 
551
  #chart
552
  if self.feat_chart:
553
  chart = data['Chart']
554
+ if chart:
555
+ charts=chart['val']
556
+ feat=charts.keys()
557
+ chart_val=[charts[key] for key in feat]
558
+ chart_mean = [round(np.mean(c),3) for c in chart_val]
559
+ feat_text = [(items[items['itemid']==f]['label']).to_string(index=False) for f in feat]
560
+ template='{} for {}'
561
+ chart_text = []
562
+ for mean_val, feat_label in zip(chart_mean, feat_text):
563
+ text = template.format(mean_val,feat_label)
564
+ chart_text.append(text)
565
+ chart_text='The chart events mesured are : ' + '; '.join(chart_text)
566
  else:
567
  chart_text=''
568