thbndi commited on
Commit
3a44a8f
·
1 Parent(s): 86206c8

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +12 -8
Mimic4Dataset.py CHANGED
@@ -11,7 +11,7 @@ _DESCRIPTION = """\
11
  Dataset for mimic4 data, by default for the Mortality task.
12
  Available tasks are: Mortality, Length of Stay, Readmission, Phenotype.
13
  The data is extracted from the mimic4 database using this pipeline: 'https://github.com/healthylaife/MIMIC-IV-Data-Pipeline/tree/main'
14
- mimic path should have this form :
15
  """
16
 
17
  _HOMEPAGE = "https://huggingface.co/datasets/thbndi/Mimic4Dataset"
@@ -142,20 +142,24 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
142
  self.config_path = './config/los.config'
143
  elif self.config_path is None and self.name == 'Mortality':
144
  self.config_path = './config/mortality.config'
145
- repodir = os.getcwd()
146
- path_bench = repodir+'/MIMIC-IV-Data-Pipeline-main'
147
  repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
 
 
 
 
 
 
 
148
  data_dir = path_bench + "/data/dataDic"
149
- if not os.path.exists(path_bench):
150
- #subprocess.run(["git", "clone", repo_url, path_bench])
151
- print("Please clone the repo")
152
  #task_cohort(self.name,self.mimic_path, path_bench, self.config_path)
153
  return [
154
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir, "benchmark": path_bench}),
155
  ]
156
 
157
 
158
- def _generate_examples(self, filepath,benchmark):
159
  with open(filepath, 'rb') as fp:
160
  dataDic = pickle.load(fp)
161
  for hid, data in dataDic.items():
 
11
  Dataset for mimic4 data, by default for the Mortality task.
12
  Available tasks are: Mortality, Length of Stay, Readmission, Phenotype.
13
  The data is extracted from the mimic4 database using this pipeline: 'https://github.com/healthylaife/MIMIC-IV-Data-Pipeline/tree/main'
14
+ mimic path should have this form : "absolute/path/to/mimic4data/mimiciv/2.2"
15
  """
16
 
17
  _HOMEPAGE = "https://huggingface.co/datasets/thbndi/Mimic4Dataset"
 
142
  self.config_path = './config/los.config'
143
  elif self.config_path is None and self.name == 'Mortality':
144
  self.config_path = './config/mortality.config'
145
+
 
146
  repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
147
+ if os.path.exists(os.path.dirname(os.path.abspath('MIMIC-IV-Data-Pipeline-main'))):
148
+ path_bench = os.path.dirname(os.path.abspath('MIMIC-IV-Data-Pipeline-main'))+'/MIMIC-IV-Data-Pipeline-main'
149
+ else:
150
+ repodir = os.getcwd()
151
+ path_bench = repodir+'/MIMIC-IV-Data-Pipeline-main'
152
+ subprocess.run(["git", "clone", repo_url, path_bench])
153
+
154
  data_dir = path_bench + "/data/dataDic"
155
+ print(data_dir)
 
 
156
  #task_cohort(self.name,self.mimic_path, path_bench, self.config_path)
157
  return [
158
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir}),
159
  ]
160
 
161
 
162
+ def _generate_examples(self, filepath):
163
  with open(filepath, 'rb') as fp:
164
  dataDic = pickle.load(fp)
165
  for hid, data in dataDic.items():