From eb7569448657de066bcee5035aaac6190969d14f Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Mon, 16 Mar 2026 15:53:12 -0700 Subject: [PATCH] Fix zenodo_isamples_analysis: alias columns to match Jan 2026 wide parquet The page queries used old column names (sample_location_latitude, source_collection) but the Jan 2026 wide parquet has different names (latitude, longitude, n). Added column aliases in the view creation so all downstream queries work without rewriting. Material category analysis section will show empty since the wide format stores these as integer arrays (p__has_material_category) rather than string values. Co-Authored-By: Claude Opus 4.6 (1M context) --- tutorials/zenodo_isamples_analysis.qmd | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tutorials/zenodo_isamples_analysis.qmd b/tutorials/zenodo_isamples_analysis.qmd index 97b0e56..2f8939c 100644 --- a/tutorials/zenodo_isamples_analysis.qmd +++ b/tutorials/zenodo_isamples_analysis.qmd @@ -169,9 +169,16 @@ db = { if (working_parquet_url) { try { - // Try to create view of the remote parquet file - await conn.query(`CREATE VIEW isamples_data AS SELECT * FROM read_parquet('${working_parquet_url}')`); - + // Create view with aliased column names to match downstream queries. + // The Jan 2026 wide parquet uses different names than the original schema. + await conn.query(`CREATE VIEW isamples_data AS SELECT *, + latitude AS sample_location_latitude, + longitude AS sample_location_longitude, + n AS source_collection, + pid AS sample_identifier, + CAST(NULL AS VARCHAR) AS has_material_category + FROM read_parquet('${working_parquet_url}')`); + // Test the connection with a simple query to catch rate limiting await conn.query(`SELECT count(*) FROM isamples_data LIMIT 1`); console.log("✅ Successfully connected to remote Parquet file");