/** * Build a publishable open-science skeleton for FitLine research data. * Sources: website catalogs + STEP5 web reports (no secrets / no DB IDs). * * Usage (from repo root or this folder): * node open_science_repo_fitline/scripts/build_open_science_repo.mjs */ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const REPO = path.resolve(__dirname, '..'); const FITLINE = path.resolve(REPO, '..'); const WEBSITE = path.join(FITLINE, 'website'); const PIPELINE = path.join(FITLINE, 'pipeline_output_fitline'); function ensureDir(p) { fs.mkdirSync(p, { recursive: true }); } function bytesHuman(n) { if (n < 1024) return `${n} B`; if (n < 1024 ** 2) return `${(n / 1024).toFixed(1)} KB`; if (n < 1024 ** 3) return `${(n / 1024 ** 2).toFixed(2)} MB`; return `${(n / 1024 ** 3).toFixed(2)} GB`; } function walkFiles(dir, pred) { const out = []; if (!fs.existsSync(dir)) return out; for (const name of fs.readdirSync(dir)) { const full = path.join(dir, name); const st = fs.statSync(full); if (st.isDirectory()) out.push(...walkFiles(full, pred)); else if (!pred || pred(full, name)) out.push(full); } return out; } function csvEscape(v) { const s = v == null ? '' : String(v); if (/[",\n\r]/.test(s)) return `"${s.replace(/"/g, '""')}"`; return s; } function writeCsv(file, headers, rows) { const lines = [headers.join(',')]; for (const row of rows) { lines.push(headers.map((h) => csvEscape(row[h])).join(',')); } fs.writeFileSync(file, lines.join('\n') + '\n', 'utf8'); } function sanitizePublicUrl(url) { if (!url || typeof url !== 'string') return null; const u = url.trim(); // Drop session / api2 internal notes that are not stable public pages. if (/api2\//i.test(u) || /rendered session/i.test(u)) return null; if (!/^https?:\/\//i.test(u)) return null; return u; } function slimPrices(priceArr) { if (!Array.isArray(priceArr)) return []; return priceArr .filter( (p) => p && p.converted === false && typeof p.price === 'number' && p.currency && p.market && String(p.status || '').includes('verified') ) .map((p) => ({ market: String(p.market), currency: String(p.currency), amount: p.price, display: p.display || `${p.currency} ${p.price}`, storefront: p.storefront || null, source_url: sanitizePublicUrl(p.source_url), status: p.status || 'verified_public_listing', converted: false, })); } function slimSkuItem(it, layer) { const line = it.category?.line_group || it.line_group || (layer === 'C_merch' ? 'merch' : null); return { official_sku_code: it.official_sku_code || null, sku_id: it.sku_id || null, title: it.title || it.locale_title?.en || null, title_i18n: { en: it.locale_title?.en || it.title || null, 'zh-CN': it.locale_title?.['zh-CN'] || null, 'zh-TW': it.locale_title?.['zh-TW'] || null, de: it.locale_title?.de || null, ja: it.locale_title?.ja || null, es: it.locale_title?.es || null, fr: it.locale_title?.fr || null, ko: it.locale_title?.ko || null, }, layer, detail_level: it.detail_level || null, line_group: line, category_code: it.category?.code || null, category_label_zh: it.category?.label_zh || null, availability: it.availability || null, native_prices: slimPrices(it.price), public_source_url: sanitizePublicUrl(it.source_url), }; } // --- load sources --- const mainPath = path.join(WEBSITE, 'src/data/fitline/catalog_main_ab.json'); const merchPath = path.join(WEBSITE, 'src/data/fitline/catalog_merch_c.json'); const step5CatalogPath = path.join( WEBSITE, 'public/data/step5_web_reports/catalog.json' ); const step5Dir = path.join(WEBSITE, 'public/data/step5_web_reports'); const openPkgRoot = path.join(PIPELINE, 'step5_open_science_packages'); if (!fs.existsSync(mainPath) || !fs.existsSync(step5CatalogPath)) { console.error('Missing source catalogs. Expected website data under', WEBSITE); process.exit(1); } const main = JSON.parse(fs.readFileSync(mainPath, 'utf8')); const merch = fs.existsSync(merchPath) ? JSON.parse(fs.readFileSync(merchPath, 'utf8')) : { items: [], total: 0 }; const step5Cat = JSON.parse(fs.readFileSync(step5CatalogPath, 'utf8')); const slimMain = (main.items || []).map((it) => slimSkuItem(it, 'A+B_main')); const slimMerch = (merch.items || []).map((it) => slimSkuItem(it, 'C_merch')); const step5Reports = (step5Cat.reports || []).map((r) => ({ id: r.id, slug: r.slug, report_id: r.reportId, market_code: r.marketCode, country_name: r.countryName, country_name_zh: r.countryNameZh, sku_code: r.skuCode, sample_size: r.sampleSize, overall_composite_mean: r.compositeMean, overall_top2_box_pct: r.top2BoxPct, languages: r.languages || [], line_scope: r.lineScope, title_en: r.titles?.en || null, title_zh_CN: r.titles?.['zh-CN'] || null, title_zh_TW: r.titles?.['zh-TW'] || null, title_de: r.titles?.de || null, abstract_en: r.summaries?.en || null, })); const step5JsonFiles = walkFiles(step5Dir, (_f, name) => name.endsWith('.json') && name !== 'catalog.json' && name !== 'reports_master_index.json' ); // Open-science study packages inventory (filenames only; do not copy bulky binaries by default) let packageCount = 0; const packageIndex = []; if (fs.existsSync(openPkgRoot)) { for (const wave of fs.readdirSync(openPkgRoot)) { const waveDir = path.join(openPkgRoot, wave); if (!fs.statSync(waveDir).isDirectory()) continue; for (const study of fs.readdirSync(waveDir)) { const studyDir = path.join(waveDir, study); if (!fs.statSync(studyDir).isDirectory()) continue; packageCount += 1; const files = fs.readdirSync(studyDir); packageIndex.push({ wave, study_slug: study, has_readme: files.includes('README.md'), has_report_json: files.some((f) => f.endsWith('_report.json')), has_quantitative_csv: files.some((f) => f.endsWith('_quantitative.csv')), has_corpus_jsonl: files.some((f) => f.endsWith('_corpus.jsonl')), has_paper_tex: files.some((f) => f.endsWith('_paper.tex')), has_paper_pdf: files.some((f) => f.endsWith('_paper.pdf')), }); } } } // --- write data/ --- const dataDir = path.join(REPO, 'data'); ensureDir(dataDir); ensureDir(path.join(REPO, 'papers')); ensureDir(path.join(REPO, 'papers', 'drafts')); const skuCatalogPath = path.join(dataDir, 'sku_catalog_slim.json'); const skuCatalogPayload = { generated_at: new Date().toISOString(), source: 'FitLine website catalog_main_ab + catalog_merch_c (sanitized public fields)', note: 'Native-currency prices only when status includes verified and converted=false. No FX conversion. Internal API/session URLs omitted.', totals: { main_ab: slimMain.length, merch_c: slimMerch.length, all: slimMain.length + slimMerch.length, }, items: [...slimMain, ...slimMerch], }; fs.writeFileSync(skuCatalogPath, JSON.stringify(skuCatalogPayload, null, 2)); writeCsv( path.join(dataDir, 'sku_catalog_slim.csv'), [ 'official_sku_code', 'sku_id', 'title', 'layer', 'detail_level', 'line_group', 'category_code', 'category_label_zh', 'availability', 'native_price_count', 'public_source_url', ], [...slimMain, ...slimMerch].map((it) => ({ ...it, native_price_count: it.native_prices.length, })) ); writeCsv( path.join(dataDir, 'sku_native_prices.csv'), [ 'official_sku_code', 'market', 'currency', 'amount', 'display', 'storefront', 'source_url', 'status', 'converted', ], [...slimMain, ...slimMerch].flatMap((it) => it.native_prices.map((p) => ({ official_sku_code: it.official_sku_code, ...p, })) ) ); const step5IndexPath = path.join(dataDir, 'step5_reports_index.json'); fs.writeFileSync( step5IndexPath, JSON.stringify( { generated_at: new Date().toISOString(), source: 'website/public/data/step5_web_reports/catalog.json', total_reports: step5Reports.length, markets: [...new Set(step5Reports.map((r) => r.market_code).filter(Boolean))], distinct_skus: [ ...new Set(step5Reports.map((r) => r.sku_code).filter(Boolean)), ].sort(), reports: step5Reports, }, null, 2 ) ); writeCsv( path.join(dataDir, 'step5_reports_index.csv'), [ 'slug', 'report_id', 'market_code', 'sku_code', 'sample_size', 'overall_composite_mean', 'overall_top2_box_pct', 'line_scope', 'title_en', ], step5Reports ); fs.writeFileSync( path.join(dataDir, 'step5_open_science_packages_index.json'), JSON.stringify( { generated_at: new Date().toISOString(), source: 'pipeline_output_fitline/step5_open_science_packages', note: 'Inventory only. Full package binaries remain in the pipeline workspace; this repo ships the index for transparency.', total_packages: packageCount, packages: packageIndex, }, null, 2 ) ); // Copy one representative quantitative CSV (aggregate metrics, N=200) as a public sample const sampleCsvCandidates = walkFiles(openPkgRoot, (_f, name) => name.endsWith('_n200_quantitative.csv') ).sort(); if (sampleCsvCandidates.length) { const sampleSrc = sampleCsvCandidates[0]; const sampleName = path.basename(sampleSrc); fs.copyFileSync(sampleSrc, path.join(dataDir, `sample_${sampleName}`)); } const dataFiles = fs.readdirSync(dataDir).filter((f) => f !== 'README.md'); let dataBytes = 0; for (const f of dataFiles) { dataBytes += fs.statSync(path.join(dataDir, f)).size; } const stats = { generated_at: new Date().toISOString(), portal: 'https://www.fitline.day', sku_main_ab: slimMain.length, sku_merch_c: slimMerch.length, sku_total: slimMain.length + slimMerch.length, native_price_rows: [...slimMain, ...slimMerch].reduce( (n, it) => n + it.native_prices.length, 0 ), step5_web_reports: step5Reports.length, step5_report_json_files_on_disk: step5JsonFiles.length, step5_distinct_skus: new Set( step5Reports.map((r) => r.sku_code).filter(Boolean) ).size, step5_markets: [ ...new Set(step5Reports.map((r) => r.market_code).filter(Boolean)), ], open_science_packages: packageCount, papers_in_this_repo: 1, // overview draft; package PDFs counted separately as upstream upstream_package_paper_pdf_flags: packageIndex.filter((p) => p.has_paper_pdf) .length, data_files: dataFiles.length, data_bytes: dataBytes, data_size_human: bytesHuman(dataBytes), }; fs.writeFileSync( path.join(dataDir, 'dataset_stats.json'), JSON.stringify(stats, null, 2) ); // data/README.md fs.writeFileSync( path.join(dataDir, 'README.md'), `# FitLine Open Data — \`data/\` Generated: \`${stats.generated_at}\` ## Capacity snapshot | Metric | Value | |---|---| | SKU (A+B main catalog) | ${stats.sku_main_ab} | | SKU (C merch / card_only) | ${stats.sku_merch_c} | | SKU total (exported) | ${stats.sku_total} | | Native-currency price rows (verified, no FX) | ${stats.native_price_rows} | | STEP5 web reports (index) | ${stats.step5_web_reports} | | STEP5 distinct SKUs | ${stats.step5_distinct_skus} | | STEP5 markets | ${stats.step5_markets.join(', ') || '—'} | | Upstream open-science packages (indexed) | ${stats.open_science_packages} | | Files in this folder | ${stats.data_files} | | Folder size | ${stats.data_size_human} | ## Files | File | Format | Purpose | |---|---|---| | \`sku_catalog_slim.json\` / \`.csv\` | JSON / CSV | Sanitized SKU catalog (A/B/C layers), titles, line groups | | \`sku_native_prices.csv\` | CSV | Per-market **native** list prices only (\`converted=false\`) | | \`step5_reports_index.json\` / \`.csv\` | JSON / CSV | STEP5 field-study report index (slug, SKU, N, means) | | \`step5_open_science_packages_index.json\` | JSON | Inventory of upstream study packages | | \`sample_*_n200_quantitative.csv\` | CSV | One representative N=200 quantitative extract (if available) | | \`dataset_stats.json\` | JSON | Machine-readable capacity stats | ## Field notes / honesty rules - Missing INCI, nutrition, medical claims, or unverified prices are **omitted**, not invented. - Prices keep original ISO currency codes; **no FX conversion**. - Internal API / session URLs are stripped from \`source_url\`. - This folder does **not** include raw respondent PII or database identifiers. ## Citation (DOI placeholder) > **DOI:** _pending — fill after Zenodo / Hugging Face / Kaggle / GitHub DOI minting_ Suggested citation string (update DOI later): \`FitLine Open Science Contributors. (${new Date().getUTCFullYear()}). FitLine open catalog & STEP5 field-study index (Version 0.1.0) [Data set]. DOI: TBD\` ` ); // papers fs.writeFileSync( path.join(REPO, 'papers', 'README.md'), `# Papers / research notes ## Count in this repository | Item | Count | Notes | |---|---|---| | Draft overview whitepaper | **1** | \`00_fitline_open_science_overview.md\` | | Peer-reviewed PDFs shipped here | **0** | Not bundled in this slim public repo | | Upstream STEP5 open-science packages with \`*_paper.pdf\` flag | **${stats.upstream_package_paper_pdf_flags}** | Lived under \`pipeline_output_fitline/step5_open_science_packages/\` (not copied wholesale) | | STEP5 web report abstracts (indexed in data/) | **${stats.step5_web_reports}** | See \`../data/step5_reports_index.csv\` | ## Directory layout - \`00_fitline_open_science_overview.md\` — citable methods / scope note (draft) - \`drafts/\` — reserved for camera-ready TeX/PDF before DOI deposit Do not invent clinical efficacy claims. Field-study metrics are observational aggregates only. ` ); fs.writeFileSync( path.join(REPO, 'papers', '00_fitline_open_science_overview.md'), `--- title: "FitLine Open Science Overview — Catalog Boundaries & STEP5 Field-Study Index" version: "0.1.0-draft" license: "CC-BY-4.0" languages: [en, zh-CN, zh-TW, de] status: draft doi: TBD --- # FitLine Open Science Overview (Draft) ## English This note documents the **public, sanitized** FitLine open-data slice intended for GitHub / Hugging Face / Kaggle deposit. **Scope (as of generation):** - **${stats.sku_total}** SKU catalog rows (A+B main + C merch), with **${stats.native_price_rows}** verified native-currency price rows (no FX). - **${stats.step5_web_reports}** STEP5 web-report index entries covering **${stats.step5_distinct_skus}** SKUs and market(s): **${stats.step5_markets.join(', ') || 'n/a'}**. - **${stats.open_science_packages}** upstream open-science study packages inventoried (binaries remain in the pipeline workspace). **Portal:** [https://www.fitline.day](https://www.fitline.day) **Non-claims:** This draft is **not** a medical paper, **not** an official PM-International regulatory filing, and does **not** invent undisclosed prices or efficacy statements. ## 简体中文 本文档说明面向 GitHub / Hugging Face / Kaggle 发布的 FitLine **公开脱敏**数据切片。 当前规模:SKU **${stats.sku_total}**;原币种已核实价格行 **${stats.native_price_rows}**(无汇率换算);STEP5 报告索引 **${stats.step5_web_reports}**;上游开源研究包索引 **${stats.open_science_packages}**。官网:[https://www.fitline.day](https://www.fitline.day)。不编造未披露价格或医疗疗效。 ## 繁體中文 本文檔說明面向開源平台發布的 FitLine **公開脫敏**資料切片。當前規模見英文節;原幣種價格不做匯率換算;缺失欄位保持空缺。官網:[https://www.fitline.day](https://www.fitline.day)。 ## Deutsch Dieser Entwurf beschreibt den **öffentlichen, bereinigten** FitLine-Open-Data-Ausschnitt für GitHub / Hugging Face / Kaggle. Aktuell: **${stats.sku_total}** SKU-Zeilen, **${stats.native_price_rows}** verifizierte Preise in Originalwährung (ohne FX), **${stats.step5_web_reports}** STEP5-Berichtsindex-Einträge. Portal: [https://www.fitline.day](https://www.fitline.day). Keine erfundenen Preise oder medizinischen Wirkversprechen. ## Citation \`FitLine Open Science Contributors. (${new Date().getUTCFullYear()}). FitLine Open Science Overview (0.1.0-draft). DOI: TBD\` ` ); // LICENSE CC-BY-4.0 fs.writeFileSync( path.join(REPO, 'LICENSE'), `Creative Commons Attribution 4.0 International Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors: wiki.creativecommons.org/Considerations_for_licensors Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason—for example, because of any applicable exception or limitation to copyright—then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public: wiki.creativecommons.org/Considerations_for_licensees ======================================================================= Creative Commons Attribution 4.0 International Public License By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 — Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. h. Licensor means the individual(s) or entity(ies) granting rights under this Public License. i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 — Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: A. reproduce and Share the Licensed Material, in whole or in part; and B. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section 6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 5. Downstream recipients. A. Offer from the Licensor — Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). b. Other rights. 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 2. Patent and trademark rights are not licensed under this Public License. 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. Section 3 — License Conditions. Your exercise of the Licensed Rights is expressly made subject to the following conditions. a. Attribution. 1. If You Share the Licensed Material (including in modified form), You must: A. retain the following if it is supplied by the Licensor with the Licensed Material: i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); ii. a copyright notice; iii. a notice that refers to this Public License; iv. a notice that refers to the disclaimer of warranties; v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. Section 4 — Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 — Disclaimer of Warranties and Limitation of Liability. a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 — Term and Termination. a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 — Other Terms and Conditions. a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 — Interpretation. a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. ======================================================================= Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at creativecommons.org. ` ); // README.md with HF YAML header const readme = `--- pretty_name: FitLine Open Catalog & STEP5 Field-Study Index license: cc-by-4.0 language: - en - zh - de - ja - ko - es - fr tags: - fitline - skincare - nutrition - market-research - survey - open-science - multilingual task_categories: - tabular-classification - text-retrieval size_categories: - 1K **DOI:** \`TBD\` — fill after Zenodo / Hugging Face / Kaggle / GitHub minting. Public, **sanitized** FitLine research slice for open deposit. Native currencies only; no invented prices, FX, or medical claims. No API keys / database identifiers. ## Portal & links | Resource | URL | |---|---| | FitLine portal (official site for this project) | [https://www.fitline.day](https://www.fitline.day) | | Local interactive preview (this repo) | [\`index.html\`](./index.html) | | Dataset folder | [\`data/\`](./data/) | | Papers / notes | [\`papers/\`](./papers/) | | License | [\`LICENSE\`](./LICENSE) (CC BY 4.0) | > Brand commerce storefronts (e.g. regional \`fitline.com\` shops) may appear as **citation sources** inside price rows; this repository is an independent open-science index, not an official PM-International release channel. ## Capacity overview (auto-generated) | Metric | Value | |---|---| | Generated at (UTC) | ${stats.generated_at} | | SKU rows (A+B + C) | **${stats.sku_total}** (${stats.sku_main_ab} main + ${stats.sku_merch_c} merch) | | Native-currency verified price rows | **${stats.native_price_rows}** | | STEP5 report index rows | **${stats.step5_web_reports}** | | STEP5 distinct SKUs | **${stats.step5_distinct_skus}** | | STEP5 markets | **${stats.step5_markets.join(', ') || '—'}** | | Upstream open-science packages (indexed) | **${stats.open_science_packages}** | | Papers in this repo (draft overview) | **${stats.papers_in_this_repo}** | | Upstream packages flagged with paper PDF | **${stats.upstream_package_paper_pdf_flags}** | | \`data/\` files / size | **${stats.data_files}** / **${stats.data_size_human}** | Rebuild stats anytime: \`\`\`bash node open_science_repo_fitline/scripts/build_open_science_repo.mjs \`\`\` --- ## English ### What is included 1. **SKU catalog (slim)** — public titles, line groups, availability, and verified **native** prices. 2. **STEP5 field-study index** — multilingual report metadata + aggregate metrics (sample size, composite mean, top-2 box). 3. **Package inventory** — pointers to upstream study packages (CSV / JSON / paper flags) without shipping bulky binaries by default. 4. **Draft overview note** — \`papers/00_fitline_open_science_overview.md\`. ### Honesty / degradation rules - Unverified prices → omitted. - FX conversion → **never**. - Medical efficacy → **not claimed**. - Missing translations → left blank (no English spoofing as “local official”). ### Cite \`FitLine Open Science Contributors. (${new Date().getUTCFullYear()}). FitLine Open Catalog & STEP5 Field-Study Index (0.1). DOI: TBD\` --- ## 简体中文 本仓库是 FitLine 研究数据的**公开脱敏**切片,便于 GitHub / Hugging Face / Kaggle 发布并申请 DOI。 - 官网入口:[https://www.fitline.day](https://www.fitline.day) - 数据规模:SKU **${stats.sku_total}**;原币种核实价格行 **${stats.native_price_rows}**;STEP5 报告索引 **${stats.step5_web_reports}**;论文草稿 **${stats.papers_in_this_repo}**(上游 PDF 标记 **${stats.upstream_package_paper_pdf_flags}** 份,未整包拷贝)。 - 严禁脑补未核实价格、汇率换算或医疗疗效声明。 --- ## 繁體中文 本倉庫為 FitLine 研究資料的**公開脫敏**切片。官網:[https://www.fitline.day](https://www.fitline.day)。資料規模見上表;原幣種價格不做匯率換算;缺失欄位保持空缺。 --- ## Deutsch Dieses Repository enthält einen **öffentlichen, bereinigten** FitLine-Forschungsausschnitt zur Veröffentlichung auf GitHub / Hugging Face / Kaggle (DOI später eintragen). - Portal: [https://www.fitline.day](https://www.fitline.day) - Umfang: **${stats.sku_total}** SKUs, **${stats.native_price_rows}** Preise in Originalwährung, **${stats.step5_web_reports}** STEP5-Indexzeilen. - Keine erfundenen Preise, keine FX-Umrechnung, keine medizinischen Heilversprechen. --- ## Dataset files See [\`data/README.md\`](./data/README.md) for field dictionaries and per-file purpose. ## Papers See [\`papers/README.md\`](./papers/README.md). Camera-ready PDFs can be added under \`papers/drafts/\` before DOI deposit. ## Publish checklist 1. Review \`data/\` for accidental secrets. 2. Push to GitHub → optional Zenodo GitHub integration for DOI. 3. Create Hugging Face **Dataset** repo → paste this README (YAML header already HF-compatible). 4. Create Kaggle Dataset → upload \`data/\` + README; title ≤ 50 chars (suggestion below in \`PUBLISH.md\`). `; fs.writeFileSync(path.join(REPO, 'README.md'), readme); fs.writeFileSync( path.join(REPO, 'PUBLISH.md'), `# Publish guide — GitHub / Hugging Face / Kaggle (+ DOI) Generated alongside dataset stats: \`${stats.generated_at}\`. ## Suggested titles & tags | Platform | Title (≤ 50 chars for Kaggle) | Tags | |---|---|---| | GitHub | \`fitline-open-science\` | \`open-data\`, \`cc-by-4.0\`, \`fitline\`, \`survey\` | | Hugging Face | \`fitline-open-catalog-step5\` | \`tabular\`, \`multilingual\`, \`market-research\` | | Kaggle | \`FitLine STEP5 Open Catalog Index\` (39 chars) | \`business\`, \`healthcare\` (if allowed), \`survey\`, \`multilingual\`, \`open science\` | ## GitHub 1. Create empty public repo (e.g. \`fitline-open-science\`). 2. From \`open_science_repo_fitline/\`: \`\`\`bash git init git add . git commit -m "chore: initial FitLine open science data deposit v0.1" git branch -M main git remote add origin git push -u origin main \`\`\` 3. Enable **GitHub Pages** (deploy \`index.html\` from root) if desired. 4. **DOI via Zenodo**: Zenodo → GitHub → enable repo → Create release → Zenodo mints DOI → paste into README \`doi:\` field and re-release. ## Hugging Face Dataset 1. Create a Dataset repo at [https://huggingface.co/new-dataset](https://huggingface.co/new-dataset). 2. Upload \`README.md\` (YAML header is already HF-compatible), \`LICENSE\`, and \`data/\`. 3. Set license **CC-BY-4.0**. 4. Optional DOI: HF dataset settings / Zenodo mirror — then update \`doi: TBD\`. ## Kaggle Dataset 1. New Dataset → upload zip of \`data/\` + \`README.md\` + \`LICENSE\` + \`papers/\`. 2. Title: **\`FitLine STEP5 Open Catalog Index\`**. 3. Subtitle: sanitized SKU catalog + STEP5 field-study aggregates (native currency). 4. After publish, use Kaggle’s DOI / citation panel if available, or deposit the same zip to Zenodo for a DOI and cross-link. ## Honesty reminder Do not upload raw answer databases, API keys, \`.env\`, or internal pipeline paths that expose storage backends. ` ); // index.html — lightweight multilingual preview fs.writeFileSync( path.join(REPO, 'index.html'), ` FitLine Open Science — Catalog & STEP5 Index
FitLine Open Science

Open Catalog & STEP5 Field-Study Index

Sanitized public data slice for open deposit. Native currencies only — no FX, no invented medical claims.

Capacity snapshot

SKU rows${stats.sku_total}
Native price rows${stats.native_price_rows}
STEP5 reports${stats.step5_web_reports}
STEP5 SKUs / markets${stats.step5_distinct_skus} / ${stats.step5_markets.join(', ') || '—'}
Papers (in-repo draft)${stats.papers_in_this_repo}
data/ size${stats.data_size_human}
DOITBD

About

This static page mirrors the open deposit README. Use it on GitHub Pages or open locally. Full field notes live in data/README.md.

本页为开源仓库的轻量预览。官网入口 www.fitline.day。数据说明见 data/README.md;不编造价格或疗效。

本頁為開源倉庫的輕量預覽。官網 www.fitline.day。資料說明見 data/README.md;不編造價格或療效。

Leichte Vorschau des Open-Data-Repos. Portal: www.fitline.day. Details in data/README.md. Keine erfundenen Preise oder Heilversprechen.

License: CC BY 4.0 · Generated ${stats.generated_at}
` ); fs.writeFileSync( path.join(REPO, '.gitignore'), `# Keep the open deposit lean .DS_Store Thumbs.db *.env .env.* **/secrets/** ` ); console.log(JSON.stringify(stats, null, 2)); console.log('Wrote open science repo at', REPO);