diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f17aa428a..bf21c32e7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,19 +10,24 @@ env: jobs: create-tables: runs-on: ubuntu-latest + permissions: + contents: 'read' + id-token: 'write' steps: - name: Check out repository code uses: actions/checkout@v3 - id: 'auth' - uses: 'google-github-actions/auth@v0' + uses: 'google-github-actions/auth@v2' with: - project_id: ${{ secrets.GCP_PROJECT_ID }} - credentials_json: ${{ secrets.GCP_SA_KEY }} + service_account: 'mimic-code@physionet-data.iam.gserviceaccount.com' + workload_identity_provider: 'projects/569883598760/locations/global/workloadIdentityPools/github/providers/mimic-code' - name: 'Set up Cloud SDK' - uses: 'google-github-actions/setup-gcloud@v0' - + uses: 'google-github-actions/setup-gcloud@v2' + with: + version: '>= 363.0.0' + - name: Run make_concepts run: | echo "Generating tables on BigQuery" diff --git a/mimic-iv/buildmimic/bigquery/make_version.sh b/mimic-iv/buildmimic/bigquery/make_version.sh new file mode 100644 index 000000000..3883ed051 --- /dev/null +++ b/mimic-iv/buildmimic/bigquery/make_version.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# This script makes the _version table for each schema in BigQuery, +# Currently hard-coded to the status as of 2025-04-20. +export METADATA_TABLE="_metadata" + +# create an array of target datasets and versions +# loop through them at the same time +datasets=( + "mimiciv_icu:3.1" + "mimiciv_hosp:3.1" + "mimiciv_note:2.2" + "mimiciv_ed:2.2" +) + +for entry in "${datasets[@]}"; do + TARGET_DATASET="${entry%%:*}" + MIMIC_VERSION="${entry##*:}" + export TARGET_DATASET + export MIMIC_VERSION + + echo "Creating ${TARGET_DATASET}.${METADATA_TABLE} table" + bq query <