File tree Expand file tree Collapse file tree 2 files changed +47
-2
lines changed
Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ name: Generate tables on BigQuery
22
33on :
44 release :
5- types : [published]
5+ types : [released]
6+
7+ env :
8+ MIMIC_IV_VERSION : 3_1
69
710jobs :
811 create-tables :
2427 run : |
2528 echo "Generating tables on BigQuery"
2629 cd mimic-iv/concepts
27- bash make_concepts.sh
30+ bash make_concepts.sh
31+
32+ - name : Copy to release specific schema
33+ run : |
34+ echo "Copying tables to release specific schema: mimiciv_${MIMIC_IV_VERSION}_derived"
35+ bash mimic-iv/concepts/copy_concepts_to_versioned_schema.sh ${MIMIC_IV_VERSION}
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # This script copies the concepts in the BigQuery table mimiciv_derived to mimiciv_${VERSION}_derived.
3+ if [ -z " $$ 1" ]; then
4+ echo " Usage: $0 <version>"
5+ exit 1
6+ fi
7+ export SOURCE_DATASET=mimiciv_derived
8+ export TARGET_DATASET=mimiciv_$1 _derived
9+
10+ # check if the target dataset exists
11+ if bq ls | grep -q ${TARGET_DATASET} ; then
12+ echo " Using existing dataset ${TARGET_DATASET} ."
13+ # drop the existing tables in the target dataset
14+ # this includes ones which may not be in the source dataset
15+ for TABLE in ` bq ls physionet-data:${TARGET_DATASET} | cut -d' ' -f3` ;
16+ do
17+ # skip the first line of dashes
18+ if [[ " ${TABLE: 0: 2} " == ' --' ]]; then
19+ continue
20+ fi
21+ echo " Dropping table ${TARGET_DATASET} .${TABLE} "
22+ bq rm -f -q ${TARGET_DATASET} .${TABLE}
23+ done
24+ else
25+ echo " Creating dataset ${TARGET_DATASET} "
26+ bq mk --dataset ${TARGET_DATASET}
27+ fi
28+
29+ for TABLE in ` bq ls physionet-data:${SOURCE_DATASET} | cut -d' ' -f3` ;
30+ do
31+ # skip the first line of dashes
32+ if [[ " ${TABLE: 0: 2} " == ' --' ]]; then
33+ continue
34+ fi
35+ echo " ${SOURCE_DATASET} .${TABLE} -> ${TARGET_DATASET} .${TABLE} "
36+ bq cp -f -q ${SOURCE_DATASET} .${TABLE} ${TARGET_DATASET} .${TABLE}
37+ done
You can’t perform that action at this time.
0 commit comments