Chapter 4 — Classification¶
4.1 — Chapter summary¶
⚙ Processes: three pipeline steps —
segmentation(phase 1: ABC classifications; phase 2: segment assignment — one step),characterization(also re-runs inside every forecast chain), andpreprocess(the resolved parameter map). Run: the ProcessRunner cards, or the full pipeline run (the API/CLI equivalents are in 4.D). Characterization is ALSO embedded in the forecast step (outlier → characterization → backtest run as one phase insideforecast).
Together they answer: what kind of demand is each series (characterization), how important is each item (ABC), which planning group does each series belong to (segmentation), which parameter sets therefore apply (the preprocess map). Everything here is per-pipeline planning infrastructure — the outputs feed Points 5–7.
4.2 — Demand classification (characterization)¶
⚙ Process: the characterization step (
characterization/characterization.py+ the SQL variant). Runs standalone (the Processes page card) and inside every forecast chain. Output:PIPE_series_characteristics(CH, pipeline + scenario + archive scoped, drop+insert).
What it detects per series: seasonality (ACF-based), trend, intermittency, stationarity,
complexity (score + low/medium/high level), and data sufficiency — sufficient_for_ml /
sufficient_for_deep_learning — plus spike/plateau flags. The zero-fill interplay (3.3): without a
complete calendar the ACF test can never see a yearly cycle on seasonal-but-sparse extracts.
Weekly demand master.demand_actuals (3.2) → characterization step seasonality · trend · intermittency · complexity cov / n_observations · ML-DL sufficiency · date_range_end → PIPE_series_characteristics one row per series (CH, pipeline + scenario + archive)
Forecast chain (primary) eligibility gates · season length · method pools + every method runner → Netting cutoff anchor ( date_range_end ) → Exceptions · Alerts cov / n_obs / recency rules → Auto-approval · NPI trend/cov features · donor pool → Segmentation criteria fields (4.4) → API surfaces · Mirabelle series pages · dashboards · AI queries → Historization (archived copy only)
The same flow rendered — the inputs the step takes, the detection battery it runs, the output table it creates, and who consumes it:
flowchart LR
A["INPUT — weekly demand<br/>master.demand_actuals (Layer 1, 3.2)<br/>the observed values per series × week"]
B["INPUT — the characterization parameter set<br/>per series via the preprocess map (4.5)<br/>thresholds: ADI 1.32 / CoV 0.49 / zero-ratio 0.5<br/>complexity 0.35 / 0.65 · min_for_ml 100 · min_for_dl 200"]
A --> C
B --> C
C["PROCESS — the characterization step<br/>characterization.py + the SQL variant<br/>ACF seasonality · trend · intermittency<br/>stationarity (ADF) · complexity score → level<br/>data sufficiency · demand-group method pool"]
C --> D["OUTPUT — PIPE_series_characteristics (CH)<br/>one row per series:<br/>has_seasonality · seasonal_periods · strength<br/>has_trend · is_intermittent (zero_ratio / adi / cov)<br/>is_stationary · adf_pvalue · complexity_score + level<br/>sufficient_for_ml / _deep_learning · n_observations<br/>date_range_end · recommended_methods"]
D --> E["The forecast chain (primary)<br/>eligibility gates · season length · method pools"]
D --> F["Netting cutoff (date_range_end)<br/>exceptions · alerts · auto-approval features"]
D --> G["Segmentation criteria (4.4)<br/>NPI donor pool (≥ 12 obs)<br/>API surfaces · historization"]
classDef io fill:#e7f6f0,stroke:#10b981,color:#1b4332;
classDef proc fill:#eef2ff,stroke:#6366f1,color:#312e81;
class A,B,D io;
class C proc;
Downstream consumers (verified against the code — the table behind the graph):
| Consumer | What it reads / how |
|---|---|
| The forecast chain (the primary consumer) | The ML/DL eligibility gates: a series below sufficient_for_ml/sufficient_for_deep_learning is excluded from ML/DL candidates; seasonal methods require has_seasonality (filter_by_sufficiency) — the single reason a 5-observation series never reaches LightGBM/Chronos. Also the season-length resolution (seasonal_periods) and the per-demand-group method pools (SPARSE / INTERMITTENT / SEASONAL / COMPLEX / STANDARD — Fig. 15): the demand group a series lands in decides which methods it even tries. Every method family's standalone runner reads the table too. |
| Netting | Each series' date_range_end is the per-series netting cutoff anchor (where the forward consumption fence starts — _load_cutoffs) |
| Exceptions | A characteristics row is the "series ran" universe marker; cov, n_observations, date_range_end drive the variability / min-obs / recency checks (also per-uid recompute) |
| Alerts | Characteristics-based alert rules (e.g. the 80th-percentile cov threshold) |
| Auto-approval | trend_strength / cov as recommendation features |
| Segmentation | Characteristics columns are segment-criteria fields; the builder's enum values come from the table (4.4) |
| NPI | The donor pool = series with ≥ 12 observations |
| API surfaces | Series list/detail pages, Method Lab explanation (adf_pvalue), the Dashboard aggregate-demand anchor (date_range_end), the forecast-SKUs grid, diagnostics, the pipeline baseline — and Mirabelle AI routes "seasonality / trend / intermittent / cov" queries here |
(The standalone archiver and the Scenario Review freeze that once archived this table were removed in Dec 2026 — the archive-date buckets in the PIPE_ table itself are the history.)
4.3 — ABC¶
⚙ Process: phase 1 of the segmentation step — every active ABC classification runs, then segments assign. Output:
PIPE_abc_results(CH-primary, pipeline-partitioned, drop+insert).
4.3.0 — Where it is configured: the classification scenario¶
ABC/XYZ classifications are configured as a classification scenario — the
Classification tab of the Pipelines page (left toolbar → Configuration → Pipelines →
"🔤 Classification"; the tab is the page's default). A scenario is the container: name,
description and an ordered list of parameter sets, each set being one classification (the
knobs of 4.3.1 — metric, method, lookback, class labels, thresholds, segment scope). Sets are
evaluated in sort_order and the first matching set wins per series — each set classifies
only the series inside its segment scope that no earlier set has already classified — so several
classifications coexist in one scenario (e.g. by value, by volume, custom classes D/X/Y/Z).
How you run it: the scenario editor's Run button executes the scenario on demand for the active pipeline (its results are tagged with the classification scenario); the segmentation step's phase 1 runs every active configuration (run it via the Processes page — the segmentation step, or the full pipeline run).

Fig. 16 — Where ABC is configured: the classification scenario editor (Pipelines → Classification tab → Edit on the scenario row) — the scenario's ordered parameter sets (name, metric, method, lookback, class labels, thresholds, segment scope). Captured 2026-11-15.
The Classification results page (/abc, direct URL — no left-toolbar entry) is the results
and legacy-config viewer: the config_abc_configuration entries the segmentation step runs,
the combined results table with coloured class chips and per-config class filters, and the
per-config Pareto chart. Classification scenarios are managed on the Pipelines → Classification
tab; the /abc page displays the outcomes.
4.3.1 — What a classification IS (the config knobs)¶
A classification is one named ranking of the series universe by a metric, cut into classes by
a method with thresholds (files/classification/abc.py::ABCClassifier; API ABCConfigIn in
files/api/main.py:20209). Every config row in config_abc_configuration:
| Knob | Values | Meaning |
|---|---|---|
metric |
hits / demand / value (+ unit_cost / price / margin_pct / margin_abs) |
What is ranked. hits = COUNT(*) of master.demand_actuals rows in the window, not a count of order lines or distinct weeks (4.3.5). demand = qty sum (SUM(da.qty)), value = qty × price (SUM(da.qty × price) — price waterfall item_location.price → cost_price → item.price → attributes.price → 1). The four item-master metrics are static per-item values (no demand aggregation, no date window): margin_abs = price − cost, margin_pct = (price − cost)/price × 100 |
lookback_months |
default 12 | Ranking window, [anchor − N mo, anchor], anchored on the planning date (never wall clock). dynamic_anchor = true re-anchors each series on its own last actual date. 0 = all history |
granularity |
item_site / item |
Rank per (item, site) pair, or per item across all sites (item-level results are propagated back to every site pair) |
method |
cumulative_pct / rank_pct / rank_absolute |
How classes are cut (4.3.2) |
class_labels |
default [A, B, C] |
One label per class — arbitrary ([Platinum, Gold, Silver], XYZ…) |
thresholds |
default [80, 95] |
The cut points, interpreted per method |
segment_id |
NULL | Scope the ranking to one segment's members only |
is_active |
bool | Only active configs run in the step / Run All |
4.3.2 — The classification methods (how thresholds cut)¶
All three methods rank the series by metric_value descending (_classify,
files/classification/abc.py:400-446), then assign labels from the top:
| Method | Example thresholds | How ranks are cut |
|---|---|---|
cumulative_pct (default) |
[80, 95] |
A through 80% of the metric total; B above 80% through 95%; C above 95%. |
rank_pct |
[20, 50] |
A in the top 20% of ranks; B in the rest of the top 50%; C below that. Each cutoff rank rounds up, with a minimum of 1. |
rank_absolute |
[100, 500] |
A through rank 100; B from 101 through 500; C from 501 on. |
See the 20-part Excel example for the full calculation.
4.3.3 — The result KPIs (one row per series × config)¶
PIPE_abc_results carries the ranking evidence per series — the KPIs each class chip summarises:
| Column | Meaning |
|---|---|
metric_value |
the ranked quantity (hits / demand qty / value / static item metric) |
rank |
1-based position in the descending ranking |
cumulative_pct |
the running share of the grand total at this rank (the Pareto curve's y) |
class_label |
the assigned class (A/B/C, X/Y/Z, or custom labels) |
config_id / config_name |
which classification produced the row (the multi-config key) |
computed_at |
run timestamp — auto-approval reads the latest archive |
Per-config summary KPIs (the page's cards): class counts
(A: 4,039 · B: 2,449 · C: 1,008 on the demo tenant's Default), result_count / last_run, and
the Pareto chart — bars of metric_value coloured per class + the cumulative-% line.
4.3.4 — How segmentation consumes ABC (the dynamic classification.{name} fields)¶
The Segments page's recursive criteria builder exposes every active classification as an enum
criterion field — classification.{config name} (files/api/main.py:21414-21437 builds the list
from config_abc_configuration; files/frontend/src/components/Segments.jsx:171-181 renders it).
A segment rule like "AX parts" = classification.Default (demand) = A AND
classification.XYZ (order hits) = X matches series against their latest PIPE_abc_results
class labels — multi-config intersections without duplicating rankings (the engine pivots only the
configs a criteria set actually references, segmentation.py:1811-1855).

Fig. 16b — The classification results view (the demo tenant): the Classification page
(/abc) — config cards with metric/lookback badges and class counts (Default (demand):
Demand Volume 12mo — A 4,039 / B 2,449 / C 1,008; XYZ (order hits): Order Hits 12mo —
X 5,997 / Y 1,134 / Z 365), the selected config's Pareto chart (per-series bars coloured by
class + the cumulative-% line). Captured 2026-11-15.

Fig. 16c — The combined view (the demo tenant): "All Classifications — 597 SKUs" — one row per (item, site) with one column per active config (Default (demand), XYZ (order hits)), coloured class chips, per-config class filters, and the supersession arrows on item names. Captured 2026-11-15.

Fig. 16d — ABC in segmentation (the demo tenant): the Segments page's segment editor —
the recursive criteria builder with the dynamic classification.{name} enum fields (the AX parts
segment: classification.Default (demand) = A AND classification.XYZ (order hits) = X).
Captured 2026-11-15.
Item demand value (the weekly table, 3.2) → segmentation step — phase 1 value column × class labels × thresholds (e.g. A ≤ 80% ≤ B ≤ 95% < C) → PIPE_abc_results one row per item × site × config class_label · metric_value · cumulative_pct (CH, pipeline + archive)
ABC API + Classification page results table · per-series class chips summaries · config counts → Auto-approval features class_label (latest archive) → routing + value-cap rules → Segmentation criteria the ABC-class field evaluates against the results → Mirabelle AI "abc / a class / c class" queries → Historization / freeze (archived copy only)
Downstream consumers (verified against the code — the table behind the graph): the ABC API
surface (the Classification page's results table, the per-series class chips on detail pages/grids, summaries),
auto-approval's _business_features (class_label → the planner-routing and value-cap rules),
the segmentation criteria builder (the dynamic classification.{name} fields, 4.3.4),
Mirabelle's "abc class" queries; scenario_guard types it classification-scenario for
filter rewriting. (The archived copies the archiver/freeze once made were removed with those features, Dec 2026.) Not a consumer: allocation item priorities (they come from
master.item).
4.3.5 — Where the data lives (and the SQL to verify it)¶
Everything a classification reads and writes, with the exact queries to check any number it
produced. The SQL in this section is verified end-to-end on the demo tenant (thebicycle,
pipeline 4): every one of the 587/587 stored metric_values of both active configs
reproduces exactly from the input tables.
| What | Table | Where | Notes |
|---|---|---|---|
| The classification configs | scenario.config_abc_configuration |
tenant PostgreSQL | one row per config: metric, method, lookback_months, granularity, class_labels (JSON), thresholds (JSON), dynamic_anchor, segment_id, is_active |
| The classification scenario | scenario.classification_scenario |
tenant PostgreSQL | param_sets JSON — ordered sets (params: metric, method, thresholds, data_source, granularity, class_labels, dynamic_anchor, lookback_months; plus segment_ids, sort_order); linked per pipeline by scenario.config_scenario_pipeline.classification_scenario_id |
| The ranked demand | master.demand_actuals |
tenant PostgreSQL | the weekly demand rows every demand-side metric aggregates (3.2) |
Prices (the value metric) |
master.item_location → master.item |
tenant PostgreSQL | waterfall item_location.price → item_location.cost_price → item.price → item.attributes->>'price' → 1 (config-path configs; scenario param sets skip item_location) |
Corrected demand (data_source='corrected_demand', scenario sets only) |
PIPE_demand_corrected |
ClickHouse | corrected_value replaces qty per (item, site, date) — applied to the demand metric only |
| The results | PIPE_abc_results |
ClickHouse | one row per series × config at the run's archive_date: class_label, metric_value, rank, cumulative_pct, abc_config_name, config_id (0 = the classification-scenario sentinel), denormalised item_name / site_name |
The ranking window is anchored on the planning date (planning_today(pipeline_id) — never
the wall clock), and each run's rows are bucketed at its planning Monday (archive_date).
Stored results reflect the anchor at run time: if the planning date has moved since the
last classification run, the stored numbers keep the old window — re-run the segmentation
step to re-window them.
The number of hits — reproduce it exactly¶
hits is the number of rows (COUNT(*) of the weekly master.demand_actuals table) inside
the classification window, not the number of distinct weeks or order lines (master.demand_orders
is not read). Zero-filled rows (3.3) and open
order-book rows (is_open = TRUE) count too — the counter has no qty > 0 filter. What the
code builds (_compute_metric, files/classification/abc.py:376-388), as copy-paste SQL:
dynamic_anchor = false (default) — one global window for every series:
SELECT item_id, site_id, COUNT(*) AS hits -- this IS the stored metric_value
FROM master.demand_actuals
WHERE date >= DATE '<planning_today>' - INTERVAL '12 months' -- lookback_months
AND date <= DATE '<planning_today>'
GROUP BY item_id, site_id -- granularity 'item_site' (drop site_id for 'item')
HAVING COUNT(*) > 0
ORDER BY hits DESC;
dynamic_anchor = true — each series' own last 12 months (both demo-tenant configs use
this): a series whose data ended in March is ranked on ITS trailing year, not the calendar
year:
WITH last_actual AS (
SELECT item_id, site_id,
MAX(date) FILTER (WHERE date <= DATE '<planning_today>') AS last_date
FROM master.demand_actuals
GROUP BY item_id, site_id
)
SELECT da.item_id, da.site_id, COUNT(*) AS hits
FROM master.demand_actuals da
JOIN last_actual la ON la.item_id = da.item_id AND la.site_id = da.site_id
WHERE da.date >= la.last_date - INTERVAL '12 months'
AND da.date <= la.last_date
GROUP BY da.item_id, da.site_id
HAVING COUNT(*) > 0;
Verified: the 587 stored metric_values of the XYZ (order hits) config match this query's
per-series counts 587/587 (planning date 2026-06-18). The same two window shapes with
SUM(da.qty) instead of COUNT(*) reproduce the demand metric (also verified 587/587
against the Default (demand) config); with SUM(da.qty × <price waterfall>) they reproduce
value.
The stored results — read them in ClickHouse¶
-- one series' code, per active config, with the evidence behind it
SELECT abc_config_name, class_label, metric_value, rank, cumulative_pct, archive_date
FROM PIPE_abc_results
WHERE pipeline_id = <pid> AND item_id = <item> AND site_id = <site>
ORDER BY archive_date DESC;
-- class counts per config (the /abc page's KPI cards) — always the LATEST archive
SELECT abc_config_name, class_label, count() AS n
FROM PIPE_abc_results
WHERE pipeline_id = <pid>
AND archive_date = (SELECT max(archive_date) FROM PIPE_abc_results WHERE pipeline_id = <pid>)
GROUP BY abc_config_name, class_label
ORDER BY abc_config_name, class_label;
Readers (segmentation phase 2, auto-approval, the /abc page, the segment criteria fields)
always use the latest archive_date per pipeline. A classification scenario's rows carry
config_id = 0 + abc_config_name = <scenario name> (the sentinel — the segmentation
criteria address them as classification.<scenario name>); legacy-config rows carry their
config_abc_configuration id and name. That pair is the table's multi-config key.
4.3.6 — ABC by hits: 20 parts in Excel¶
Imagine 20 different bike parts at one fictional site, Central Depot. Their hit counts are made up. A hit is one demand row in the chosen window (see the source and SQL). Together the 20 parts have 400 hits. Which parts become A, B, and C?
Download the Excel workbook (.xlsx)
The workbook's Inputs sheet has the 20 hit counts. In Excel, ABC by hits sorts the
parts and recalculates this table when you change a hit count or cutoff. This example uses
cumulative_pct: A at or below 80%, B above 80% through 95%, C above 95%. Read those
percentages from the Cumulative % column, not from the rank or from the hits of a single part.
| Rank | Part | Hits | Running hits | Cumulative % | ABC class |
|---|---|---|---|---|---|
| 1 | Drive chain | 48 | 48 | 12.00% | A |
| 2 | Brake rotor | 42 | 90 | 22.50% | A |
| 3 | Rear cassette | 37 | 127 | 31.75% | A |
| 4 | Brake pads | 33 | 160 | 40.00% | A |
| 5 | Rear derailleur | 30 | 190 | 47.50% | A |
| 6 | Front hub | 27 | 217 | 54.25% | A |
| 7 | Bottom bracket | 25 | 242 | 60.50% | A |
| 8 | Crank arm | 23 | 265 | 66.25% | A |
| 9 | Shifter cable | 21 | 286 | 71.50% | A |
| 10 | Chainring | 18 | 304 | 76.00% | A |
| 11 | Wheel bearing | 16 | 320 | 80.00% | A |
| 12 | Seat clamp | 15 | 335 | 83.75% | B |
| 13 | Headset spacer | 14 | 349 | 87.25% | B |
| 14 | Pedal spindle | 12 | 361 | 90.25% | B |
| 15 | Fork seal | 10 | 371 | 92.75% | B |
| 16 | Stem bolt | 9 | 380 | 95.00% | B |
| 17 | Cable ferrule | 8 | 388 | 97.00% | C |
| 18 | Valve core | 6 | 394 | 98.50% | C |
| 19 | Spoke nipple | 4 | 398 | 99.50% | C |
| 20 | Dust cap | 2 | 400 | 100.00% | C |
| Total | 400 |
How to calculate each column¶
- Rank. Sort by hits, largest first. Drive chain has 48 hits, so it is rank 1. Brake rotor has 42, so it is rank 2. The hit count is an input; the letter is not.
- Running hits. Add this part's hits to the ones above it. The first three rows
give
48, then48 + 42 = 90, then90 + 37 = 127. In Excel,D8is=SUM($C$8:C8). Fill down: the starting cell stays fixed, and the range grows by one row. - Cumulative %. Divide the running hits by all 400 hits, not by 20 parts.
The Brake rotor row shows
90 / 400 = 22.50%: that is the share for the first two parts together, not for Brake rotor alone. In Excel,E8is=ROUND(D8/$C$28,4)and is formatted as a percentage with two decimals.$C$28stays fixed at the grand total as the formula is filled down. - ABC class. Compare the percentage after adding the current part. Excel checks
the A cutoff first, then the B cutoff; if neither passes, the part is C. Here
B4is 80%,D4is 95%, and the formula inF8is=IF(E8<=$B$4,"A",IF(E8<=$D$4,"B","C")).
Exactly where A ends and C begins¶
- Last A: Wheel bearing (rank 11). The row above ends at 304 hits. Adding 16 gives
320 / 400 = 80.00%. Equality is allowed, so Wheel bearing stays A. - First B: Seat clamp (rank 12). Adding 15 gives
335 / 400 = 83.75%. That is over 80% but not over 95%, so the whole part is B. - Last B: Stem bolt (rank 16). Adding 9 to 371 gives
380 / 400 = 95.00%. Equality is allowed here too, so Stem bolt stays B. - First C: Cable ferrule (rank 17). Adding 8 gives
388 / 400 = 97.00%. That is over 95%, so Cable ferrule and the remaining parts are C.
The result is 11 A parts with 320 hits (80%), 5 B parts with 60 hits (15%) and 4 C parts with 20 hits (5%). B contributes 15% on its own; 95% is the total for A and B combined. The A cutoff is not an instruction to classify 80% of the parts: only 11 of the 20 parts are A in this example.
Try changing the A cutoff to 79%
In the workbook, change B4 from 80% to 79%. Wheel bearing moves to B because its
cumulative share is still 80.00%. A ends at Chainring, with 76.00% of the hits. No part
is split to land exactly on a cutoff.
If you choose a different ranking rule¶
The metric says what to sort by; the method says where to draw the lines. With the
same 20 parts, rank_pct [20, 50] cuts after ranks 4 and 10 (4 A, 6 B, 10 C).
rank_absolute [3, 8] cuts after ranks 3 and 8 (3 A, 5 B, 12 C). Neither of those methods
uses the cumulative percentage to assign the letters. If you rank by demand units, value,
or a master-data metric instead of hits, start by sorting the chosen numbers again, then
apply the configured method.
With item-site ranking, a part at another site has its own hit count and can earn a different letter. With item ranking, hits across eligible sites are combined before ranking and the resulting letter is shared. The example uses one site so all 20 rows can be read as parts.
4.4 — Segmentation¶
⚙ Process: phase 2 of the segmentation step — each segment's criteria run against the series universe and assignment lands in
PIPE_segment_membership(CH, pipeline + archive scoped; the latest snapshot is what every reader uses). Criteria are edited on the Segments page; the assignment itself runs with the step.
Segments are named series groups built with a recursive criteria builder — AND/OR groups over
characteristics (seasonality, complexity, intermittency…), ABC class, item/site attributes, features — with a
live preview of matching series before assignment. ABC classes enter as the dynamic
classification.{name} enum fields (4.3.4) — one per active classification config, options = its
class labels, matching against the latest PIPE_abc_results. The is_default segment is the documented
catch-all (its implicit coverage means member counts show true totals). Overlapping criteria are legitimate: a
series may sit in several segments of the same type (each segment link then resolves its own parameter sets).

Fig. 17 — Where segments are configured (the demo tenant, 34 segments): the Segments
page (/segments) — segment CRUD, the recursive criteria builder over characteristics/ABC/item
fields with live preview, and per-segment member counts. Assignment runs with the segmentation step
(69,834 membership rows on the demo tenant). Captured 2026-11-10.
Downstream consumers: the parameter-resolution chain (4.5 — every parameter-set → segment link resolves through membership), demand-coverage segment rules (3.4), scenario segment links (forecast/MEIO/supply parameter sets per segment), MEIO target groups and the pass-2 universe scope, and the UI segment filters everywhere.
4.5 — Preprocess: the single resolved parameter map¶
⚙ Process: the preprocess step (
segmentation.build_series_parameter_map) — a fullDELETE + INSERTrebuild per pipeline: PG{schema}.series_parameter_map, then the CH partitionPIPE_preprocessed. Re-run it after ANY segment or param-set link change — a scenario with segment links but an empty/stale snapshot logs a loud re-run WARNING, and a snapshot referencing a deleted parameter set raises (no silent default fallback).
What it resolves: one row per (item, site) — which forecast parameter set, outlier set, characterization set, backtesting set, MEIO target set, order-frequency set, supply set, lead-time set, MEIO parameter-set ids, hyperparameter set, and the seven allocation policy-set ids apply to that series. The single resolved snapshot for every typed parameter.
Coverage verification (2026-11-10, against build_series_parameter_map's resolution
CTEs + the ensure-DDL column lists) — every scenario type that carries per-series or segment-linked
parameter sets resolves through the map, including the most recent ones:
| Scenario type | Map column(s) | Segment-link table | Status |
|---|---|---|---|
| Series (forecast) | forecast_parameter_set_id · outlier_parameter_id
· characterization_parameter_id · backtesting_parameter_id ·
hyperparameter_set_id |
config_forecast_parameter_set_segment · config_parameter_segment ·
config_hyperparameter_set_segment | ✓ original |
| MEIO | meio_parameter_ids (array) · meio_target_parameter_id |
config_meio_parameter_set_segment · config_parameter_segment |
✓ (resolved here — but MEIO's runner reads direct config, the documented exception below) |
| Supply | supply_parameter_id |
config_supply_scenario_segment | ✓ |
| Allocation (Oct 2026 — recent) | the seven allocation_* columns (priority · starvation · reservation · fairness ·
routing[] · aging[] · lateness[]) |
allocation_parameter_set_segment | ✓ verified in the builder's CTEs and the ensure-DDL lists |
| Lead-time (Sep 2026 — recent) | lead_time_parameter_id |
config_lead_time_scenario_segment | ✓ verified — migration-gated (the
explicit information_schema probe: an unmigrated tenant resolves NULL with a loud hint, the
feature being dormant anyway) |
| Order frequency (K-curve) | order_frequency_parameter_id |
config_parameter_segment | ✓ |
| Correctly NOT in the map — process/config scenario types with no per-series parameter sets: causal · maintenance (their own input tables — fleet plans, BOM, failure rates) · classification (ABC configs) · exception (triage rules) · import (object modes) · approval (rules) · historization (object toggles) · segmentation itself (the segments). Nothing to resolve per series — by design. | |||
The runtime ensure-DDL (PIPE_PREPROCESSED_PG_COLUMNS / PIPE_PREPROCESSED_CH_COLUMNS,
one source of truth shared by the API startup and scripts/migrate_series_parameter_map.py) carries
every column added after the original schema — the allocation seven and lead-time included — so a fresh tenant
receives the full 17-column map at startup; the dead columns
(evaluation/best_method/netting/method_selection_parameter_id) are purged by the same lists.
Downstream consumers — with the documented exception:
| Consumer | Reads the map how |
|---|---|
| Forecast orchestrator param groups | Directly (forecasting / outlier / characterization / backtesting columns) — the map is the primary source |
| Allocation + K-curve runners | Preprocess-preferred with fallback (stale-map tolerant by design) |
| MEIO | Does NOT read the map (documented decision — a stale snapshot once assigned sku_max_sl_qty=0 and corrupted the optimizer's ceiling): MEIO reads the direct config tables. Changing MEIO param-set links requires re-running preprocess for everything ELSE, but MEIO itself is immune |
| Scenario editors / API | Membership + link verification, the preprocess view |
4.D — For developers — the classification APIs¶
The UI paths above cover the planner's loop; the equivalents for scripts and add-ons:
| Call | Purpose |
|---|---|
POST /api/pipeline/run/segmentation \| /characterization \| /preprocess {"pipeline_id": N} |
Run the three steps standalone (CLI: python files/run_pipeline.py --only <step> --pipeline-id N). |
GET/POST /api/classification-scenarios (+ /{id} PUT/GET, /{id}/clone, /{id}/run) |
The classification scenario CRUD + the on-demand run the editor's Run button uses. |
GET/POST /api/abc/configurations (+ /{id} GET/PUT/DELETE) · POST /api/abc/run/{config_id} · POST /api/abc/run-all · GET /api/abc/results/{config_id} · GET /api/abc/summary/{config_id} |
The ABC configurations, per-config runs, and the results/summary the Classification page renders. |
4.T — Step-by-step test walkthrough¶
Classification and the parameter snapshot.
| # | Where to look / what to click | You should see |
|---|---|---|
| 1 | Pipelines → Segments tab → build a segment | rules (demand value, ABC, velocity…) → Save; the segment appears in every scope dropdown |
| 2 | Segments list → verify membership counts | each segment row shows its member count; open a series → its segment resolves |
| 3 | ABC tab → run the classification | A/B/C classes with the value cut-offs; an item's class shows in the grid |
| 4 | Processes → run the preprocess step | the resolved parameter snapshot rebuilds (full DELETE + INSERT) |
| 5 | Edit a parameter-set → segment link → re-run preprocess | the next forecast/MEIO run picks the new assignment — stale snapshots are the documented failure mode |

The segment rules builder — save and the segment is live in every scope picker.

ABC classes with cut-offs after a classification run.