diff --git a/mimic-iv/tests/conftest.py b/mimic-iv/tests/conftest.py index 192a003e6..2d0cefefe 100644 --- a/mimic-iv/tests/conftest.py +++ b/mimic-iv/tests/conftest.py @@ -1,5 +1,6 @@ import os from collections import namedtuple +from pathlib import Path import pytest from google.cloud import bigquery @@ -33,3 +34,25 @@ def project_id(): Return the name of the BigQuery project used. """ return 'physionet-data' + +@pytest.fixture(scope="session") +def concept_folders(): + """ + Returns the folders containing concepts. + """ + return ['comorbidity', 'demographics', 'measurement', 'medication', 'organfailure', 'treatment', 'score', 'sepsis', 'firstday'] + +@pytest.fixture(scope="session") +def concepts(concept_folders): + """ + Returns all concepts which should be generated. + """ + concepts = {} + current_dir = Path(__file__).parent + concept_dir = current_dir / '../concepts' + for folder in concept_folders: + files = os.listdir(concept_dir / folder) + # add list of the concepts in this folder to the dict + concepts[folder] = [f[:-4] for f in files if f.endswith('.sql')] + + return concepts