File tree Expand file tree Collapse file tree 3 files changed +66
-5
lines changed Expand file tree Collapse file tree 3 files changed +66
-5
lines changed Original file line number Diff line number Diff line change 1010jobs :
1111 create-tables :
1212 runs-on : ubuntu-latest
13+ permissions :
14+ contents : ' read'
15+ id-token : ' write'
1316 steps :
1417 - name : Check out repository code
1518 uses : actions/checkout@v3
1619
1720 - id : ' auth'
18- uses : ' google-github-actions/auth@v0 '
21+ uses : ' google-github-actions/auth@v2 '
1922 with :
20- project_id : ${{ secrets.GCP_PROJECT_ID }}
21- credentials_json : ${{ secrets.GCP_SA_KEY }}
23+ service_account : ' [email protected] ' 24+ workload_identity_provider : ' projects/569883598760/locations/global/workloadIdentityPools/github/providers/mimic-code '
2225
2326 - name : ' Set up Cloud SDK'
24- uses : ' google-github-actions/setup-gcloud@v0'
25-
27+ uses : ' google-github-actions/setup-gcloud@v2'
28+ with :
29+ version : ' >= 363.0.0'
30+
2631 - name : Run make_concepts
2732 run : |
2833 echo "Generating tables on BigQuery"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # This script makes the _version table for each schema in BigQuery,
3+ # Currently hard-coded to the status as of 2025-04-20.
4+ export METADATA_TABLE=" _metadata"
5+
6+ # create an array of target datasets and versions
7+ # loop through them at the same time
8+ datasets=(
9+ " mimiciv_icu:3.1"
10+ " mimiciv_hosp:3.1"
11+ " mimiciv_note:2.2"
12+ " mimiciv_ed:2.2"
13+ )
14+
15+ for entry in " ${datasets[@]} " ; do
16+ TARGET_DATASET=" ${entry%%:* } "
17+ MIMIC_VERSION=" ${entry##*: } "
18+ export TARGET_DATASET
19+ export MIMIC_VERSION
20+
21+ echo " Creating ${TARGET_DATASET} .${METADATA_TABLE} table"
22+ bq query << EOF
23+ CREATE TABLE IF NOT EXISTS \` physionet-data.${TARGET_DATASET} .${METADATA_TABLE} \` (
24+ attribute STRING,
25+ value STRING
26+ );
27+
28+ TRUNCATE TABLE \` physionet-data.${TARGET_DATASET} .${METADATA_TABLE} \` ;
29+
30+ INSERT INTO \` physionet-data.${TARGET_DATASET} .${METADATA_TABLE} \` (attribute, value)
31+ VALUES
32+ ('mimic_version', '${MIMIC_VERSION} ');
33+ EOF
34+ done
Original file line number Diff line number Diff line change 11#! /bin/bash
22# This script generates the concepts in the BigQuery table mimiciv_derived.
33export TARGET_DATASET=mimiciv_derived
4+ export METADATA_TABLE=" _metadata"
5+ export MIMIC_VERSION=" 3.1"
46
57# specify bigquery query command options
68# note: max_rows=1 *displays* only one row, but all rows are inserted into the destination table
1719 bq rm -f -q ${TARGET_DATASET} .${TABLE}
1820done
1921
22+ # create a _version table to store the mimic-iv version, git commit hash, and latest git tag
23+ GIT_COMMIT_HASH=$( git rev-parse HEAD)
24+ LATEST_GIT_TAG=$( git describe --tags --abbrev=0)
25+
26+ echo " Creating ${TARGET_DATASET} .${METADATA_TABLE} table"
27+ bq query << EOF
28+ CREATE TABLE IF NOT EXISTS \` physionet-data.${TARGET_DATASET} .${METADATA_TABLE} \` (
29+ attribute STRING,
30+ value STRING
31+ );
32+
33+ TRUNCATE TABLE \` physionet-data.${TARGET_DATASET} .${METADATA_TABLE} \` ;
34+
35+ INSERT INTO \` physionet-data.${TARGET_DATASET} .${METADATA_TABLE} \` (attribute, value)
36+ VALUES
37+ ('mimic_version', '${MIMIC_VERSION} '),
38+ ('mimic_code_version', '${LATEST_GIT_TAG} '),
39+ ('mimic_code_commit_hash', '${GIT_COMMIT_HASH} ');
40+ EOF
41+
2042# generate a few tables first as the desired order isn't alphabetical
2143for table_path in demographics/icustay_times;
2244do
You can’t perform that action at this time.
0 commit comments