Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +12 -9
Mimic4Dataset.py
CHANGED
@@ -17,41 +17,43 @@ _HOMEPAGE = "https://huggingface.co/datasets/thbndi/Mimic4Dataset"
|
|
17 |
_CITATION = "https://proceedings.mlr.press/v193/gupta22a.html"
|
18 |
_GITHUB = "https://github.com/healthylaife/MIMIC-IV-Data-Pipeline/tree/main"
|
19 |
|
20 |
-
class
|
21 |
-
|
22 |
-
|
23 |
def __init__(
|
24 |
self,
|
25 |
-
mimic_path,
|
26 |
#config,
|
27 |
**kwargs,
|
28 |
):
|
29 |
-
self.mimic_path = mimic_path
|
30 |
super().__init__(**kwargs)
|
31 |
|
32 |
#self.config = config
|
33 |
#cohort.task_cohort(self.task,self.mimic_path)
|
|
|
34 |
|
|
|
|
|
35 |
BUILDER_CONFIGS = [
|
36 |
-
|
37 |
name="Phenotype",
|
38 |
version=VERSION,
|
39 |
data_dir=os.path.abspath("./data/dict/cohort_icu_readmission_30_I50"),
|
40 |
description="Dataset for mimic4 Phenotype task"
|
|
|
41 |
),
|
42 |
-
|
43 |
name="Readmission",
|
44 |
version=VERSION,
|
45 |
data_dir=os.path.abspath("./data/dict"),
|
46 |
description="Dataset for mimic4 Readmission task",
|
47 |
),
|
48 |
-
|
49 |
name="Length of Stay",
|
50 |
version=VERSION,
|
51 |
data_dir=os.path.abspath("./data/dict"),
|
52 |
description="Dataset for mimic4 Length of Stay task",
|
53 |
),
|
54 |
-
|
55 |
name="Mortality",
|
56 |
version=VERSION,
|
57 |
data_dir=os.path.abspath("./data/dict"),
|
@@ -100,6 +102,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
100 |
|
101 |
def _split_generators(self, dl_manager):
|
102 |
data_dir = self.config.data_dir + "/dataDic"
|
|
|
103 |
return [
|
104 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir}),
|
105 |
]
|
|
|
17 |
_CITATION = "https://proceedings.mlr.press/v193/gupta22a.html"
|
18 |
_GITHUB = "https://github.com/healthylaife/MIMIC-IV-Data-Pipeline/tree/main"
|
19 |
|
20 |
+
class Mimic4DatasetConfig(datasets.BuilderConfig):
|
21 |
+
"""BuilderConfig for Mimic4Dataset."""
|
22 |
+
|
23 |
def __init__(
|
24 |
self,
|
|
|
25 |
#config,
|
26 |
**kwargs,
|
27 |
):
|
|
|
28 |
super().__init__(**kwargs)
|
29 |
|
30 |
#self.config = config
|
31 |
#cohort.task_cohort(self.task,self.mimic_path)
|
32 |
+
|
33 |
|
34 |
+
class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
35 |
+
VERSION = datasets.Version("1.0.0")
|
36 |
BUILDER_CONFIGS = [
|
37 |
+
Mimic4DatasetConfig(
|
38 |
name="Phenotype",
|
39 |
version=VERSION,
|
40 |
data_dir=os.path.abspath("./data/dict/cohort_icu_readmission_30_I50"),
|
41 |
description="Dataset for mimic4 Phenotype task"
|
42 |
+
mimic_path = None
|
43 |
),
|
44 |
+
Mimic4DatasetConfig(
|
45 |
name="Readmission",
|
46 |
version=VERSION,
|
47 |
data_dir=os.path.abspath("./data/dict"),
|
48 |
description="Dataset for mimic4 Readmission task",
|
49 |
),
|
50 |
+
Mimic4DatasetConfig(
|
51 |
name="Length of Stay",
|
52 |
version=VERSION,
|
53 |
data_dir=os.path.abspath("./data/dict"),
|
54 |
description="Dataset for mimic4 Length of Stay task",
|
55 |
),
|
56 |
+
Mimic4DatasetConfig(
|
57 |
name="Mortality",
|
58 |
version=VERSION,
|
59 |
data_dir=os.path.abspath("./data/dict"),
|
|
|
102 |
|
103 |
def _split_generators(self, dl_manager):
|
104 |
data_dir = self.config.data_dir + "/dataDic"
|
105 |
+
mimic=self.mimic_path
|
106 |
return [
|
107 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir}),
|
108 |
]
|