Skip to content

Commit f6f4ebe

Browse files
committed
add fixtures for concept folders/tables
1 parent 1faef34 commit f6f4ebe

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mimic-iv/tests/conftest.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from collections import namedtuple
3+
from pathlib import Path
34

45
import pytest
56
from google.cloud import bigquery
@@ -33,3 +34,25 @@ def project_id():
3334
Return the name of the BigQuery project used.
3435
"""
3536
return 'physionet-data'
37+
38+
@pytest.fixture(scope="session")
39+
def concept_folders():
40+
"""
41+
Returns the folders containing concepts.
42+
"""
43+
return ['comorbidity', 'demographics', 'measurement', 'medication', 'organfailure', 'treatment', 'score', 'sepsis', 'firstday']
44+
45+
@pytest.fixture(scope="session")
46+
def concepts(concept_folders):
47+
"""
48+
Returns all concepts which should be generated.
49+
"""
50+
concepts = {}
51+
current_dir = Path(__file__).parent
52+
concept_dir = current_dir / '../concepts'
53+
for folder in concept_folders:
54+
files = os.listdir(concept_dir / folder)
55+
# add list of the concepts in this folder to the dict
56+
concepts[folder] = [f[:-4] for f in files if f.endswith('.sql')]
57+
58+
return concepts

0 commit comments

Comments
 (0)