From fe666fcd620a99da31118f11977f4102caf43898 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Thu, 20 Mar 2025 17:28:41 -0700 Subject: [PATCH 1/9] Addresses #13 --> first pass at a duckdb query in the parquet tutorial page --- _quarto.yml | 4 +++ tutorials/index.qmd | 6 ++++ tutorials/parquet.qmd | 64 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 tutorials/index.qmd create mode 100644 tutorials/parquet.qmd diff --git a/_quarto.yml b/_quarto.yml index 541a540..b640997 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -38,6 +38,10 @@ website: - icon: github text: Github href: "https://github.com/isamplesorg/" + - section: "Tutorials" + contents: + - tutorials/index.qmd + - tutorials/parquet.md # configure for correct source repository diff --git a/tutorials/index.qmd b/tutorials/index.qmd new file mode 100644 index 0000000..6314067 --- /dev/null +++ b/tutorials/index.qmd @@ -0,0 +1,6 @@ +--- +title: "Tutorials" +--- + +Here's where we park Tutorials + diff --git a/tutorials/parquet.qmd b/tutorials/parquet.qmd new file mode 100644 index 0000000..08780d3 --- /dev/null +++ b/tutorials/parquet.qmd @@ -0,0 +1,64 @@ +--- +title: "parquet" +--- + +Let's query Eric's parquet file using duckdb+parquet + + +simpler query: + +```{ojs} +//| echo: true + +// Import Observable's libraries +import {DuckDBClient} from "@observablehq/duckdb" + +// Create a DuckDB instance +db = DuckDBClient.of() + +// Set the Parquet file path +parquet_path = 'https://storage.googleapis.com/opencontext-parquet/oc_isamples_pqg.parquet' + +// For testing, use a smaller dataset or limit rows +// Option 1: Use LIMIT to reduce data transferred +viewof testResults = { + // Show loading indicator + const loadingElement = html`
Running query...
`; + document.body.appendChild(loadingElement); + + try { + // Test with a small LIMIT to verify connection works + const data = await db.query(` + SELECT otype, pid + FROM read_parquet('${parquet_path}') + LIMIT 10 + `); + return Inputs.table(data); + } finally { + // Remove loading indicator when done (whether success or error) + loadingElement.remove(); + } +} + +``` + +now the full query + + +```{ojs} +//| echo: true + + +// Query the Parquet file +viewof results = Inputs.table( + await db.query(` + SELECT COUNT(pid) as count, otype + FROM read_parquet('${parquet_path}') + GROUP BY otype + ORDER BY count DESC + `) +) +``` + + + From b7cde3659afd001951afa1006acdaed31cf44d56 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Fri, 21 Mar 2025 08:34:25 -0700 Subject: [PATCH 2/9] testing -- trying to get a test workflow in --- .github/workflows/hello-world.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/hello-world.yml diff --git a/.github/workflows/hello-world.yml b/.github/workflows/hello-world.yml new file mode 100644 index 0000000..eb5319c --- /dev/null +++ b/.github/workflows/hello-world.yml @@ -0,0 +1,14 @@ +name: Hello World Workflow + +on: workflow_dispatch + +jobs: + say-hello: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Say Hello + run: echo "Hello, World!" \ No newline at end of file From cbddf621f3c55e23811af773073018e540bc78d9 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Fri, 21 Mar 2025 08:42:40 -0700 Subject: [PATCH 3/9] try to make hello-world workflow more discoverable --- .github/workflows/hello-world.yml | 59 +++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/.github/workflows/hello-world.yml b/.github/workflows/hello-world.yml index eb5319c..258f58c 100644 --- a/.github/workflows/hello-world.yml +++ b/.github/workflows/hello-world.yml @@ -1,6 +1,22 @@ name: Hello World Workflow -on: workflow_dispatch +# Enable multiple trigger types +on: + # Manual trigger (keep existing functionality) + workflow_dispatch: + + # Automatically run when changes are pushed to any branch + push: + branches: + - '**' # Run on all branches + + # Automatically run when pull requests are created or updated + pull_request: + types: [opened, synchronize, reopened] + + # Run on a schedule (e.g., once a day) + schedule: + - cron: '0 0 * * *' # Runs at midnight UTC every day jobs: say-hello: @@ -8,7 +24,44 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Updated to v3 - name: Say Hello - run: echo "Hello, World!" \ No newline at end of file + run: | + echo "Hello, World!" + echo "Running on branch: ${{ github.ref_name }}" + echo "Triggered by: ${{ github.event_name }}" + echo "Repository: ${{ github.repository }}"name: Hello World Workflow + +# Enable multiple trigger types +on: + # Manual trigger (keep existing functionality) + workflow_dispatch: + + # Automatically run when changes are pushed to any branch + push: + branches: + - '**' # Run on all branches + + # Automatically run when pull requests are created or updated + pull_request: + types: [opened, synchronize, reopened] + + # Run on a schedule (e.g., once a day) + schedule: + - cron: '0 0 * * *' # Runs at midnight UTC every day + +jobs: + say-hello: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 # Updated to v3 + + - name: Say Hello + run: | + echo "Hello, World!" + echo "Running on branch: ${{ github.ref_name }}" + echo "Triggered by: ${{ github.event_name }}" + echo "Repository: ${{ github.repository }}" \ No newline at end of file From 00d316ff54043e2939d370dcf2b2d878c3172cac Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Fri, 21 Mar 2025 08:44:36 -0700 Subject: [PATCH 4/9] try again with hello-world.yml --- .github/workflows/hello-world.yml | 62 ++++--------------------------- 1 file changed, 8 insertions(+), 54 deletions(-) diff --git a/.github/workflows/hello-world.yml b/.github/workflows/hello-world.yml index 258f58c..4a09b2c 100644 --- a/.github/workflows/hello-world.yml +++ b/.github/workflows/hello-world.yml @@ -1,67 +1,21 @@ name: Hello World Workflow -# Enable multiple trigger types on: - # Manual trigger (keep existing functionality) workflow_dispatch: - - # Automatically run when changes are pushed to any branch push: branches: - - '**' # Run on all branches - - # Automatically run when pull requests are created or updated + - '**' pull_request: types: [opened, synchronize, reopened] - - # Run on a schedule (e.g., once a day) - schedule: - - cron: '0 0 * * *' # Runs at midnight UTC every day jobs: say-hello: runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 # Updated to v3 - - - name: Say Hello - run: | - echo "Hello, World!" - echo "Running on branch: ${{ github.ref_name }}" - echo "Triggered by: ${{ github.event_name }}" - echo "Repository: ${{ github.repository }}"name: Hello World Workflow - -# Enable multiple trigger types -on: - # Manual trigger (keep existing functionality) - workflow_dispatch: - - # Automatically run when changes are pushed to any branch - push: - branches: - - '**' # Run on all branches - - # Automatically run when pull requests are created or updated - pull_request: - types: [opened, synchronize, reopened] - - # Run on a schedule (e.g., once a day) - schedule: - - cron: '0 0 * * *' # Runs at midnight UTC every day - -jobs: - say-hello: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 # Updated to v3 - - - name: Say Hello - run: | - echo "Hello, World!" - echo "Running on branch: ${{ github.ref_name }}" - echo "Triggered by: ${{ github.event_name }}" - echo "Repository: ${{ github.repository }}" \ No newline at end of file + - name: Checkout code + uses: actions/checkout@v3 + - name: Say Hello + run: | + echo "Hello, World!" + echo "Running on branch: ${{ github.ref_name }}" + echo "Triggered by: ${{ github.event_name }}" \ No newline at end of file From 02a2ebccc3b7fe5d94d6c591a12d212d2e221105 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Fri, 21 Mar 2025 09:12:09 -0700 Subject: [PATCH 5/9] stick in a comment into hello-world.yml to try to trigger a change that will make this workflow show up for manual invocation --- .github/workflows/hello-world.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/hello-world.yml b/.github/workflows/hello-world.yml index 4a09b2c..ab6ef76 100644 --- a/.github/workflows/hello-world.yml +++ b/.github/workflows/hello-world.yml @@ -1,3 +1,4 @@ +# hello world workflow for GitHub Actions name: Hello World Workflow on: From d94f4f7424622936a1fac3a8727d27f66c6caa5a Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Fri, 21 Mar 2025 09:20:26 -0700 Subject: [PATCH 6/9] shifting to just manual workflow dispatch --- .github/workflows/hello-world.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/hello-world.yml b/.github/workflows/hello-world.yml index ab6ef76..ef52353 100644 --- a/.github/workflows/hello-world.yml +++ b/.github/workflows/hello-world.yml @@ -1,13 +1,7 @@ -# hello world workflow for GitHub Actions name: Hello World Workflow on: workflow_dispatch: - push: - branches: - - '**' - pull_request: - types: [opened, synchronize, reopened] jobs: say-hello: @@ -16,7 +10,4 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - name: Say Hello - run: | - echo "Hello, World!" - echo "Running on branch: ${{ github.ref_name }}" - echo "Triggered by: ${{ github.event_name }}" \ No newline at end of file + run: echo "Hello, World!" \ No newline at end of file From 2358377480fbc87b05a8f87753229a0a0df8ad31 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Fri, 21 Mar 2025 09:23:10 -0700 Subject: [PATCH 7/9] go back to running hello world on repo changes --- .github/workflows/hello-world.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hello-world.yml b/.github/workflows/hello-world.yml index ef52353..4a09b2c 100644 --- a/.github/workflows/hello-world.yml +++ b/.github/workflows/hello-world.yml @@ -2,6 +2,11 @@ name: Hello World Workflow on: workflow_dispatch: + push: + branches: + - '**' + pull_request: + types: [opened, synchronize, reopened] jobs: say-hello: @@ -10,4 +15,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - name: Say Hello - run: echo "Hello, World!" \ No newline at end of file + run: | + echo "Hello, World!" + echo "Running on branch: ${{ github.ref_name }}" + echo "Triggered by: ${{ github.event_name }}" \ No newline at end of file From b437641b4100b25638332564227f8190660c2b40 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Fri, 21 Mar 2025 14:53:14 -0700 Subject: [PATCH 8/9] this should get the sidebar working --- _quarto.yml | 7 +++++-- tutorials/index.qmd | 4 ++-- tutorials/parquet.qmd | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/_quarto.yml b/_quarto.yml index b640997..fa0601c 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -40,8 +40,11 @@ website: href: "https://github.com/isamplesorg/" - section: "Tutorials" contents: - - tutorials/index.qmd - - tutorials/parquet.md + - text: "iSamples Tutorials Overview" + href: tutorials/index.qmd + - text: "iSamples Parquet Tutorial" + href: tutorials/parquet.qmd + # configure for correct source repository diff --git a/tutorials/index.qmd b/tutorials/index.qmd index 6314067..db12bd7 100644 --- a/tutorials/index.qmd +++ b/tutorials/index.qmd @@ -1,6 +1,6 @@ --- -title: "Tutorials" +title: "Tutorials: Overview" --- -Here's where we park Tutorials +Here's where we park our various tutorials! diff --git a/tutorials/parquet.qmd b/tutorials/parquet.qmd index 08780d3..c16b20c 100644 --- a/tutorials/parquet.qmd +++ b/tutorials/parquet.qmd @@ -1,5 +1,5 @@ --- -title: "parquet" +title: "Parquet" --- Let's query Eric's parquet file using duckdb+parquet From e75e42cf78f21a754eea8bc65cfde08bc3a5e1ca Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Fri, 4 Apr 2025 05:50:17 -0700 Subject: [PATCH 9/9] add a simple demo of how to talk to the iSamples API --- tutorials/index.qmd | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tutorials/index.qmd b/tutorials/index.qmd index db12bd7..241abf2 100644 --- a/tutorials/index.qmd +++ b/tutorials/index.qmd @@ -4,3 +4,64 @@ title: "Tutorials: Overview" Here's where we park our various tutorials! +Get the OpenAPI spec. + +```{ojs} +//| echo: true + +// Get the OpenAPI specification and display detailed endpoint information +viewof apiEndpointDetails = { + // Show loading indicator + const loadingElement = html`
Loading API endpoints...
`; + document.body.appendChild(loadingElement); + + try { + const OPENAPI_URL = 'https://central.isample.xyz/isamples_central/openapi.json'; + + // Fetch the OpenAPI spec + const response = await fetch(OPENAPI_URL); + if (!response.ok) throw new Error(`Failed to fetch API spec: ${response.status}`); + + const apiSpec = await response.json(); + + // Extract detailed information about each endpoint + const endpointDetails = []; + + for (const [path, pathMethods] of Object.entries(apiSpec.paths)) { + for (const [method, details] of Object.entries(pathMethods)) { + endpointDetails.push({ + endpoint: path, + method: method.toUpperCase(), + summary: details.summary || '', + operationId: details.operationId || '', + tags: (details.tags || []).join(', '), + parameters: (details.parameters || []) + .map(p => `${p.name} (${p.required ? 'required' : 'optional'})`) + .join(', ') + }); + } + } + + // Create a table with the detailed endpoint information + return Inputs.table( + endpointDetails, + { + label: "iSamples API Endpoints Details", + width: { + endpoint: 150, + method: 80, + summary: 200, + operationId: 200, + tags: 100, + parameters: 300 + } + } + ); + } catch (error) { + return html`
Error fetching API endpoints: ${error.message}
`; + } finally { + // Remove loading indicator + loadingElement.remove(); + } +} +``` \ No newline at end of file