Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/scripts/check_sql_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"""Validate that every BigQuery concept SQL file parses with sqlglot.

Usage: ``python .github/scripts/check_sql_syntax.py [ROOT ...]``
(defaults to ``mimic-iv/concepts``). Exits non-zero if any file fails to parse.
(defaults to ``mimic-iv/concepts`` and ``mimic-iii/concepts``).
Exits non-zero if any file fails to parse.
"""
from __future__ import annotations

Expand All @@ -14,7 +15,10 @@


def main(argv: list[str]) -> int:
roots = [Path(p) for p in argv[1:]] or [Path("mimic-iv/concepts")]
roots = [Path(p) for p in argv[1:]] or [
Path("mimic-iv/concepts"),
Path("mimic-iii/concepts"),
]
files = sorted({f for root in roots for f in root.rglob("*.sql")})
if not files:
print(f"::error::No .sql files found under: {', '.join(map(str, roots))}")
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/sql_syntax_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
paths:
- 'mimic-iv/concepts/**'
- 'mimic-iii/concepts/**'
- 'src/mimic_utils/**'
- '.github/scripts/check_sql_syntax.py'
- '.github/workflows/sql_syntax_check.yml'
Expand All @@ -24,4 +25,4 @@ jobs:
- name: Install package
run: pip install -e . --no-deps
- name: Parse concept SQL with sqlglot
run: python .github/scripts/check_sql_syntax.py mimic-iv/concepts
run: python .github/scripts/check_sql_syntax.py mimic-iv/concepts mimic-iii/concepts
2 changes: 1 addition & 1 deletion mimic-iv/tests/test_measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_common_bg_exist(dataset, project_id):


def test_gcs_score_calculated_correctly(dataset, project_id):
"""Verifies common blood gases occur > 50% of the time"""
"""Verifies GCS verbal imputation and carry-forward logic."""
# has verbal prev of 1 -> 11365767, 30015010, 2154-07-25T20:00:00
# has verbal prev of 0 -> 13182319, 30159144, 2161-06-19T00:16:00
query = f"""
Expand Down