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 10
10
jobs :
11
11
create-tables :
12
12
runs-on : ubuntu-latest
13
+ permissions :
14
+ contents : ' read'
15
+ id-token : ' write'
13
16
steps :
14
17
- name : Check out repository code
15
18
uses : actions/checkout@v3
16
19
17
20
- id : ' auth'
18
- uses : ' google-github-actions/auth@v0 '
21
+ uses : ' google-github-actions/auth@v2 '
19
22
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 '
22
25
23
26
- 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
+
26
31
- name : Run make_concepts
27
32
run : |
28
33
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 1
1
#! /bin/bash
2
2
# This script generates the concepts in the BigQuery table mimiciv_derived.
3
3
export TARGET_DATASET=mimiciv_derived
4
+ export METADATA_TABLE=" _metadata"
5
+ export MIMIC_VERSION=" 3.1"
4
6
5
7
# specify bigquery query command options
6
8
# note: max_rows=1 *displays* only one row, but all rows are inserted into the destination table
17
19
bq rm -f -q ${TARGET_DATASET} .${TABLE}
18
20
done
19
21
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
+
20
42
# generate a few tables first as the desired order isn't alphabetical
21
43
for table_path in demographics/icustay_times;
22
44
do
You can’t perform that action at this time.
0 commit comments