thbndi commited on
Commit
daf5242
1 Parent(s): 2bca97a

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +40 -19
Mimic4Dataset.py CHANGED
@@ -159,33 +159,54 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
159
  "value": values_outs}
160
 
161
  #chart signal
162
- items_chart_sig = list(chart_features['signal'].keys())
163
- values_chart_sig =[chart_features['signal'][i] for i in items_chart_sig ]
164
- chart_sig = {"id" : items_chart_sig,
165
- "value": values_chart_sig}
 
 
 
 
166
  #chart val
167
- items_chart_val = list(chart_features['val'].keys())
168
- values_chart_val =[chart_features['val'][i] for i in items_chart_val ]
169
- chart_val = {"id" : items_chart_val,
170
- "value": values_chart_val}
 
 
 
 
 
171
  charts = {"signal" : chart_sig,
172
  "val" : chart_val}
173
 
174
  #meds signal
175
- items_meds_sig = list(meds_features['signal'].keys())
176
- values_meds_sig =[meds_features['signal'][i] for i in items_meds_sig ]
177
- meds_sig = {"id" : items_meds_sig,
 
178
  "value": values_meds_sig}
 
 
 
179
  #meds rate
180
- items_meds_rate = list(meds_features['rate'].keys())
181
- values_meds_rate =[meds_features['rate'][i] for i in items_meds_rate ]
182
- meds_rate = {"id" : items_meds_rate,
183
- "value": values_meds_rate}
 
 
 
 
184
  #meds amount
185
- items_meds_amount = list(meds_features['amount'].keys())
186
- values_meds_amount =[meds_features['amount'][i] for i in items_meds_amount ]
187
- meds_amount = {"id" : items_meds_amount,
188
- "value": values_meds_amount}
 
 
 
 
189
 
190
  meds = {"signal" : meds_sig,
191
  "rate" : meds_rate,
 
159
  "value": values_outs}
160
 
161
  #chart signal
162
+ if ('signal' in chart_features):
163
+ items_chart_sig = list(chart_features['signal'].keys())
164
+ values_chart_sig =[chart_features['signal'][i] for i in items_chart_sig ]
165
+ chart_sig = {"id" : items_chart_sig,
166
+ "value": values_chart_sig}
167
+ else:
168
+ chart_sig = {"id" : [],
169
+ "value": []}
170
  #chart val
171
+ if ('val' in chart_features):
172
+ items_chart_val = list(chart_features['val'].keys())
173
+ values_chart_val =[chart_features['val'][i] for i in items_chart_val ]
174
+ chart_val = {"id" : items_chart_val,
175
+ "value": values_chart_val}
176
+ else:
177
+ chart_val = {"id" : [],
178
+ "value": []}
179
+
180
  charts = {"signal" : chart_sig,
181
  "val" : chart_val}
182
 
183
  #meds signal
184
+ if ('signal' in meds_features):
185
+ items_meds_sig = list(meds_features['signal'].keys())
186
+ values_meds_sig =[meds_features['signal'][i] for i in items_meds_sig ]
187
+ meds_sig = {"id" : items_meds_sig,
188
  "value": values_meds_sig}
189
+ else:
190
+ meds_sig = {"id" : [],
191
+ "value": []}
192
  #meds rate
193
+ if ('rate' in meds_features):
194
+ items_meds_rate = list(meds_features['rate'].keys())
195
+ values_meds_rate =[meds_features['rate'][i] for i in items_meds_rate ]
196
+ meds_rate = {"id" : items_meds_rate,
197
+ "value": values_meds_rate}
198
+ else:
199
+ meds_rate = {"id" : [],
200
+ "value": []}
201
  #meds amount
202
+ if ('amount' in meds_features):
203
+ items_meds_amount = list(meds_features['amount'].keys())
204
+ values_meds_amount =[meds_features['amount'][i] for i in items_meds_amount ]
205
+ meds_amount = {"id" : items_meds_amount,
206
+ "value": values_meds_amount}
207
+ else:
208
+ meds_amount = {"id" : [],
209
+ "value": []}
210
 
211
  meds = {"signal" : meds_sig,
212
  "rate" : meds_rate,