@@ -250,7 +250,128 @@ ${JSON.stringify(selectedGeoRecord, null, 2)}
250250`
251251```
252252
253+ ## Table Structure Analysis
253254
255+ Understanding the structure and schema of the parquet file:
256+
257+ ### Column Schema
258+
259+ ``` {ojs}
260+ //| code-fold: true
261+ tableSchema = {
262+ const query = `DESCRIBE nodes`;
263+ const data = await loadData(query, [], "loading_schema");
264+ return data;
265+ }
266+ ```
267+
268+ <div id =" loading_schema " >Loading table schema...</div >
269+
270+ ``` {ojs}
271+ //| code-fold: true
272+ viewof schemaTable = {
273+ const data_table = Inputs.table(tableSchema, {
274+ header: {
275+ column_name: "Column Name",
276+ column_type: "Data Type",
277+ null: "Nullable",
278+ key: "Key",
279+ default: "Default",
280+ extra: "Extra"
281+ }
282+ });
283+ return data_table;
284+ }
285+ ```
286+
287+ ### Sample Data
288+
289+ First 10 rows of the dataset to understand the data structure:
290+
291+ ``` {ojs}
292+ //| code-fold: true
293+ sampleData = {
294+ const query = `SELECT * FROM nodes LIMIT 10`;
295+ const data = await loadData(query, [], "loading_sample");
296+ return data;
297+ }
298+ ```
299+
300+ <div id =" loading_sample " >Loading sample data...</div >
301+
302+ ``` {ojs}
303+ //| code-fold: true
304+ viewof sampleTable = {
305+ const data_table = Inputs.table(sampleData, {
306+ layout: "auto",
307+ width: {
308+ pid: 200,
309+ otype: 150
310+ }
311+ });
312+ return data_table;
313+ }
314+ ```
315+
316+ ### Sample Data by Object Type
317+
318+ Examples of records for each object type to understand the data semantics:
319+
320+ ``` {ojs}
321+ //| code-fold: true
322+ sampleDataByOtype = {
323+ // First get the list of unique object types
324+ const otypeQuery = `SELECT DISTINCT otype FROM nodes ORDER BY otype`;
325+ const otypes = await loadData(otypeQuery, [], "loading_otype_samples");
326+
327+ const results = [];
328+ for (const otypeRow of otypes) {
329+ const otype = otypeRow.otype;
330+ // Get 3 sample records for each otype
331+ const sampleQuery = `SELECT * FROM nodes WHERE otype = ? LIMIT 3`;
332+ const samples = await db.query(sampleQuery, [otype]);
333+
334+ results.push({
335+ otype: otype,
336+ count: samples.length,
337+ samples: samples
338+ });
339+ }
340+ return results;
341+ }
342+ ```
343+
344+ <div id =" loading_otype_samples " >Loading sample data by object type...</div >
345+
346+ ``` {ojs}
347+ //| code-fold: true
348+ viewof otypeSamplesDisplay = {
349+ const container = html`<div></div>`;
350+
351+ for (const otypeData of sampleDataByOtype) {
352+ const section = html`<div style="margin-bottom: 2rem;">
353+ <h4 style="color: #2563eb; margin-bottom: 0.5rem;">Object Type: ${otypeData.otype}</h4>
354+ <p style="margin: 0.5rem 0; font-style: italic;">Sample records (showing up to 3):</p>
355+ </div>`;
356+
357+ // Create a table for this otype's samples
358+ const table = Inputs.table(otypeData.samples, {
359+ layout: "auto",
360+ width: {
361+ pid: 150,
362+ otype: 120,
363+ latitude: 100,
364+ longitude: 100
365+ }
366+ });
367+
368+ section.appendChild(table);
369+ container.appendChild(section);
370+ }
371+
372+ return container;
373+ }
374+ ```
254375
255376## Object Type Counts
256377
0 commit comments