thbndi commited on
Commit
48c5fb0
·
1 Parent(s): b1f407e

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +7 -9
Mimic4Dataset.py CHANGED
@@ -4,7 +4,7 @@ import os
4
  import pandas as pd
5
  import datasets
6
  import pickle
7
- #import cohort
8
  from .test import print_test
9
  import subprocess
10
 
@@ -25,14 +25,10 @@ class Mimic4DatasetConfig(datasets.BuilderConfig):
25
  def __init__(
26
  self,
27
  mimic_path,
28
- #config,
29
  **kwargs,
30
  ):
31
  super().__init__(**kwargs)
32
  self.mimic_path =mimic_path
33
-
34
- #self.config = config
35
- #cohort.task_cohort(self.task,self.mimic_path)
36
 
37
 
38
  class Mimic4Dataset(datasets.GeneratorBasedBuilder):
@@ -41,24 +37,28 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
41
  Mimic4DatasetConfig(
42
  name="Phenotype",
43
  version=VERSION,
 
44
  description="Dataset for mimic4 Phenotype task",
45
  mimic_path = None
46
  ),
47
  Mimic4DatasetConfig(
48
  name="Readmission",
49
  version=VERSION,
 
50
  description="Dataset for mimic4 Readmission task",
51
  mimic_path = None
52
  ),
53
  Mimic4DatasetConfig(
54
  name="Length of Stay",
55
  version=VERSION,
 
56
  description="Dataset for mimic4 Length of Stay task",
57
  mimic_path = None
58
  ),
59
  Mimic4DatasetConfig(
60
  name="Mortality",
61
  version=VERSION,
 
62
  description="Dataset for mimic4 Mortality task",
63
  mimic_path = None
64
  ),
@@ -131,16 +131,14 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
131
  repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
132
  data_dir = path_bench + "/data/dataDic"
133
  if not os.path.exists(path_bench):
134
- #subprocess.run(["git", "clone", repo_url, path_bench])
135
- print('ok')
136
-
137
  return [
138
  datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir, "benchmark": path_bench}),
139
  ]
140
 
141
 
142
  def _generate_examples(self, filepath,benchmark):
143
- print_test('hello',benchmark)
144
  with open(filepath, 'rb') as fp:
145
  dataDic = pickle.load(fp)
146
  for hid, data in dataDic.items():
 
4
  import pandas as pd
5
  import datasets
6
  import pickle
7
+ from .cohort import task_cohort
8
  from .test import print_test
9
  import subprocess
10
 
 
25
  def __init__(
26
  self,
27
  mimic_path,
 
28
  **kwargs,
29
  ):
30
  super().__init__(**kwargs)
31
  self.mimic_path =mimic_path
 
 
 
32
 
33
 
34
  class Mimic4Dataset(datasets.GeneratorBasedBuilder):
 
37
  Mimic4DatasetConfig(
38
  name="Phenotype",
39
  version=VERSION,
40
+ config_path = './config/phenotype.config'
41
  description="Dataset for mimic4 Phenotype task",
42
  mimic_path = None
43
  ),
44
  Mimic4DatasetConfig(
45
  name="Readmission",
46
  version=VERSION,
47
+ config_path = './config/readmission.config'
48
  description="Dataset for mimic4 Readmission task",
49
  mimic_path = None
50
  ),
51
  Mimic4DatasetConfig(
52
  name="Length of Stay",
53
  version=VERSION,
54
+ config_path = './config/los.config'
55
  description="Dataset for mimic4 Length of Stay task",
56
  mimic_path = None
57
  ),
58
  Mimic4DatasetConfig(
59
  name="Mortality",
60
  version=VERSION,
61
+ config_path = './config/mortality.config'
62
  description="Dataset for mimic4 Mortality task",
63
  mimic_path = None
64
  ),
 
131
  repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
132
  data_dir = path_bench + "/data/dataDic"
133
  if not os.path.exists(path_bench):
134
+ subprocess.run(["git", "clone", repo_url, path_bench])
135
+ task_cohort(self.task,self.mimic_path, path_bench, self.config_path)
 
136
  return [
137
  datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir, "benchmark": path_bench}),
138
  ]
139
 
140
 
141
  def _generate_examples(self, filepath,benchmark):
 
142
  with open(filepath, 'rb') as fp:
143
  dataDic = pickle.load(fp)
144
  for hid, data in dataDic.items():