Skip to content

Commit

Permalink
add fixtures for concept folders/tables
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairewj committed Dec 15, 2021
1 parent 1faef34 commit f6f4ebe
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mimic-iv/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from collections import namedtuple
from pathlib import Path

import pytest
from google.cloud import bigquery
Expand Down Expand Up @@ -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

0 comments on commit f6f4ebe

Please sign in to comment.