Compare commits

...

1 Commits

Author SHA1 Message Date
kelly
aac45fd64d feat: add inventory management Excel parser and data files
- Add Inventory_103025-Start.xlsx source file
- Add JSON schemas for lotted end products, lotted source, and unlotted inventory
- Add Node.js Excel reader script for processing inventory data
- Support for Bamboo inventory import and management
2025-11-01 16:38:08 -07:00
5 changed files with 20387 additions and 0 deletions

BIN
Inventory_103025-Start.xlsx Normal file

Binary file not shown.

5399
Lotted_End_Product.json Normal file

File diff suppressed because it is too large Load Diff

14867
Lotted_Source.json Normal file

File diff suppressed because it is too large Load Diff

13
Unlotted.json Normal file
View File

@@ -0,0 +1,13 @@
[
{
"Bamboo ID": "AZ0000156ESTDP70697204.INECXH",
"Strain": "Tropic Banana",
"State Catgory": "Harvest Materials - Flower",
"Room": "Freezer 1",
"Date Created": 45721.737280093,
"For Extraction": "No",
"Qty Available": 455,
"Qty Allocated": 0,
"Qty In Stock": 455
}
]

108
read_excel.js Normal file
View File

@@ -0,0 +1,108 @@
import XLSX from 'xlsx';
import fs from 'fs';
// Read the Excel file
const filePath = 'C:\\Users\\thisi\\Projects\\hub\\Inventory_103025-Start.xlsx';
console.log('Reading Excel file:', filePath);
try {
const workbook = XLSX.readFile(filePath);
console.log('\n========================================');
console.log('EXCEL FILE ANALYSIS');
console.log('========================================\n');
console.log('Total number of sheets:', workbook.SheetNames.length);
console.log('Sheet names:', workbook.SheetNames.join(', '));
console.log('\n========================================\n');
// Process each sheet
workbook.SheetNames.forEach((sheetName, index) => {
console.log(`\n${'='.repeat(80)}`);
console.log(`SHEET ${index + 1}: ${sheetName}`);
console.log('='.repeat(80));
const worksheet = workbook.Sheets[sheetName];
// Convert to JSON to get data
const jsonData = XLSX.utils.sheet_to_json(worksheet, { defval: '' });
console.log(`\nTotal rows (excluding header): ${jsonData.length}`);
if (jsonData.length > 0) {
// Get column headers
const headers = Object.keys(jsonData[0]);
console.log(`\nColumn count: ${headers.length}`);
console.log('\nColumn headers:');
headers.forEach((header, i) => {
console.log(` ${i + 1}. ${header}`);
});
// Show first 15 rows or all if less
const rowsToShow = Math.min(15, jsonData.length);
console.log(`\n${'─'.repeat(80)}`);
console.log(`First ${rowsToShow} rows of data:`);
console.log('─'.repeat(80));
for (let i = 0; i < rowsToShow; i++) {
console.log(`\nRow ${i + 1}:`);
const row = jsonData[i];
headers.forEach(header => {
const value = row[header];
const displayValue = value === '' ? '(empty)' : value;
console.log(` ${header}: ${displayValue}`);
});
}
// Analyze data types and patterns
console.log(`\n${'─'.repeat(80)}`);
console.log('Data type analysis:');
console.log('─'.repeat(80));
headers.forEach(header => {
const values = jsonData.map(row => row[header]).filter(v => v !== '');
const sample = values.slice(0, 5);
const uniqueCount = new Set(values).size;
const emptyCount = jsonData.length - values.length;
console.log(`\n${header}:`);
console.log(` Non-empty values: ${values.length}`);
console.log(` Empty values: ${emptyCount}`);
console.log(` Unique values: ${uniqueCount}`);
if (sample.length > 0) {
console.log(` Sample values: ${sample.slice(0, 3).join(', ')}`);
// Try to determine data type
const firstValue = sample[0];
if (typeof firstValue === 'number') {
console.log(` Type: Number`);
const nums = values.filter(v => typeof v === 'number');
if (nums.length > 0) {
const min = Math.min(...nums);
const max = Math.max(...nums);
console.log(` Range: ${min} to ${max}`);
}
} else if (typeof firstValue === 'string') {
console.log(` Type: String`);
const lengths = values.map(v => String(v).length);
const avgLength = lengths.reduce((a, b) => a + b, 0) / lengths.length;
console.log(` Average length: ${avgLength.toFixed(1)} characters`);
}
}
});
} else {
console.log('\n(Sheet is empty or has no data rows)');
}
console.log('\n' + '='.repeat(80));
});
console.log('\n\nAnalysis complete!');
} catch (error) {
console.error('Error reading Excel file:', error.message);
process.exit(1);
}