Team Ai
Datasetpublic

funkikitech/MaxDecals-Knowledge-Base-Database

MaxDecals Knowledge Base Database An open, source-linked research dataset for printable media, printer workflows, and professional print-and-cut production. All-version DOI: 10.5281/zenodo.21445360 Version 0.2.0 DOI: 10.5281/zenodo.21878688 This repository is the public, machine-readable data mirror for the MaxDecals USA Knowledge Hub. It is designed for people, search engines, AI assistants, and data tools. Canonical knowledge hub The canonical human-readable… See the full description on the dataset page: https://huggingface.co/datasets/funkikitech/MaxDecals-Knowledge-Base-Database.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes90downloads
build-jsonl.mjs89 linesDownload Raw Back to scripts
1import fs from "node:fs";2import path from "node:path";3import crypto from "node:crypto";4import { fileURLToPath } from "node:url";5 6const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");7const dataDir = path.join(root, "data");8const files = [9  "printer_brand_research_matrix.csv",10  "competitor_product_research_matrix.csv",11  "source_library.csv"12];13 14function parseCsv(input) {15  const rows = [];16  let row = [];17  let field = "";18  let quoted = false;19 20  for (let i = 0; i < input.length; i += 1) {21    const char = input[i];22    const next = input[i + 1];23    if (quoted && char === '"' && next === '"') {24      field += '"';25      i += 1;26    } else if (char === '"') {27      quoted = !quoted;28    } else if (char === "," && !quoted) {29      row.push(field);30      field = "";31    } else if ((char === "\n" || char === "\r") && !quoted) {32      if (char === "\r" && next === "\n") i += 1;33      row.push(field);34      if (row.some((value) => value !== "")) rows.push(row);35      row = [];36      field = "";37    } else {38      field += char;39    }40  }41 42  if (field !== "" || row.length > 0) {43    row.push(field);44    rows.push(row);45  }46 47  const [headers, ...values] = rows;48  return values.map((cells, rowIndex) => {49    if (cells.length !== headers.length) {50      throw new Error(`Column mismatch on row ${rowIndex + 2}: expected ${headers.length}, received ${cells.length}`);51    }52    return Object.fromEntries(headers.map((header, index) => [header, cells[index]]));53  });54}55 56const manifest = {57  name: "MaxDecals Knowledge Base Database",58  version: "0.1.0",59  published: "2026-07-18",60  license: "CC-BY-4.0",61  publisher: "MaxDecals USA",62  canonical_url: "https://maxdecals.us/pages/knowledge-hub",63  repository: "https://github.com/funkiki-david/MaxDecals-Knowledge-Base-Database",64  dataset_mirror: "https://huggingface.co/datasets/funkikitech/MaxDecals-Knowledge-Base-Database",65  datasets: []66};67 68for (const file of files) {69  const csvPath = path.join(dataDir, file);70  const input = fs.readFileSync(csvPath, "utf8");71  const records = parseCsv(input);72  const jsonlName = file.replace(/\.csv$/, ".jsonl");73  const jsonlPath = path.join(dataDir, jsonlName);74  const jsonl = `${records.map((record) => JSON.stringify(record)).join("\n")}\n`;75  fs.writeFileSync(jsonlPath, jsonl, "utf8");76 77  manifest.datasets.push({78    name: file.replace(/\.csv$/, ""),79    csv: `data/${file}`,80    jsonl: `data/${jsonlName}`,81    rows: records.length,82    csv_sha256: crypto.createHash("sha256").update(input).digest("hex"),83    jsonl_sha256: crypto.createHash("sha256").update(jsonl).digest("hex")84  });85}86 87fs.writeFileSync(path.join(root, "dataset_manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`, "utf8");88console.log(JSON.stringify(manifest, null, 2));89