thbndi commited on
Commit
1451f69
·
1 Parent(s): 1b6ebd1

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +14 -9
Mimic4Dataset.py CHANGED
@@ -136,6 +136,12 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
136
  if self.config.name == 'Length of Stay' and self.config_path is None : self.config_path = _CONFIG_URLS['los']
137
  if self.config.name == 'Mortality' and self.config_path is None : self.config_path = _CONFIG_URLS['mortality']
138
 
 
 
 
 
 
 
139
  #clone git repo if doesnt exists
140
  repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
141
  if os.path.exists('MIMIC-IV-Data-Pipeline-main'):
@@ -147,16 +153,15 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
147
  os.chdir(path_bench)
148
  print('1 : '+ os.getcwd())
149
 
150
- version = self.mimic_path.split('/')[-1]
151
  #move data to mimic-iv folder
152
- if not os.path.exists(path_bench+'/mimic-iv'):
153
- os.makedirs(path_bench+'/mimic-iv')
154
-
155
- os.chdir(self.mimic_path.replace(version,''))
156
- print('2 : '+os.getcwd())
157
- shutil.move('/'+version, path_bench+'/mimic-iv/'+version)
158
- self.mimic_path = path_bench+'/mimic-iv/'+version
159
- os.chdir(path_bench)
160
  print('3 : '+os.getcwd())
161
 
162
  #download config file if not custom
 
136
  if self.config.name == 'Length of Stay' and self.config_path is None : self.config_path = _CONFIG_URLS['los']
137
  if self.config.name == 'Mortality' and self.config_path is None : self.config_path = _CONFIG_URLS['mortality']
138
 
139
+ version = self.mimic_path.split('/')[-1]
140
+ dir = self.mimic_path.replace('/mimic-iv/'+version,'')
141
+ os.chdir(dir)
142
+ print('0 : '+os.getcwd())
143
+
144
+
145
  #clone git repo if doesnt exists
146
  repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
147
  if os.path.exists('MIMIC-IV-Data-Pipeline-main'):
 
153
  os.chdir(path_bench)
154
  print('1 : '+ os.getcwd())
155
 
156
+
157
  #move data to mimic-iv folder
158
+ #if not os.path.exists(path_bench+'/mimic-iv'):
159
+ #os.makedirs(path_bench+'/mimic-iv')
160
+ #os.chdir(self.mimic_path.replace(version,''))
161
+ #print('2 : '+os.getcwd())
162
+ #shutil.move('/'+version, path_bench+'/mimic-iv/'+version)
163
+ self.mimic_path = './mimic-iv/'+version
164
+ #os.chdir(path_bench)
 
165
  print('3 : '+os.getcwd())
166
 
167
  #download config file if not custom