thbndi commited on
Commit
a6ab2dc
·
1 Parent(s): 719f4db

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +16 -3
Mimic4Dataset.py CHANGED
@@ -23,17 +23,30 @@ class Mimic4DatasetConfig(datasets.BuilderConfig):
23
 
24
  def __init__(
25
  self,
26
- mimic_path,
27
  config_path,
28
  **kwargs,
29
  ):
30
  super().__init__(**kwargs)
31
- self.mimic_path = mimic_path
32
  self.config_path = config_path
33
-
34
 
35
  class Mimic4Dataset(datasets.GeneratorBasedBuilder):
36
  VERSION = datasets.Version("1.0.0")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  BUILDER_CONFIGS = [
38
  Mimic4DatasetConfig(
39
  name="Phenotype",
 
23
 
24
  def __init__(
25
  self,
 
26
  config_path,
27
  **kwargs,
28
  ):
29
  super().__init__(**kwargs)
 
30
  self.config_path = config_path
 
31
 
32
  class Mimic4Dataset(datasets.GeneratorBasedBuilder):
33
  VERSION = datasets.Version("1.0.0")
34
+
35
+ def __init__(self, **kwargs):
36
+ self.mimic_path = kwargs.pop("mimic_path", None)
37
+ #check if config_path in kwargs to get it
38
+ if "config_path" in kwargs:
39
+ self.config_path = kwargs.pop("config_path")
40
+ else:
41
+ #get the default config_path
42
+ self.config_path = self.BUILDER_CONFIGS[self.builder_config.name].config_path
43
+ if self.mimic_path is None:
44
+ raise ValueError("You must specify the path of the mimic4 data")
45
+ if not os.path.exists(self.mimic_path):
46
+ raise ValueError("The path of the mimic4 data does not exist")
47
+
48
+ super().__init__(**kwargs)
49
+
50
  BUILDER_CONFIGS = [
51
  Mimic4DatasetConfig(
52
  name="Phenotype",