Skip to content

Commit 4b4a844

Browse files
committed
add test asserting all derived tables have rows
1 parent 6351e10 commit 4b4a844

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

mimic-iv/tests/test_all_tables.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pandas as pd
2+
from pandas.io import gbq
3+
4+
def test_tables_have_data(dataset, project_id, concepts):
5+
"""Verifies each table has data."""
6+
7+
for folder, concept_list in concepts.items():
8+
for concept_name in concept_list:
9+
query = f"""
10+
SELECT *
11+
FROM {dataset}.{concept_name}
12+
LIMIT 5
13+
"""
14+
df = gbq.read_gbq(query, project_id=project_id, dialect="standard")
15+
assert df.shape[0] > 0, f'did not find table for {folder}.{concept_name}'

0 commit comments

Comments
 (0)