Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +5 -3
Mimic4Dataset.py
CHANGED
@@ -9,6 +9,7 @@ from urllib.request import urlretrieve
|
|
9 |
from sklearn.model_selection import train_test_split
|
10 |
from sklearn.preprocessing import LabelEncoder
|
11 |
import yaml
|
|
|
12 |
import numpy as np
|
13 |
from .dataset_utils import vocab, concat_data, generate_deep, generate_ml, generate_text
|
14 |
from .task_cohort import create_cohort
|
@@ -113,13 +114,12 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
113 |
mimic_complete_path='/'+mimic_folder+'/'+version
|
114 |
|
115 |
current_directory = os.getcwd()
|
116 |
-
if os.path.exists(os.path.dirname(current_directory)+'/MIMIC-IV-Data-Pipeline
|
117 |
dir =os.path.dirname(current_directory)
|
118 |
os.chdir(dir)
|
119 |
else:
|
120 |
#move to parent directory of mimic data
|
121 |
dir = self.mimic_path.replace(mimic_complete_path,'')
|
122 |
-
print('dir : ',dir)
|
123 |
if dir[-1]!='/':
|
124 |
dir=dir+'/'
|
125 |
elif dir=='':
|
@@ -131,7 +131,9 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
131 |
repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
|
132 |
path_bench = './MIMIC-IV-Data-Pipeline'
|
133 |
if not os.path.exists(path_bench):
|
134 |
-
subprocess.run(["git", "clone", repo_url, path_bench],shell = True,capture_output=True)
|
|
|
|
|
135 |
os.makedirs(path_bench+'/'+'mimic-iv')
|
136 |
shutil.move(version,path_bench+'/'+'mimic-iv')
|
137 |
|
|
|
9 |
from sklearn.model_selection import train_test_split
|
10 |
from sklearn.preprocessing import LabelEncoder
|
11 |
import yaml
|
12 |
+
from git import Repo
|
13 |
import numpy as np
|
14 |
from .dataset_utils import vocab, concat_data, generate_deep, generate_ml, generate_text
|
15 |
from .task_cohort import create_cohort
|
|
|
114 |
mimic_complete_path='/'+mimic_folder+'/'+version
|
115 |
|
116 |
current_directory = os.getcwd()
|
117 |
+
if os.path.exists(os.path.dirname(current_directory)+'/MIMIC-IV-Data-Pipeline'):
|
118 |
dir =os.path.dirname(current_directory)
|
119 |
os.chdir(dir)
|
120 |
else:
|
121 |
#move to parent directory of mimic data
|
122 |
dir = self.mimic_path.replace(mimic_complete_path,'')
|
|
|
123 |
if dir[-1]!='/':
|
124 |
dir=dir+'/'
|
125 |
elif dir=='':
|
|
|
131 |
repo_url='https://github.com/healthylaife/MIMIC-IV-Data-Pipeline'
|
132 |
path_bench = './MIMIC-IV-Data-Pipeline'
|
133 |
if not os.path.exists(path_bench):
|
134 |
+
# subprocess.run(["git", "clone", repo_url, path_bench],shell = True,capture_output=True)
|
135 |
+
|
136 |
+
Repo.clone_from(repo_url, path_bench)
|
137 |
os.makedirs(path_bench+'/'+'mimic-iv')
|
138 |
shutil.move(version,path_bench+'/'+'mimic-iv')
|
139 |
|