Skip to content
Merged
21 changes: 21 additions & 0 deletions .github/workflows/hello-world.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Hello World Workflow

on:
workflow_dispatch:
push:
branches:
- '**'
pull_request:
types: [opened, synchronize, reopened]

jobs:
say-hello:
runs-on: ubuntu-latest
steps:
- 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 }}"
7 changes: 7 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ website:
- icon: github
text: Github
href: "https://github.com/isamplesorg/"
- section: "Tutorials"
contents:
- text: "iSamples Tutorials Overview"
href: tutorials/index.qmd
- text: "iSamples Parquet Tutorial"
href: tutorials/parquet.qmd



# configure for correct source repository
Expand Down
67 changes: 67 additions & 0 deletions tutorials/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
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`<div>Loading API endpoints...</div>`;
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`<div style="color: red">Error fetching API endpoints: ${error.message}</div>`;
} finally {
// Remove loading indicator
loadingElement.remove();
}
}
```
64 changes: 64 additions & 0 deletions tutorials/parquet.qmd
Original file line number Diff line number Diff line change
@@ -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`<div>Running query...</div>`;
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
`)
)
```