Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +10 -9
Mimic4Dataset.py
CHANGED
@@ -473,11 +473,13 @@ def task_cohort(task, mimic_path, config_path):
|
|
473 |
include=int(timeW.split()[1])
|
474 |
bucket = config['timebucket']
|
475 |
radimp = config['radimp']
|
|
|
476 |
diag_flag = config['diagnosis']
|
477 |
out_flag = config['output']
|
478 |
chart_flag = config['chart']
|
479 |
proc_flag= config['proc']
|
480 |
med_flag = config['meds']
|
|
|
481 |
disease_filter = config['disease_filter']
|
482 |
icu_no_icu = config['icu_no_icu']
|
483 |
groupingICD = config['groupingICD']
|
@@ -681,14 +683,10 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
681 |
if not os.path.exists('./config'):
|
682 |
os.makedirs('config')
|
683 |
#save config file in config folder
|
684 |
-
conf='./config/'+file_path.split('/')[-1]
|
685 |
-
if not os.path.exists(conf):
|
686 |
shutil.move(file_path,'./config')
|
687 |
-
|
688 |
-
config = yaml.safe_load(f)
|
689 |
-
feat_cond, feat_chart, feat_proc, feat_meds, feat_out = config['diagnosis'], config['chart'], config['proc'], config['meds'], config['output']
|
690 |
-
|
691 |
-
|
692 |
#####################downloads modules from hub
|
693 |
if not os.path.exists('./model/data_generation_icu_modify.py'):
|
694 |
file_path, head = urlretrieve(_DATA_GEN, "data_generation_icu_modify.py")
|
@@ -731,7 +729,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
731 |
with open(test_path, 'wb') as f:
|
732 |
pickle.dump(test_dic, f)
|
733 |
|
734 |
-
return
|
735 |
|
736 |
###########################################################RAW##################################################################
|
737 |
|
@@ -980,7 +978,10 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
980 |
|
981 |
#############################################################################################################################
|
982 |
def _info(self):
|
983 |
-
|
|
|
|
|
|
|
984 |
if self.encoding == 'onehot' :
|
985 |
return self._info_encoded()
|
986 |
|
|
|
473 |
include=int(timeW.split()[1])
|
474 |
bucket = config['timebucket']
|
475 |
radimp = config['radimp']
|
476 |
+
|
477 |
diag_flag = config['diagnosis']
|
478 |
out_flag = config['output']
|
479 |
chart_flag = config['chart']
|
480 |
proc_flag= config['proc']
|
481 |
med_flag = config['meds']
|
482 |
+
|
483 |
disease_filter = config['disease_filter']
|
484 |
icu_no_icu = config['icu_no_icu']
|
485 |
groupingICD = config['groupingICD']
|
|
|
683 |
if not os.path.exists('./config'):
|
684 |
os.makedirs('config')
|
685 |
#save config file in config folder
|
686 |
+
self.conf='./config/'+file_path.split('/')[-1]
|
687 |
+
if not os.path.exists(self.conf):
|
688 |
shutil.move(file_path,'./config')
|
689 |
+
|
|
|
|
|
|
|
|
|
690 |
#####################downloads modules from hub
|
691 |
if not os.path.exists('./model/data_generation_icu_modify.py'):
|
692 |
file_path, head = urlretrieve(_DATA_GEN, "data_generation_icu_modify.py")
|
|
|
729 |
with open(test_path, 'wb') as f:
|
730 |
pickle.dump(test_dic, f)
|
731 |
|
732 |
+
return dict_dir
|
733 |
|
734 |
###########################################################RAW##################################################################
|
735 |
|
|
|
978 |
|
979 |
#############################################################################################################################
|
980 |
def _info(self):
|
981 |
+
with open(self.conf) as f:
|
982 |
+
config = yaml.safe_load(f)
|
983 |
+
self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out = config['diagnosis'], config['chart'], config['proc'], config['meds'], config['output']
|
984 |
+
self.path = self.create_cohort()
|
985 |
if self.encoding == 'onehot' :
|
986 |
return self._info_encoded()
|
987 |
|