Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +14 -9
Mimic4Dataset.py
CHANGED
@@ -13,7 +13,7 @@ _DESCRIPTION = """\
|
|
13 |
Dataset for mimic4 data, by default for the Mortality task.
|
14 |
Available tasks are: Mortality, Length of Stay, Readmission, Phenotype.
|
15 |
The data is extracted from the mimic4 database using this pipeline: 'https://github.com/healthylaife/MIMIC-IV-Data-Pipeline/tree/main'
|
16 |
-
mimic path should have this form : "
|
17 |
"""
|
18 |
|
19 |
_HOMEPAGE = "https://huggingface.co/datasets/thbndi/Mimic4Dataset"
|
@@ -140,22 +140,27 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
140 |
version = self.mimic_path.split('/')[-1]
|
141 |
m = self.mimic_path.split('/')[-2]
|
142 |
s='/'+m+'/'+version
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
|
147 |
#clone git repo if doesnt exists
|
148 |
repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
|
149 |
if os.path.exists('MIMIC-IV-Data-Pipeline-main'):
|
150 |
-
path_bench =
|
|
|
151 |
else:
|
152 |
-
|
153 |
-
path_bench = repodir+'/MIMIC-IV-Data-Pipeline-main'
|
154 |
subprocess.run(["git", "clone", repo_url, path_bench])
|
155 |
os.chdir(path_bench)
|
156 |
-
|
157 |
-
shutil.move(self.mimic_path, './')
|
158 |
-
os.
|
159 |
|
160 |
#download config file if not custom
|
161 |
if self.config_path[0:4] == 'http':
|
|
|
13 |
Dataset for mimic4 data, by default for the Mortality task.
|
14 |
Available tasks are: Mortality, Length of Stay, Readmission, Phenotype.
|
15 |
The data is extracted from the mimic4 database using this pipeline: 'https://github.com/healthylaife/MIMIC-IV-Data-Pipeline/tree/main'
|
16 |
+
mimic path should have this form : "path/to/mimic4data/from/username/mimiciv/2.2"
|
17 |
"""
|
18 |
|
19 |
_HOMEPAGE = "https://huggingface.co/datasets/thbndi/Mimic4Dataset"
|
|
|
140 |
version = self.mimic_path.split('/')[-1]
|
141 |
m = self.mimic_path.split('/')[-2]
|
142 |
s='/'+m+'/'+version
|
143 |
+
root = self.mimic_path.replace(s,'')
|
144 |
+
if dir[-1]!='/':
|
145 |
+
dir=dir+'/'
|
146 |
+
elif dir=='':
|
147 |
+
dir="./"
|
148 |
+
os.chdir(root)
|
149 |
+
|
150 |
|
151 |
|
152 |
#clone git repo if doesnt exists
|
153 |
repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
|
154 |
if os.path.exists('MIMIC-IV-Data-Pipeline-main'):
|
155 |
+
path_bench = root+'MIMIC-IV-Data-Pipeline-main'
|
156 |
+
os.chdir(path_bench)
|
157 |
else:
|
158 |
+
path_bench = root+'MIMIC-IV-Data-Pipeline-main'
|
|
|
159 |
subprocess.run(["git", "clone", repo_url, path_bench])
|
160 |
os.chdir(path_bench)
|
161 |
+
os.makedirs(m)
|
162 |
+
shutil.move(self.mimic_path, './'+m)
|
163 |
+
print('0 : '+os.getcwd())
|
164 |
|
165 |
#download config file if not custom
|
166 |
if self.config_path[0:4] == 'http':
|