thbndi commited on
Commit
8a08aed
·
1 Parent(s): 0d34bbf

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +37 -37
Mimic4Dataset.py CHANGED
@@ -144,41 +144,41 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
144
 
145
 
146
  def _generate_examples(self, filepath):
147
- with open(filepath, 'rb') as fp:
148
- dataDic = pickle.load(fp)
149
- for hid, data in dataDic.items():
150
- proc_features = data['Proc']
151
- chart_features = data['Chart']
152
- meds_features = data['Med']
153
- out_features = data['Out']
154
- cond_features = data['Cond']['fids']
155
- eth= data['ethnicity']
156
- age = data['age']
157
- gender = data['gender']
158
- label = data['label']
159
-
160
- # Convert integer PROC feature to dictionary
161
- if isinstance(proc_features, int):
162
- proc_features = {proc_features: []}
163
- if isinstance(out_features, int):
164
- proc_features = {out_features: []}
165
-
166
- yield hid, {
167
- "gender" : gender,
168
- "ethnicity" : eth,
169
- "age" : age,
170
- "MEDS" : {
171
- "signal" : meds_features['signal'],
172
- "rate" : meds_features['rate'],
173
- "amount" : meds_features['amount']
174
- },
175
- "PROC" : proc_features,
176
- "CHART" : {
177
- "signal" : chart_features['signal'],
178
- "val" : chart_features['val']
179
- },
180
- "OUT" : out_features,
181
- "COND" : cond_features,
182
- "label" : label
183
- }
184
 
 
144
 
145
 
146
  def _generate_examples(self, filepath):
147
+ with open(filepath, 'rb') as fp:
148
+ dataDic = pickle.load(fp)
149
+ for hid, data in dataDic.items():
150
+ proc_features = data['Proc']
151
+ chart_features = data['Chart']
152
+ meds_features = data['Med']
153
+ out_features = data['Out']
154
+ cond_features = data['Cond']['fids']
155
+ eth= data['ethnicity']
156
+ age = data['age']
157
+ gender = data['gender']
158
+ label = data['label']
159
+
160
+ # Convert integer PROC feature to dictionary
161
+ if isinstance(proc_features, int):
162
+ proc_features = {proc_features: []}
163
+ if isinstance(out_features, int):
164
+ proc_features = {out_features: []}
165
+
166
+ yield hid, {
167
+ "gender" : gender,
168
+ "ethnicity" : eth,
169
+ "age" : age,
170
+ "MEDS" : {
171
+ "signal" : meds_features['signal'],
172
+ "rate" : meds_features['rate'],
173
+ "amount" : meds_features['amount']
174
+ },
175
+ "PROC" : proc_features,
176
+ "CHART" : {
177
+ "signal" : chart_features['signal'],
178
+ "val" : chart_features['val']
179
+ },
180
+ "OUT" : out_features,
181
+ "COND" : cond_features,
182
+ "label" : label
183
+ }
184