thbndi commited on
Commit
dab3f5c
·
1 Parent(s): 8816964

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +29 -5
Mimic4Dataset.py CHANGED
@@ -9,11 +9,13 @@ import subprocess
9
  import shutil
10
  from urllib.request import urlretrieve
11
 
 
12
  _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 : "path/to/mimic4data/from/username/mimiciv/2.2"
 
17
  """
18
 
19
  _HOMEPAGE = "https://huggingface.co/datasets/thbndi/Mimic4Dataset"
@@ -68,6 +70,26 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
68
  version=VERSION,
69
  description="Dataset for mimic4 Mortality task"
70
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  ]
72
 
73
  DEFAULT_CONFIG_NAME = "Mortality"
@@ -132,10 +154,12 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
132
  )
133
 
134
  def _split_generators(self, dl_manager: datasets.DownloadManager()):
135
- if self.config.name == 'Phenotype' and self.config_path is None : self.config_path = _CONFIG_URLS['phenotype']
136
- if self.config.name == 'Readmission' and self.config_path is None : self.config_path = _CONFIG_URLS['readmission']
137
- if self.config.name == 'Length of Stay' and self.config_path is None : self.config_path = _CONFIG_URLS['los']
138
- if self.config.name == 'Mortality' and self.config_path is None : self.config_path = _CONFIG_URLS['mortality']
 
 
139
 
140
  version = self.mimic_path.split('/')[-1]
141
  m = self.mimic_path.split('/')[-2]
 
9
  import shutil
10
  from urllib.request import urlretrieve
11
 
12
+
13
  _DESCRIPTION = """\
14
  Dataset for mimic4 data, by default for the Mortality task.
15
+ Available tasks are: Mortality, Length of Stay, Readmission, Phenotype, Mortality Custom, Length of Stay Custom, Readmission Custom, Phenotype Custom.
16
  The data is extracted from the mimic4 database using this pipeline: 'https://github.com/healthylaife/MIMIC-IV-Data-Pipeline/tree/main'
17
  mimic path should have this form : "path/to/mimic4data/from/username/mimiciv/2.2"
18
+ If you choose a Custom task provide a configuration file for the Time series.
19
  """
20
 
21
  _HOMEPAGE = "https://huggingface.co/datasets/thbndi/Mimic4Dataset"
 
70
  version=VERSION,
71
  description="Dataset for mimic4 Mortality task"
72
  ),
73
+ Mimic4DatasetConfig(
74
+ name="Phenotype Custom",
75
+ version=VERSION,
76
+ description="Dataset for mimic4 Custom Phenotype task"
77
+ ),
78
+ Mimic4DatasetConfig(
79
+ name="Readmission Custom",
80
+ version=VERSION,
81
+ description="Dataset for mimic4 Custom Readmission task"
82
+ ),
83
+ Mimic4DatasetConfig(
84
+ name="Length of Stay Custom",
85
+ version=VERSION,
86
+ description="Dataset for mimic4 Custom Length of Stay task"
87
+ ),
88
+ Mimic4DatasetConfig(
89
+ name="Mortality Custom",
90
+ version=VERSION,
91
+ description="Dataset for mimic4 Custom Mortality task"
92
+ ),
93
  ]
94
 
95
  DEFAULT_CONFIG_NAME = "Mortality"
 
154
  )
155
 
156
  def _split_generators(self, dl_manager: datasets.DownloadManager()):
157
+ if self.config.name == 'Phenotype' : self.config_path = _CONFIG_URLS['phenotype']
158
+ if self.config.name == 'Readmission' : self.config_path = _CONFIG_URLS['readmission']
159
+ if self.config.name == 'Length of Stay' : self.config_path = _CONFIG_URLS['los']
160
+ if self.config.name == 'Mortality' : self.config_path = _CONFIG_URLS['mortality']
161
+ if self.config.name in ['Phenotype Custom','Readmission Custom','Length of Stay Custom','Mortality Custom'] and self.config.name==None:
162
+ raise ValueError('Please select a config file')
163
 
164
  version = self.mimic_path.split('/')[-1]
165
  m = self.mimic_path.split('/')[-2]