Update Mimic4Dataset.py
Browse files- 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 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
|
|
|
| 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 |
|