From 44c8e4f63afce219ca7411e7fd163b0d02656308 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 11:25:59 -0400 Subject: [PATCH 01/16] Add test comment to quarto-publish.yml to see if it fails the build-deploy step --- .github/workflows/quarto-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 8786b33..16d97ec 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -5,6 +5,7 @@ on: name: Render and Publish # Permissions required to publish to GitHub Pages +# Test to ensure the build-deploy job fails permissions: contents: write pages: write From 82ae379a1c84881c805effdbc8a4a7e33296d0a3 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 11:44:28 -0400 Subject: [PATCH 02/16] Enable GitHub Actions checks for pull requests --- .github/workflows/quarto-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 16d97ec..1854c49 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -1,6 +1,8 @@ on: push: branches: main + pull_request: + branches: main name: Render and Publish From 540c2f59492e4d5bb0de40ee888a1c1d8198bd5f Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 13:11:07 -0400 Subject: [PATCH 03/16] Move R_LIBS_USER to the job level and comment it out from the install step --- .github/workflows/quarto-publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 1854c49..5978225 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -15,6 +15,7 @@ permissions: jobs: build-deploy: runs-on: ubuntu-latest + env: R_LIBS_USER: ${{ github.workspace }}/R/library steps: - name: Check out repository uses: actions/checkout@v4 @@ -34,8 +35,8 @@ jobs: ${{ runner.os }}-R- - name: Install R Packages - env: - R_LIBS_USER: ${{ github.workspace }}/R/library + #env: + # R_LIBS_USER: ${{ github.workspace }}/R/library run: | mkdir -p $R_LIBS_USER Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' From faf87f78be89d46d604de73d02d7e7ec2a442cc9 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 13:16:39 -0400 Subject: [PATCH 04/16] Fix syntax error with for env nesting --- .github/workflows/quarto-publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 5978225..52c3a88 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -15,7 +15,8 @@ permissions: jobs: build-deploy: runs-on: ubuntu-latest - env: R_LIBS_USER: ${{ github.workspace }}/R/library + env: + R_LIBS_USER: ${{ github.workspace }}/R/library steps: - name: Check out repository uses: actions/checkout@v4 From 619a62514d3b053c22121fae628bb65365caa1e6 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 14:16:29 -0400 Subject: [PATCH 05/16] Install missing system dependencies --- .github/workflows/quarto-publish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 52c3a88..cd27712 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -35,6 +35,11 @@ jobs: restore-keys: | ${{ runner.os }}-R- + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev libuv1-dev + - name: Install R Packages #env: # R_LIBS_USER: ${{ github.workspace }}/R/library From 90aad65891b218b8b9b8256089e9428b50b2d274 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 14:47:42 -0400 Subject: [PATCH 06/16] Add bigrquery to install --- .github/workflows/quarto-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index cd27712..95a4cd9 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -45,7 +45,7 @@ jobs: # R_LIBS_USER: ${{ github.workspace }}/R/library run: | mkdir -p $R_LIBS_USER - Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' + Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly", "bigrquery"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' - name: Verify R Packages Installation run: | From 8617038af9f8ea1b6cd9432757b51d0d2b09e3d8 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 15:07:25 -0400 Subject: [PATCH 07/16] Install additional missing R packages --- .github/workflows/quarto-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 95a4cd9..bec4cfb 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -45,7 +45,7 @@ jobs: # R_LIBS_USER: ${{ github.workspace }}/R/library run: | mkdir -p $R_LIBS_USER - Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly", "bigrquery"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' + Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly", "bigrquery", "DBI", "dbplyr", "glue"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' - name: Verify R Packages Installation run: | From 49592abc5afed9925cfcbe93a576e22f3c96ea82 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 16:06:34 -0400 Subject: [PATCH 08/16] Set info_schema_tutorial.qmd code chunks to not run --- tutorials/info_schema_tutorial.qmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tutorials/info_schema_tutorial.qmd b/tutorials/info_schema_tutorial.qmd index 4b77ac2..01ce39c 100644 --- a/tutorials/info_schema_tutorial.qmd +++ b/tutorials/info_schema_tutorial.qmd @@ -2,6 +2,8 @@ title: "Tutorial: Querying BigQuery Information Schema" author: "Jake Peters" date: 2025-01-22 +execute: + eval: false --- ## Introduction From 302149cfef880fa310e849a36609cd0ca4ba0399 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 16:11:36 -0400 Subject: [PATCH 09/16] Remove packages that were needed for code chunks that should not be run --- .github/workflows/quarto-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index bec4cfb..cd27712 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -45,7 +45,7 @@ jobs: # R_LIBS_USER: ${{ github.workspace }}/R/library run: | mkdir -p $R_LIBS_USER - Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly", "bigrquery", "DBI", "dbplyr", "glue"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' + Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' - name: Verify R Packages Installation run: | From 335c6eef3bfa75e8b212d348423d4d00ef3dda39 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 17:16:32 -0400 Subject: [PATCH 10/16] Removed eval: false from the header and changed {r}/{sql} chunksyntax to plain code fences so nothing executes during render --- tutorials/info_schema_tutorial.qmd | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tutorials/info_schema_tutorial.qmd b/tutorials/info_schema_tutorial.qmd index 01ce39c..5f7c3d5 100644 --- a/tutorials/info_schema_tutorial.qmd +++ b/tutorials/info_schema_tutorial.qmd @@ -2,8 +2,6 @@ title: "Tutorial: Querying BigQuery Information Schema" author: "Jake Peters" date: 2025-01-22 -execute: - eval: false --- ## Introduction @@ -27,7 +25,7 @@ The Quarto document begins with a header that includes essential metadata (title Next, the following R code chunk loads the necessary libraries and suppresses the output for a clean setup: -```{r, warning=FALSE, message=FALSE} +```r, warning=FALSE, message=FALSE library(bigrquery) library(dplyr) library(DBI) @@ -42,7 +40,7 @@ bigrquery::bq_auth() Here, we specify the dataset and project, authenticate with BigQuery, and open a connection. Finally, we list the tables in the dataset to confirm that the connection is working: -```{r} +```r # Specify dataset and project details dataset <- "FlatConnect" project <- "nih-nci-dceg-connect-dev" @@ -61,7 +59,7 @@ DBI::dbListTables(con) The next code block runs a SQL query on the `INFORMATION_SCHEMA.COLUMNS` to locate columns that contain specific Concept IDs. This query filters columns based on a pattern present in their names: -```{sql, connection=con} +```sql, connection=con SELECT table_catalog, table_schema, @@ -76,7 +74,7 @@ WHERE column_name To make the querying process more flexible, we define an R function named `get_schema_info`. This function accepts a vector of Concept IDs and a tier (development, staging, or production), constructs the appropriate SQL query dynamically, and returns the result: -```{r} +```r get_schema_info <- function(con, cids, tier, dataset = 'FlatConnect') { # Determine the project based on the tier From 4491c8f95f013aceed799192ab5d2dfb06395861 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 17:29:57 -0400 Subject: [PATCH 11/16] Strip remaining chunk options from info_schema_tutorial.qmd fences, so they render as inert code blocks instead of executing and failing on missing packages --- tutorials/info_schema_tutorial.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/info_schema_tutorial.qmd b/tutorials/info_schema_tutorial.qmd index 5f7c3d5..ee79c4c 100644 --- a/tutorials/info_schema_tutorial.qmd +++ b/tutorials/info_schema_tutorial.qmd @@ -25,7 +25,7 @@ The Quarto document begins with a header that includes essential metadata (title Next, the following R code chunk loads the necessary libraries and suppresses the output for a clean setup: -```r, warning=FALSE, message=FALSE +```r library(bigrquery) library(dplyr) library(DBI) @@ -59,7 +59,7 @@ DBI::dbListTables(con) The next code block runs a SQL query on the `INFORMATION_SCHEMA.COLUMNS` to locate columns that contain specific Concept IDs. This query filters columns based on a pattern present in their names: -```sql, connection=con +```sql SELECT table_catalog, table_schema, From e2e3c3178a273ed36c127b670dfb9549239993f8 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Mon, 20 Jul 2026 17:44:11 -0400 Subject: [PATCH 12/16] Remove duplicate info_schema_tutorial.qmd at repo root; canonical copy lives in tutorials/ --- info_schema_tutorial.qmd | 113 --------------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 info_schema_tutorial.qmd diff --git a/info_schema_tutorial.qmd b/info_schema_tutorial.qmd deleted file mode 100644 index 028c422..0000000 --- a/info_schema_tutorial.qmd +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: "Querying BigQuery Information Schema" -author: "Jake Peters" -date: 2025-01-22 ---- - -## Introduction - -In this tutorial, we demonstrate how to use a Quarto document to query BigQuery's information schema and identify where specific Concept IDs are located in your database. By integrating R and SQL, you learn how to authenticate with BigQuery, execute custom queries, and dynamically construct search queries based on user-specified Concept IDs. - -## Prerequisites -- Before following this tutorial, ensure you have: R installed on your system. -- The following R packages installed: `bigrquery`, `dplyr`, `DBI`, `dbplyr`, and `glue`. -- Access to a BigQuery project and dataset with appropriate permissions to query the `INFORMATION_SCHEMA`. - -## Table of Contents: -1. **Setup and Authentication:** Load libraries, configure authentication, and establish a connection to BigQuery. -2. **Executing a Basic SQL Query:** Query the BigQuery `INFORMATION_SCHEMA.COLUMNS` to retrieve metadata that matches a specific pattern. -3. **Building a Dynamic Query Function:** Create an R function to dynamically generate SQL queries to search for Concept IDs. -4. **Putting It All Together:** Run the function and review the results. - -## Step 1: Setup and Authentication - -The Quarto document begins with a header that includes essential metadata (title, author, and date). The first code chunk loads the required libraries and prepares the environment. - -Next, the following R code chunk loads the necessary libraries and suppresses the output for a clean setup: - -```{r, warning=FALSE, message=FALSE} -library(bigrquery) -library(dplyr) -library(DBI) -library(dbplyr) -library(glue) - -# Authenticate with BigQuery -bigrquery::bq_auth() -``` - -## Step 2: Establishing the Database Connection - -Here, we specify the dataset and project, authenticate with BigQuery, and open a connection. Finally, we list the tables in the dataset to confirm that the connection is working: - -```{r} -# Specify dataset and project details -dataset <- "FlatConnect" -project <- "nih-nci-dceg-connect-dev" - -# Establish connection to BigQuery -con <- DBI::dbConnect(bigrquery::bigquery(), - project = project, - dataset = dataset, - billing = project) - -# List available tables to verify the connection -DBI::dbListTables(con) -``` - -## Step 3: Querying the Information Schema - -The next code block runs a SQL query on the `INFORMATION_SCHEMA.COLUMNS` to locate columns that contain specific Concept IDs. This query filters columns based on a pattern present in their names: - -```{sql, connection=con} -SELECT - table_catalog, - table_schema, - table_name, - column_name -FROM FlatConnect.INFORMATION_SCHEMA.COLUMNS -WHERE column_name - LIKE '%158409298%261863326%'; -``` - -## Step 4: Building a Dynamic Query Function - -To make the querying process more flexible, we define an R function named `get_schema_info`. This function accepts a vector of Concept IDs and a tier (development, staging, or production), constructs the appropriate SQL query dynamically, and returns the result: - -```{r} -get_schema_info <- function(con, cids, tier, dataset = 'FlatConnect') { - - # Determine the project based on the tier - project <- switch(tier, - dev = "nih-nci-dceg-connect-dev", - stg = "nih-nci-dceg-connect-stg-5519", - prod = "nih-nci-dceg-connect-prod-6d04") - - # Collapse the Concept IDs into a single string with "%" delimiters (e.g., "%cid1%cid2%cid3%") - cid_str <- paste0("%", paste(cids, collapse = "%"), "%") - print(glue("cid_str: {cid_str}\n\n")) - - # Construct the SQL query dynamically - sql <- glue::glue("SELECT table_catalog, table_schema, table_name, column_name - FROM `{project}.{dataset}`.INFORMATION_SCHEMA.COLUMNS - WHERE column_name LIKE '{cid_str}'") - print(glue("SQL Query: \n{sql}\n\n")) - - # Execute the query and store the result - result <- DBI::dbGetQuery(con, sql) - - return(result) -} - -# Execute the function with a vector of Concept IDs and store the output in df -df <- get_schema_info(con, c('158409298', '261863326'), tier='dev') - -# Display the query results -df -``` - -## Conclusion - -This tutorial has shown you how to query BigQuery's `INFORMATION_SCHEMA` to find the locations of specific Concept IDs within your database. By combining R scripting and SQL queries within a Quarto document, you can automate schema exploration and streamline the process of database management and analysis. - -Feel free to modify the query function or extend this approach for different types of metadata searches. Happy querying! From e8e31097b9128f305876afeae06aaaef3e89b464 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Tue, 21 Jul 2026 09:18:07 -0400 Subject: [PATCH 13/16] Remove test comment. Place the env back at the lower level under 'Install R Packages' step --- .github/workflows/quarto-publish.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index cd27712..07c7d22 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -7,7 +7,6 @@ on: name: Render and Publish # Permissions required to publish to GitHub Pages -# Test to ensure the build-deploy job fails permissions: contents: write pages: write @@ -15,8 +14,6 @@ permissions: jobs: build-deploy: runs-on: ubuntu-latest - env: - R_LIBS_USER: ${{ github.workspace }}/R/library steps: - name: Check out repository uses: actions/checkout@v4 @@ -41,8 +38,8 @@ jobs: sudo apt-get install -y libcurl4-openssl-dev libuv1-dev - name: Install R Packages - #env: - # R_LIBS_USER: ${{ github.workspace }}/R/library + env: + R_LIBS_USER: ${{ github.workspace }}/R/library run: | mkdir -p $R_LIBS_USER Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' From 1eeb48fde805d90fd66344145ff3f3c22e2c1647 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Tue, 21 Jul 2026 09:57:25 -0400 Subject: [PATCH 14/16] Add in a debug step --- .github/workflows/quarto-publish.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 07c7d22..13413f5 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -44,6 +44,12 @@ jobs: mkdir -p $R_LIBS_USER Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' + - name: Debug library path + run: | + echo "Shell R_LIBS_USER=$R_LIBS_USER" + Rscript -e 'cat("R_LIBS_USER:", Sys.getenv("R_LIBS_USER"), "\n")' + Rscript -e 'print(.libPaths())' + - name: Verify R Packages Installation run: | Rscript -e "library(knitr, lib.loc = Sys.getenv('R_LIBS_USER'))" From f4bf9dcf1381b79b5283bba9beb31e41c6e9af80 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Tue, 21 Jul 2026 10:16:59 -0400 Subject: [PATCH 15/16] Set the env block at the job level --- .github/workflows/quarto-publish.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 13413f5..e3cee5d 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -14,6 +14,8 @@ permissions: jobs: build-deploy: runs-on: ubuntu-latest + env: + R_LIBS_USER: ${{ github.workspace }}/R/library steps: - name: Check out repository uses: actions/checkout@v4 @@ -38,18 +40,10 @@ jobs: sudo apt-get install -y libcurl4-openssl-dev libuv1-dev - name: Install R Packages - env: - R_LIBS_USER: ${{ github.workspace }}/R/library run: | mkdir -p $R_LIBS_USER Rscript -e 'install.packages(c("knitr", "rmarkdown", "ggplot", "palmerpenguins", "plotly"), repos = "https://cloud.r-project.org/", lib = Sys.getenv("R_LIBS_USER"))' - - name: Debug library path - run: | - echo "Shell R_LIBS_USER=$R_LIBS_USER" - Rscript -e 'cat("R_LIBS_USER:", Sys.getenv("R_LIBS_USER"), "\n")' - Rscript -e 'print(.libPaths())' - - name: Verify R Packages Installation run: | Rscript -e "library(knitr, lib.loc = Sys.getenv('R_LIBS_USER'))" From 5fa1801e95217acb17757f0be25c6866ccfd03f9 Mon Sep 17 00:00:00 2001 From: gloria-trivitt Date: Tue, 21 Jul 2026 10:36:09 -0400 Subject: [PATCH 16/16] Only publish to GitHub Pages on push to main, skip publish during PR checks --- .github/workflows/quarto-publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index e3cee5d..068dfb2 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -1,8 +1,6 @@ on: push: branches: main - pull_request: - branches: main name: Render and Publish