thbndi commited on
Commit
bcf2d35
·
1 Parent(s): ca7b53d

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +17 -12
Mimic4Dataset.py CHANGED
@@ -136,18 +136,23 @@ 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
- #move to parent directory of mimic data
140
- version = self.mimic_path.split('/')[-1]
141
- m = self.mimic_path.split('/')[-2]
142
- s='/'+m+'/'+version
143
- dir = self.mimic_path.replace(s,'')
144
- if dir[-1]!='/':
145
- dir=dir+'/'
146
- elif dir=='':
147
- dir="./"
148
- print(os.getcwd())
149
- parent_dir = os.path.dirname(self.mimic_path)
150
- os.chdir(parent_dir)
 
 
 
 
 
151
 
152
  #clone git repo if doesnt exists
153
  repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
 
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
+ current_directory = os.getcwd()
140
+ if os.path.exists(os.path.dirname(current_directory)+'/MIMIC-IV-Data-Pipeline-main'):
141
+ dir =os.path.dirname(current_directory)
142
+ os.chdir(dir)
143
+ else:
144
+ #move to parent directory of mimic data
145
+ version = self.mimic_path.split('/')[-1]
146
+ m = self.mimic_path.split('/')[-2]
147
+ s='/'+m+'/'+version
148
+ dir = self.mimic_path.replace(s,'')
149
+ if dir[-1]!='/':
150
+ dir=dir+'/'
151
+ elif dir=='':
152
+ dir="./"
153
+ print(os.getcwd())
154
+ parent_dir = os.path.dirname(self.mimic_path)
155
+ os.chdir(parent_dir)
156
 
157
  #clone git repo if doesnt exists
158
  repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'