Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +10 -3
Mimic4Dataset.py
CHANGED
@@ -55,7 +55,11 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
55 |
"ethnicity": datasets.Value("string"),
|
56 |
"insurance": datasets.Value("string"),
|
57 |
"age": datasets.Value("int32"),
|
58 |
-
"COND": datasets.Sequence(
|
|
|
|
|
|
|
|
|
59 |
"MEDS": datasets.Sequence(datasets.Value("int32"),datasets.Value("int32")),
|
60 |
"PROC": datasets.Sequence(datasets.Value("int32"),datasets.Value("int32")),
|
61 |
"CHART": datasets.Sequence(datasets.Value("int32"),datasets.Value("int32")),
|
@@ -126,7 +130,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
126 |
proc_dict = proc.iloc[0].to_dict()
|
127 |
chart_dict = chart.iloc[0].to_dict()
|
128 |
out_dict = out.iloc[0].to_dict()
|
129 |
-
|
130 |
#get stay_id which is the name of the folder containing the files
|
131 |
stay_id = int(demographic_file.split("/")[-2])
|
132 |
#get the label
|
@@ -141,6 +145,9 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
141 |
"PROC" : proc_dict,
|
142 |
"CHART" : chart_dict,
|
143 |
"OUT" : out_dict,
|
144 |
-
"COND" :
|
|
|
|
|
|
|
145 |
"label" : label
|
146 |
}
|
|
|
55 |
"ethnicity": datasets.Value("string"),
|
56 |
"insurance": datasets.Value("string"),
|
57 |
"age": datasets.Value("int32"),
|
58 |
+
"COND": datasets.Sequence(
|
59 |
+
{
|
60 |
+
"cond" : datasets.Value("string"),
|
61 |
+
"value" : datasets.Value("int32")
|
62 |
+
}),
|
63 |
"MEDS": datasets.Sequence(datasets.Value("int32"),datasets.Value("int32")),
|
64 |
"PROC": datasets.Sequence(datasets.Value("int32"),datasets.Value("int32")),
|
65 |
"CHART": datasets.Sequence(datasets.Value("int32"),datasets.Value("int32")),
|
|
|
130 |
proc_dict = proc.iloc[0].to_dict()
|
131 |
chart_dict = chart.iloc[0].to_dict()
|
132 |
out_dict = out.iloc[0].to_dict()
|
133 |
+
stat2 = {'cond': list(stat_dict.keys()), 'value': list(stat_dict.values())}
|
134 |
#get stay_id which is the name of the folder containing the files
|
135 |
stay_id = int(demographic_file.split("/")[-2])
|
136 |
#get the label
|
|
|
145 |
"PROC" : proc_dict,
|
146 |
"CHART" : chart_dict,
|
147 |
"OUT" : out_dict,
|
148 |
+
"COND" : {
|
149 |
+
"cond" : stat2['cond'],
|
150 |
+
"value" : stat2['value']
|
151 |
+
},
|
152 |
"label" : label
|
153 |
}
|