Skip to content

BE-797: Add S/M/L identifiers for scale factor - #161

Merged
thehabbos007 merged 4 commits into
mainfrom
asa/sap-mock-data-scale
Sep 4, 2026
Merged

BE-797: Add S/M/L identifiers for scale factor#161
thehabbos007 merged 4 commits into
mainfrom
asa/sap-mock-data-scale

Conversation

@thehabbos007

@thehabbos007 thehabbos007 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This PR adds S/M/L/XL scale identifiers for the scale factor that fits within these bounds

size products suppliers sites BOM depth raw materials customers orders
S 3 3-5 1-2 1 6-10 4-8 200-400
M 10-50 20-30 4-5 1 27-42 25-40 4000-6000
L 100-200 50-100 20-40 1 72-112 80-120 12000-20000
XL 400-800 150-300 100-120 1 180-280 250-400 40000-80000

@thehabbos007
thehabbos007 force-pushed the asa/sap-mock-data-scale branch from e55bbd4 to 0c1bb4b Compare September 1, 2026 16:11
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
petrinaut-hazel Ready Ready Preview Sep 2, 2026 2:45pm UTC

Request Review

@cursor

cursor Bot commented Sep 2, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches core generation parameters, plant topology, and demo scenarios; wrong sizing or hub validation could break downstream notebooks and scenario demos, though coverage is expanded in new tests.

Overview
Adds preset dataset sizes (S, M, L, XL) for scale_factor alongside numeric multipliers. Letter sizes seed-sampled counts for orders, customers, materials, vendors, and sites; explicit num_* flags and new CLI --vendors / --sites still override. The Databricks notebook parses scale_factor the same way.

Site scaling is the other major change: generation builds NUM_SITES plants from five fixed hubs plus synthesized locations (routes, ports, work centers, and logistics tables follow the active plant set). Demo scenario configs and catalog metadata are retargeted so demo runs work at small sizes.

Also tightens data quality: sales orders only use the India customer when present, vendor counts are parameterized, integrity checks cover more FKs, and tests document size bounds (M/L/XL gated behind env flags).

Reviewed by Cursor Bugbot for commit 2ddbfb1. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The CLI’s new --scale-factor parsing can now yield uncaught ValueError tracebacks for invalid inputs, regressing argparse-level validation and error UX.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds dataset size identifiers (S, M, L, XL) as an alternative to numeric scale_factor, mapping each size to seeded per-knob ranges so generated datasets fall within the documented size bounds.

Changes:

  • Introduces SIZE_KNOB_RANGES and updates GenerationConfig to accept scale_factor as either a positive number or a size identifier, sampling knob values deterministically per seed/size.
  • Adds vendor-count as a first-class knob (NUM_VENDORS) and wires it through generation (vendor masterdata + purchasing info records).
  • Updates CLI/README/tests and adjusts demo scenario configs/IDs to be compatible with small datasets.
File summaries
File Description
libs/sap-mock-data/tests/test_scale_sizes.py Adds unit tests validating size identifier normalization, knob sampling, and (optionally) generated dataset size bounds.
libs/sap-mock-data/src/sap_mock_data/generation/transactions.py Resets BATCH_COUNTER at generation start to keep batch IDs consistent per run.
libs/sap-mock-data/src/sap_mock_data/generation/masterdata.py Makes vendor count configurable via NUM_VENDORS, adjusts vendor categorization, and aligns supplier pools accordingly.
libs/sap-mock-data/src/sap_mock_data/generation/common.py Adds NUM_VENDORS to defaults and scaled knobs for numeric scaling.
libs/sap-mock-data/src/sap_mock_data/config.py Implements size identifiers, deterministic sampling per size/seed, adds num_vendors, and updates demo scenario configs.
libs/sap-mock-data/src/sap_mock_data/cli/main.py Extends CLI to accept size identifiers for --scale-factor and adds --vendors.
libs/sap-mock-data/README.md Documents size identifiers, expected bounds table, and knob override behavior.
libs/sap-mock-data/pipeline/Mock-up SAP ERP data - Masterdata.py Aligns TR lane ID generation with deterministic hex IDs (removes UUID usage).
libs/sap-mock-data/notebooks/databricks/Generate SAP Mock Data.py Allows Databricks widget scale_factor to be numeric or size identifier.
Review details

Suppressed comments (1)

libs/sap-mock-data/src/sap_mock_data/cli/main.py:107

  • GenerationConfig validation errors (e.g., unknown size identifiers or invalid numeric factors) are not caught, so sap-mock generate --scale-factor banana will currently crash with a traceback. Wrap GenerationConfig construction and route ValueError through argparse's error() for a consistent CLI experience.
        config = GenerationConfig(
            random_seed=args.seed,
            scale_factor=args.scale_factor,
            num_orders=args.orders,
            num_customers=args.customers,
            num_finished_goods=args.finished_goods,
            num_raw_materials=args.raw_materials,
            num_vendors=args.vendors,
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread libs/sap-mock-data/src/sap_mock_data/cli/main.py Outdated
Comment thread libs/sap-mock-data/src/sap_mock_data/config.py Outdated
Comment thread libs/sap-mock-data/src/sap_mock_data/config.py
@drdma

drdma commented Sep 2, 2026

Copy link
Copy Markdown

can the sites be varies too? e.g. sites: 1-2 / 4-5 / 20-40 / 100+

The BOM depth also needs to be varied e.g. 1 / 2-3 / 3-4, I'm guessing this is more involved and requires more work?

@thehabbos007

thehabbos007 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

can the sites be varies too? e.g. sites: 1-2 / 4-5 / 20-40 / 100+

I think we can do this, I'll try to get this into this PR

The BOM depth also needs to be varied e.g. 1 / 2-3 / 3-4, I'm guessing this is more involved and requires more work?

It is a little more involved, I will track this in H-6798
@drdma

Comment thread libs/sap-mock-data/src/sap_mock_data/generation/masterdata.py
Comment thread libs/sap-mock-data/src/sap_mock_data/config.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3c55a9c. Configure here.

Comment thread libs/sap-mock-data/src/sap_mock_data/generation/transactions.py
@thehabbos007

Copy link
Copy Markdown
Contributor Author

@drdma after some back and forth with the PR, i think it is in a better spot now to be merged. Will look at BOM depth soon as well

@thehabbos007
thehabbos007 added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit ded547d Sep 4, 2026
18 of 22 checks passed
@thehabbos007
thehabbos007 deleted the asa/sap-mock-data-scale branch September 4, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants