Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +11 -2
Mimic4Dataset.py
CHANGED
@@ -3,7 +3,9 @@ import json
|
|
3 |
import os
|
4 |
import pandas as pd
|
5 |
import datasets
|
|
|
6 |
import pickle
|
|
|
7 |
import subprocess
|
8 |
import shutil
|
9 |
from urllib.request import urlretrieve
|
@@ -19,6 +21,7 @@ _HOMEPAGE = "https://huggingface.co/datasets/thbndi/Mimic4Dataset"
|
|
19 |
_CITATION = "https://proceedings.mlr.press/v193/gupta22a.html"
|
20 |
_URL = "https://github.com/healthylaife/MIMIC-IV-Data-Pipeline"
|
21 |
_DATA_GEN = 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/data_generation_icu_modify.py'
|
|
|
22 |
_CONFIG_URLS = {'los' : 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/config/los.config',
|
23 |
'mortality' : 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/config/mortality.config',
|
24 |
'phenotype' : 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/config/phenotype.config',
|
@@ -154,13 +157,19 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
154 |
if not os.path.exists(path_bench+'/config/'+self.config_path.split('/')[-1]):
|
155 |
shutil.move(file_path, path_bench+'/config')
|
156 |
|
157 |
-
file_path, head = urlretrieve(_DATA_GEN, "data_generation_icu_modify.py")
|
158 |
|
159 |
if not os.path.exists(path_bench+'/model/data_generation_icu_modify.py'):
|
|
|
160 |
shutil.move(file_path, path_bench+'/model')
|
161 |
|
|
|
|
|
|
|
|
|
162 |
data_dir = path_bench + "/data/dataDic"
|
163 |
-
|
|
|
|
|
164 |
return [
|
165 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir}),
|
166 |
]
|
|
|
3 |
import os
|
4 |
import pandas as pd
|
5 |
import datasets
|
6 |
+
import sys
|
7 |
import pickle
|
8 |
+
from .cohort import task_cohort
|
9 |
import subprocess
|
10 |
import shutil
|
11 |
from urllib.request import urlretrieve
|
|
|
21 |
_CITATION = "https://proceedings.mlr.press/v193/gupta22a.html"
|
22 |
_URL = "https://github.com/healthylaife/MIMIC-IV-Data-Pipeline"
|
23 |
_DATA_GEN = 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/data_generation_icu_modify.py'
|
24 |
+
_COHORT = 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/cohort.py'
|
25 |
_CONFIG_URLS = {'los' : 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/config/los.config',
|
26 |
'mortality' : 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/config/mortality.config',
|
27 |
'phenotype' : 'https://huggingface.co/datasets/thbndi/Mimic4Dataset/blob/main/config/phenotype.config',
|
|
|
157 |
if not os.path.exists(path_bench+'/config/'+self.config_path.split('/')[-1]):
|
158 |
shutil.move(file_path, path_bench+'/config')
|
159 |
|
|
|
160 |
|
161 |
if not os.path.exists(path_bench+'/model/data_generation_icu_modify.py'):
|
162 |
+
file_path, head = urlretrieve(_DATA_GEN, "data_generation_icu_modify.py")
|
163 |
shutil.move(file_path, path_bench+'/model')
|
164 |
|
165 |
+
if not os.path.exists(path_bench+'cohort.py'):
|
166 |
+
file_path, head = urlretrieve(_COHORT, "cohort.py")
|
167 |
+
shutil.move(file_path, path_bench)
|
168 |
+
|
169 |
data_dir = path_bench + "/data/dataDic"
|
170 |
+
sys.path.append(path_bench)
|
171 |
+
import cohort
|
172 |
+
cohort.task_cohort(self.config.name,self.mimic_path, path_bench, self.config_path)
|
173 |
return [
|
174 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir}),
|
175 |
]
|