Chapter 6

Examples

Worked examples that show how the repo structure is applied to real market cases.

Subsections of Examples

CN Store Visits

This is the first worked example and the initial driver for creating this repo.

Why It Matters

The China store visits case exposed several problems that were not just isolated coding mistakes:

  • analyst logic was living outside a governed Git workflow
  • local scripts had drifted away from the product-side expectations
  • transform, model, and decomp logic were not clearly aligned
  • date/week conventions introduced market-specific risk

Main Lessons

One Model Representation

If a market updates the variable representation for forecast/upload purposes, then:

  • transform
  • predict
  • decomp
  • build output

must all use that same updated representation.

No Hidden Local State

Market implementations cannot rely on:

  • local SharePoint paths
  • analyst-specific Windows paths
  • attached packages being present by accident
  • untracked helper scripts

Explicit Market Conventions

China highlighted that week-start conventions matter. These assumptions must be encoded in config and logic, not left implicit.

Repository Impact

The China case directly informed:

  • the repo split between product/package code and market code
  • the market folder contract
  • forbidden-pattern validation
  • the need for future full clean-session checks

Current Local Repro

A local repro bundle now exists under:

markets/CN/store_visits/local-repro/

This includes a repeatable runner:

./markets/CN/store_visits/local-repro/run_cn_repro.sh

That runner demonstrates the local:

  • transform
  • updated model refit
  • decomp

path from the supplied China sample artefacts.

Next Documentation Step

Once the real China implementation is migrated into markets/CN/store_visits, this page should be expanded into a true before/after example with exact technical detail.