Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +42 -4
Mimic4Dataset.py
CHANGED
@@ -76,7 +76,26 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
76 |
"ethnicity": datasets.Value("string"),
|
77 |
"age": datasets.Value("int32"),
|
78 |
"COND": datasets.Sequence(datasets.Value("string")),
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
"PROC": {
|
81 |
"id": datasets.Sequence(datasets.Value("int32")),
|
82 |
"value": datasets.Sequence(datasets.Sequence(datasets.Value("float32")))
|
@@ -150,15 +169,34 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
150 |
"value": values_chart_val}
|
151 |
charts = {"signal" : chart_sig,
|
152 |
"val" : chart_val}
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
yield int(hid), {
|
|
|
155 |
"gender" : gender,
|
156 |
"ethnicity" : eth,
|
157 |
"age" : age,
|
|
|
158 |
"PROC" : procs,
|
159 |
"CHART" : charts,
|
160 |
"OUT" : outs,
|
161 |
-
"
|
162 |
-
"label" : label
|
163 |
}
|
164 |
|
|
|
76 |
"ethnicity": datasets.Value("string"),
|
77 |
"age": datasets.Value("int32"),
|
78 |
"COND": datasets.Sequence(datasets.Value("string")),
|
79 |
+
"MEDS": {
|
80 |
+
"signal": datasets.Sequence(
|
81 |
+
{
|
82 |
+
"id": datasets.Sequence(datasets.Value("int32")),
|
83 |
+
"value": datasets.Sequence(datasets.Value("float32"))
|
84 |
+
}
|
85 |
+
),
|
86 |
+
"rate": datasets.Sequence(
|
87 |
+
{
|
88 |
+
"id": datasets.Value("int32"),
|
89 |
+
"value": datasets.Sequence(datasets.Value("float32"))
|
90 |
+
}
|
91 |
+
),
|
92 |
+
"amount": datasets.Sequence(
|
93 |
+
{
|
94 |
+
"id": datasets.Value("int32"),
|
95 |
+
"value": datasets.Sequence(datasets.Value("float32"))
|
96 |
+
}
|
97 |
+
)
|
98 |
+
},
|
99 |
"PROC": {
|
100 |
"id": datasets.Sequence(datasets.Value("int32")),
|
101 |
"value": datasets.Sequence(datasets.Sequence(datasets.Value("float32")))
|
|
|
169 |
"value": values_chart_val}
|
170 |
charts = {"signal" : chart_sig,
|
171 |
"val" : chart_val}
|
172 |
+
|
173 |
+
#meds signal
|
174 |
+
items_meds_sig = list(meds_features['signal'].keys())
|
175 |
+
values_meds_sig =[meds_features['signal'][i] for i in items_meds_sig ]
|
176 |
+
meds_sig = {"id" : items_meds_sig,
|
177 |
+
"value": values_meds_sig}
|
178 |
+
#meds rate
|
179 |
+
items_meds_rate = list(meds_features['rate'].keys())
|
180 |
+
values_meds_rate =[meds_features['rate'][i] for i in items_meds_rate ]
|
181 |
+
meds_rate = {"id" : items_meds_rate,
|
182 |
+
"value": values_meds_rate}
|
183 |
+
#meds amount
|
184 |
+
items_meds_amount = list(meds_features['amount'].keys())
|
185 |
+
values_meds_amount =[meds_features['amount'][i] for i in items_meds_amount ]
|
186 |
+
meds_amount = {"id" : items_meds_amount,
|
187 |
+
"value": values_meds_amount}
|
188 |
+
meds = {"signal" : meds_sig,
|
189 |
+
"rate" : meds_rate,
|
190 |
+
"amount" : meds_amount}
|
191 |
yield int(hid), {
|
192 |
+
"label" : label,
|
193 |
"gender" : gender,
|
194 |
"ethnicity" : eth,
|
195 |
"age" : age,
|
196 |
+
"COND" : cond_features,
|
197 |
"PROC" : procs,
|
198 |
"CHART" : charts,
|
199 |
"OUT" : outs,
|
200 |
+
"MEDS" : meds
|
|
|
201 |
}
|
202 |
|