|
1 | 1 | name: "Transpile BigQuery concepts" |
2 | 2 | description: >- |
3 | 3 | Regenerates the concepts for a SQL dialect from the BigQuery sources, writing |
4 | | - over the committed mimic-iv/concepts_<dialect> folder. Downstream steps then |
5 | | - build/test against the freshly transpiled SQL rather than what is committed. |
6 | | - Requires mimic_utils to be installed (pip install -e .). This action does not |
7 | | - report drift; use the check-concepts-up-to-date action for that. |
| 4 | + over the committed concepts_<dialect> folder of the given project. Downstream |
| 5 | + steps then build/test against the freshly transpiled SQL rather than what is |
| 6 | + committed. Requires mimic_utils to be installed (pip install -e .). This |
| 7 | + action does not report drift; use the check-concepts-up-to-date action for |
| 8 | + that. |
8 | 9 |
|
9 | 10 | inputs: |
10 | 11 | dialect: |
11 | 12 | description: "Destination SQL dialect (postgres or duckdb)." |
12 | 13 | required: true |
| 14 | + project: |
| 15 | + description: "Project whose concepts are transpiled (mimic-iii or mimic-iv)." |
| 16 | + required: false |
| 17 | + default: "mimic-iv" |
13 | 18 |
|
14 | 19 | runs: |
15 | 20 | using: "composite" |
16 | 21 | steps: |
17 | | - - name: Transpile ${{ inputs.dialect }} concepts |
| 22 | + - name: Transpile ${{ inputs.project }} ${{ inputs.dialect }} concepts |
18 | 23 | shell: bash |
19 | 24 | run: | |
20 | | - mimic_utils convert_folder mimic-iv/concepts \ |
21 | | - "mimic-iv/concepts_${{ inputs.dialect }}" \ |
22 | | - --destination_dialect "${{ inputs.dialect }}" |
| 25 | + set -euo pipefail |
| 26 | + case "${{ inputs.project }}" in |
| 27 | + mimic-iv) |
| 28 | + mimic_utils convert_folder mimic-iv/concepts \ |
| 29 | + "mimic-iv/concepts_${{ inputs.dialect }}" \ |
| 30 | + --destination_dialect "${{ inputs.dialect }}" |
| 31 | + ;; |
| 32 | + mimic-iii) |
| 33 | + # pivot/pivoted_oasis.sql is excluded: it has never been runnable |
| 34 | + # on any engine (undefined aliases/columns and a missing CTE). |
| 35 | + mimic_utils convert_folder mimic-iii/concepts \ |
| 36 | + "mimic-iii/concepts_${{ inputs.dialect }}" \ |
| 37 | + --destination_dialect "${{ inputs.dialect }}" \ |
| 38 | + --derived_schema mimiciii_derived \ |
| 39 | + --schema_map mimiciii_clinical=mimiciii,mimiciii_notes=mimiciii \ |
| 40 | + --exclude cookbook other-languages functions pivot/pivoted_oasis.sql |
| 41 | + ;; |
| 42 | + *) |
| 43 | + echo "Unknown project: ${{ inputs.project }}" >&2 |
| 44 | + exit 1 |
| 45 | + ;; |
| 46 | + esac |
0 commit comments