@burdenoff/microfe-movethewheels 2026.1108.1 → 2026.1108.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ForecastModelsPanel.js +132 -0
- package/dist/components/UpcomingDemandPanel.js +70 -65
- package/dist/generated/wspace-operations.d.ts +25 -0
- package/dist/generated/wspace-types.d.ts +1822 -134
- package/dist/hooks/useDemandForecast.js +1 -1
- package/dist/hooks/useForecastModelChoices.js +57 -0
- package/dist/movethewheels/components/ForecastModelsPanel.d.ts +4 -0
- package/dist/movethewheels/hooks/useDemandForecast.d.ts +9 -0
- package/dist/movethewheels/hooks/useForecastModelChoices.d.ts +34 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/sigma.js +8 -0
- package/dist/pages/AnalyticsPage.js +83 -81
- package/package.json +1 -1
- package/src/generated/wspace-operations.ts +13 -4
- package/src/generated/wspace-types.ts +1951 -134
- package/src/movethewheels/components/ForecastModelsPanel.tsx +188 -0
- package/src/movethewheels/components/UpcomingDemandPanel.tsx +9 -2
- package/src/movethewheels/hooks/useDemandForecast.ts +13 -0
- package/src/movethewheels/hooks/useForecastModelChoices.ts +138 -0
- package/src/movethewheels/pages/AnalyticsPage.tsx +7 -2
- package/src/operations/wspace/movethewheels/queries/forecast.graphql +22 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ForecastModelsPanel
|
|
3
|
+
*
|
|
4
|
+
* Supply-chain planning v3 (BOFF-10925): which model forecasts each lane and
|
|
5
|
+
* customer, and why. A lane or customer with 26 closed weeks of history is
|
|
6
|
+
* back-tested with the moving-average heuristic, Holt linear and Holt-Winters
|
|
7
|
+
* exponential smoothing; the one with the lowest error (MAPE) on the last
|
|
8
|
+
* closed weeks produces its forecast. Shorter histories keep the heuristic.
|
|
9
|
+
*
|
|
10
|
+
* Read-only: the choices are recorded by each forecast recalculation.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import { Sigma } from 'lucide-react';
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
Badge,
|
|
18
|
+
Card,
|
|
19
|
+
CardContent,
|
|
20
|
+
CardDescription,
|
|
21
|
+
CardHeader,
|
|
22
|
+
CardTitle,
|
|
23
|
+
Skeleton,
|
|
24
|
+
Table,
|
|
25
|
+
TableBody,
|
|
26
|
+
TableCell,
|
|
27
|
+
TableHead,
|
|
28
|
+
TableHeader,
|
|
29
|
+
TableRow,
|
|
30
|
+
Tabs,
|
|
31
|
+
TabsContent,
|
|
32
|
+
TabsList,
|
|
33
|
+
TabsTrigger,
|
|
34
|
+
} from './ui';
|
|
35
|
+
import type { DemandForecastModel } from '../hooks/useDemandForecast';
|
|
36
|
+
import {
|
|
37
|
+
useForecastModelChoices,
|
|
38
|
+
type ForecastModelChoice,
|
|
39
|
+
type ForecastModelScore,
|
|
40
|
+
} from '../hooks/useForecastModelChoices';
|
|
41
|
+
|
|
42
|
+
/** Short display name of a forecast model. */
|
|
43
|
+
export const forecastModelLabel = (
|
|
44
|
+
model: DemandForecastModel,
|
|
45
|
+
seasonLengthWeeks?: number | null
|
|
46
|
+
): string => {
|
|
47
|
+
switch (model) {
|
|
48
|
+
case 'HOLT_LINEAR':
|
|
49
|
+
return 'Holt (trend)';
|
|
50
|
+
case 'HOLT_WINTERS':
|
|
51
|
+
return seasonLengthWeeks
|
|
52
|
+
? `Holt-Winters (${seasonLengthWeeks}-week cycle)`
|
|
53
|
+
: 'Holt-Winters (seasonal)';
|
|
54
|
+
// HEURISTIC_GROWTH_RATE is reserved and never produced; the API documents
|
|
55
|
+
// it as the moving-average heuristic, so it is labelled the same way.
|
|
56
|
+
case 'HEURISTIC_MOVING_AVG':
|
|
57
|
+
case 'HEURISTIC_GROWTH_RATE':
|
|
58
|
+
return 'Moving average';
|
|
59
|
+
default: {
|
|
60
|
+
// Exhaustive over the schema enum: a new model fails the type check here.
|
|
61
|
+
const unknownModel: never = model;
|
|
62
|
+
return String(unknownModel);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const formatMape = (mape: number | null): string =>
|
|
68
|
+
mape === null ? '—' : `${Math.round(mape * 1000) / 10}%`;
|
|
69
|
+
|
|
70
|
+
const scoreFor = (
|
|
71
|
+
choice: ForecastModelChoice,
|
|
72
|
+
model: DemandForecastModel
|
|
73
|
+
): ForecastModelScore | undefined => choice.candidates.find((c) => c.model === model);
|
|
74
|
+
|
|
75
|
+
export function ForecastModelsPanel() {
|
|
76
|
+
const { laneChoices, customerChoices, isLoading, error, refetch } = useForecastModelChoices(5);
|
|
77
|
+
const [tab, setTab] = useState<'LANE' | 'CUSTOMER'>('LANE');
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Card data-testid="forecast-models-panel">
|
|
81
|
+
<CardHeader>
|
|
82
|
+
<CardTitle className="flex items-center gap-2">
|
|
83
|
+
<Sigma size={18} aria-hidden="true" />
|
|
84
|
+
Forecast models
|
|
85
|
+
</CardTitle>
|
|
86
|
+
<CardDescription>
|
|
87
|
+
Lanes and customers with 26 closed weeks of history are back-tested on their last 8 closed
|
|
88
|
+
weeks. The model with the lowest error (MAPE) produces the forecast: the moving-average
|
|
89
|
+
heuristic, Holt (trend) or Holt-Winters (seasonal). Shorter histories use the moving
|
|
90
|
+
average.
|
|
91
|
+
</CardDescription>
|
|
92
|
+
</CardHeader>
|
|
93
|
+
<CardContent>
|
|
94
|
+
{error && !isLoading ? (
|
|
95
|
+
<div className="space-y-2 text-sm">
|
|
96
|
+
<p className="text-status-error-text font-medium">Couldn't load forecast models</p>
|
|
97
|
+
<p className="text-text-secondary">{error.message}</p>
|
|
98
|
+
<button
|
|
99
|
+
type="button"
|
|
100
|
+
onClick={refetch}
|
|
101
|
+
className="font-medium text-primary hover:underline"
|
|
102
|
+
>
|
|
103
|
+
Retry
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
) : isLoading ? (
|
|
107
|
+
<div className="space-y-3">
|
|
108
|
+
<Skeleton className="h-10 w-full" />
|
|
109
|
+
<Skeleton className="h-10 w-full" />
|
|
110
|
+
</div>
|
|
111
|
+
) : (
|
|
112
|
+
<Tabs value={tab} onValueChange={(value) => setTab(value as 'LANE' | 'CUSTOMER')}>
|
|
113
|
+
<TabsList>
|
|
114
|
+
<TabsTrigger value="LANE">Lanes</TabsTrigger>
|
|
115
|
+
<TabsTrigger value="CUSTOMER">Customers</TabsTrigger>
|
|
116
|
+
</TabsList>
|
|
117
|
+
<TabsContent value="LANE">
|
|
118
|
+
<ChoiceTable choices={laneChoices} nameHeader="Lane" />
|
|
119
|
+
</TabsContent>
|
|
120
|
+
<TabsContent value="CUSTOMER">
|
|
121
|
+
<ChoiceTable choices={customerChoices} nameHeader="Customer" />
|
|
122
|
+
</TabsContent>
|
|
123
|
+
</Tabs>
|
|
124
|
+
)}
|
|
125
|
+
</CardContent>
|
|
126
|
+
</Card>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface ChoiceTableProps {
|
|
131
|
+
choices: ForecastModelChoice[];
|
|
132
|
+
nameHeader: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function ChoiceTable({ choices, nameHeader }: ChoiceTableProps) {
|
|
136
|
+
if (choices.length === 0) {
|
|
137
|
+
return (
|
|
138
|
+
<p className="py-4 text-sm text-text-secondary">
|
|
139
|
+
No forecasts yet. Model choices appear after the first forecast recalculation.
|
|
140
|
+
</p>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return (
|
|
144
|
+
<div className="overflow-x-auto">
|
|
145
|
+
<Table>
|
|
146
|
+
<TableHeader>
|
|
147
|
+
<TableRow>
|
|
148
|
+
<TableHead>{nameHeader}</TableHead>
|
|
149
|
+
<TableHead className="text-right">History</TableHead>
|
|
150
|
+
<TableHead>Model</TableHead>
|
|
151
|
+
<TableHead className="text-right">Model error</TableHead>
|
|
152
|
+
<TableHead className="text-right">Moving-average error</TableHead>
|
|
153
|
+
</TableRow>
|
|
154
|
+
</TableHeader>
|
|
155
|
+
<TableBody>
|
|
156
|
+
{choices.map((choice) => {
|
|
157
|
+
const selected = choice.candidates.find((c) => c.selected);
|
|
158
|
+
const heuristic = scoreFor(choice, 'HEURISTIC_MOVING_AVG');
|
|
159
|
+
return (
|
|
160
|
+
<TableRow key={`${choice.scopeType}-${choice.scopeKey}`}>
|
|
161
|
+
<TableCell className="max-w-[16rem]">
|
|
162
|
+
<p className="truncate font-medium" title={choice.scopeLabel}>
|
|
163
|
+
{choice.scopeLabel}
|
|
164
|
+
</p>
|
|
165
|
+
<p className="text-xs text-text-secondary whitespace-normal">{choice.reason}</p>
|
|
166
|
+
</TableCell>
|
|
167
|
+
<TableCell className="text-right whitespace-nowrap">
|
|
168
|
+
{choice.historyWeeks} wk
|
|
169
|
+
</TableCell>
|
|
170
|
+
<TableCell>
|
|
171
|
+
<Badge
|
|
172
|
+
variant={
|
|
173
|
+
choice.selectedModel === 'HEURISTIC_MOVING_AVG' ? 'outline' : 'default'
|
|
174
|
+
}
|
|
175
|
+
>
|
|
176
|
+
{forecastModelLabel(choice.selectedModel, selected?.seasonLengthWeeks)}
|
|
177
|
+
</Badge>
|
|
178
|
+
</TableCell>
|
|
179
|
+
<TableCell className="text-right">{formatMape(selected?.mape ?? null)}</TableCell>
|
|
180
|
+
<TableCell className="text-right">{formatMape(heuristic?.mape ?? null)}</TableCell>
|
|
181
|
+
</TableRow>
|
|
182
|
+
);
|
|
183
|
+
})}
|
|
184
|
+
</TableBody>
|
|
185
|
+
</Table>
|
|
186
|
+
</div>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* UpcomingDemandPanel
|
|
3
3
|
*
|
|
4
4
|
* Surfaces next-week demand forecasts by lane / customer alongside the
|
|
5
|
-
* most recent closed-period variance (BOFF-4393)
|
|
5
|
+
* most recent closed-period variance (BOFF-4393), naming the model behind
|
|
6
|
+
* the headline row (BOFF-10925). Pure read-side view
|
|
6
7
|
* over `wspace-movethewheels-svc`'s DemandForecast surface.
|
|
7
8
|
*
|
|
8
9
|
* "Next week" is the first forecast week that has not begun yet: the current
|
|
@@ -16,6 +17,7 @@ import { Calendar, TrendingUp, TrendingDown, AlertCircle } from 'lucide-react';
|
|
|
16
17
|
import { Card, CardContent, CardHeader, CardTitle, Skeleton } from './ui';
|
|
17
18
|
import { formatCurrency } from '../utils/formatters';
|
|
18
19
|
|
|
20
|
+
import { forecastModelLabel } from './ForecastModelsPanel';
|
|
19
21
|
import type { ForecastPoint, ForecastVariance } from '../hooks/useDemandForecast';
|
|
20
22
|
|
|
21
23
|
interface UpcomingDemandPanelProps {
|
|
@@ -181,8 +183,13 @@ export function UpcomingDemandPanel({
|
|
|
181
183
|
<p className="text-xs uppercase tracking-wide text-text-secondary">{totalLabel}</p>
|
|
182
184
|
<p className="text-2xl font-bold">{total}</p>
|
|
183
185
|
</div>
|
|
184
|
-
<p className="text-xs text-text-secondary">
|
|
186
|
+
<p className="text-xs text-text-secondary text-right">
|
|
185
187
|
{headlineRow ? formatConfidence(headlineRow.confidence) : ''}
|
|
188
|
+
{headlineRow ? (
|
|
189
|
+
<span className="block" data-testid="upcoming-demand-model">
|
|
190
|
+
{forecastModelLabel(headlineRow.model)}
|
|
191
|
+
</span>
|
|
192
|
+
) : null}
|
|
186
193
|
</p>
|
|
187
194
|
</div>
|
|
188
195
|
|
|
@@ -9,6 +9,15 @@ import { executeGraphQL } from '../utils/graphqlClient';
|
|
|
9
9
|
* admin console exposes `recalculateDemandForecasts` separately.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* The forecast model behind a row: the moving-average heuristic, or (once a
|
|
14
|
+
* lane or customer has 26 closed weeks and the model wins the back-test)
|
|
15
|
+
* Holt linear or Holt-Winters exponential smoothing. HEURISTIC_GROWTH_RATE is
|
|
16
|
+
* reserved and never produced.
|
|
17
|
+
*/
|
|
18
|
+
export type DemandForecastModel =
|
|
19
|
+
'HEURISTIC_MOVING_AVG' | 'HEURISTIC_GROWTH_RATE' | 'HOLT_LINEAR' | 'HOLT_WINTERS';
|
|
20
|
+
|
|
12
21
|
export interface ForecastPoint {
|
|
13
22
|
scopeType: 'LANE' | 'CUSTOMER';
|
|
14
23
|
scopeKey: string;
|
|
@@ -21,6 +30,8 @@ export interface ForecastPoint {
|
|
|
21
30
|
actualVolume: number | null;
|
|
22
31
|
actualRevenue: number | null;
|
|
23
32
|
confidence: number;
|
|
33
|
+
/** The model that produced the row (BOFF-10925). */
|
|
34
|
+
model: DemandForecastModel;
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
export interface ForecastVariance {
|
|
@@ -60,6 +71,7 @@ const FORECAST_QUERY = `
|
|
|
60
71
|
actualVolume
|
|
61
72
|
actualRevenue
|
|
62
73
|
confidence
|
|
74
|
+
model
|
|
63
75
|
}
|
|
64
76
|
demandForecastByCustomer(weeks: $weeks) {
|
|
65
77
|
scopeType
|
|
@@ -72,6 +84,7 @@ const FORECAST_QUERY = `
|
|
|
72
84
|
actualVolume
|
|
73
85
|
actualRevenue
|
|
74
86
|
confidence
|
|
87
|
+
model
|
|
75
88
|
}
|
|
76
89
|
laneVariance: demandForecastVariance(scopeType: LANE, limit: $varianceLimit) {
|
|
77
90
|
scopeType
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useMoveTheWheels } from '../providers/MoveTheWheelsProvider';
|
|
4
|
+
import { executeGraphQL } from '../utils/graphqlClient';
|
|
5
|
+
|
|
6
|
+
import type { DemandForecastModel } from './useDemandForecast';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Forecast model choices (BOFF-10925): which model forecasts each lane and
|
|
10
|
+
* customer, with every candidate's back-test error (MAPE), so the choice can
|
|
11
|
+
* be checked. Loaded separately from the forecast itself so a failure here
|
|
12
|
+
* never hides the upcoming demand.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export interface ForecastModelScore {
|
|
16
|
+
model: DemandForecastModel;
|
|
17
|
+
seasonLengthWeeks: number | null;
|
|
18
|
+
/** Mean absolute percentage error on weekly volume; 0.25 = 25%. */
|
|
19
|
+
mape: number | null;
|
|
20
|
+
holdoutWeeks: number;
|
|
21
|
+
selected: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ForecastModelChoice {
|
|
25
|
+
scopeType: 'LANE' | 'CUSTOMER';
|
|
26
|
+
scopeKey: string;
|
|
27
|
+
scopeLabel: string;
|
|
28
|
+
historyWeeks: number;
|
|
29
|
+
selectedModel: DemandForecastModel;
|
|
30
|
+
reason: string;
|
|
31
|
+
evaluatedAt: string;
|
|
32
|
+
candidates: ForecastModelScore[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface UseForecastModelChoicesResult {
|
|
36
|
+
laneChoices: ForecastModelChoice[];
|
|
37
|
+
customerChoices: ForecastModelChoice[];
|
|
38
|
+
isLoading: boolean;
|
|
39
|
+
error: Error | null;
|
|
40
|
+
refetch: () => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const CHOICE_FIELDS = `
|
|
44
|
+
scopeType
|
|
45
|
+
scopeKey
|
|
46
|
+
scopeLabel
|
|
47
|
+
historyWeeks
|
|
48
|
+
selectedModel
|
|
49
|
+
reason
|
|
50
|
+
evaluatedAt
|
|
51
|
+
candidates {
|
|
52
|
+
model
|
|
53
|
+
seasonLengthWeeks
|
|
54
|
+
mape
|
|
55
|
+
holdoutWeeks
|
|
56
|
+
selected
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
const MODEL_CHOICES_QUERY = `
|
|
61
|
+
query GetMovethewheelsForecastModelChoices($limit: Int!) {
|
|
62
|
+
laneChoices: demandForecastModelChoices(scopeType: LANE, limit: $limit) {
|
|
63
|
+
${CHOICE_FIELDS}
|
|
64
|
+
}
|
|
65
|
+
customerChoices: demandForecastModelChoices(scopeType: CUSTOMER, limit: $limit) {
|
|
66
|
+
${CHOICE_FIELDS}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export function useForecastModelChoices(limit = 5): UseForecastModelChoicesResult {
|
|
72
|
+
const { apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser } =
|
|
73
|
+
useMoveTheWheels();
|
|
74
|
+
const [laneChoices, setLaneChoices] = useState<ForecastModelChoice[]>([]);
|
|
75
|
+
const [customerChoices, setCustomerChoices] = useState<ForecastModelChoice[]>([]);
|
|
76
|
+
// Start in the loading state: the first fetch runs in an effect, and the
|
|
77
|
+
// panel must not flash "No forecasts yet" before it does.
|
|
78
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
79
|
+
const [error, setError] = useState<Error | null>(null);
|
|
80
|
+
// Only the latest request may update state, so a response that arrives
|
|
81
|
+
// after a workspace switch (or a newer refetch) is dropped.
|
|
82
|
+
const latestRequest = useRef(0);
|
|
83
|
+
|
|
84
|
+
const graphQLOptions = useMemo(
|
|
85
|
+
() => ({
|
|
86
|
+
apiGatewayUrl,
|
|
87
|
+
authToken,
|
|
88
|
+
workspaceToken,
|
|
89
|
+
workspaceId,
|
|
90
|
+
tenantId,
|
|
91
|
+
actorId: currentUser?.id,
|
|
92
|
+
}),
|
|
93
|
+
[apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser?.id]
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const load = useCallback(async () => {
|
|
97
|
+
const request = ++latestRequest.current;
|
|
98
|
+
setIsLoading(true);
|
|
99
|
+
setError(null);
|
|
100
|
+
try {
|
|
101
|
+
const data = await executeGraphQL<{
|
|
102
|
+
laneChoices: ForecastModelChoice[];
|
|
103
|
+
customerChoices: ForecastModelChoice[];
|
|
104
|
+
}>(graphQLOptions, MODEL_CHOICES_QUERY, { limit });
|
|
105
|
+
if (request !== latestRequest.current) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
setLaneChoices(data.laneChoices ?? []);
|
|
109
|
+
setCustomerChoices(data.customerChoices ?? []);
|
|
110
|
+
} catch (fetchError) {
|
|
111
|
+
if (request !== latestRequest.current) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
setError(
|
|
115
|
+
fetchError instanceof Error ? fetchError : new Error('Failed to load forecast models')
|
|
116
|
+
);
|
|
117
|
+
} finally {
|
|
118
|
+
if (request === latestRequest.current) {
|
|
119
|
+
setIsLoading(false);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, [graphQLOptions, limit]);
|
|
123
|
+
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
void load();
|
|
126
|
+
return () => {
|
|
127
|
+
// Invalidate the in-flight request when the options change or the
|
|
128
|
+
// panel unmounts.
|
|
129
|
+
latestRequest.current += 1;
|
|
130
|
+
};
|
|
131
|
+
}, [load]);
|
|
132
|
+
|
|
133
|
+
const refetch = useCallback(() => {
|
|
134
|
+
void load();
|
|
135
|
+
}, [load]);
|
|
136
|
+
|
|
137
|
+
return { laneChoices, customerChoices, isLoading, error, refetch };
|
|
138
|
+
}
|
|
@@ -14,6 +14,7 @@ import { Card, CardContent, CardHeader, CardTitle, Progress, Button } from '../c
|
|
|
14
14
|
import { TrendChart, VolumeBar, StatusDonut, type DonutSlice } from '../components/charts';
|
|
15
15
|
import { UpcomingDemandPanel } from '../components/UpcomingDemandPanel';
|
|
16
16
|
import { ScenarioPlanningPanel } from '../components/ScenarioPlanningPanel';
|
|
17
|
+
import { ForecastModelsPanel } from '../components/ForecastModelsPanel';
|
|
17
18
|
import { CarbonFootprintPanel } from '../components/CarbonFootprintPanel';
|
|
18
19
|
import { EmphasisPanel, PagePurpose } from '@burdenoff/fe-libs/ui';
|
|
19
20
|
import { useAnalytics, useOrderAnalytics, useFleetAnalytics } from '../hooks/useAnalytics';
|
|
@@ -142,8 +143,8 @@ export default function AnalyticsPage() {
|
|
|
142
143
|
</CardContent>
|
|
143
144
|
</Card>
|
|
144
145
|
|
|
145
|
-
{/* Upcoming demand (BOFF-4393) —
|
|
146
|
-
|
|
146
|
+
{/* Upcoming demand (BOFF-4393) — surfaces only when the workspace has
|
|
147
|
+
enough history (>=4 weeks); see ForecastModelsPanel for the model. */}
|
|
147
148
|
<UpcomingDemandPanel
|
|
148
149
|
laneForecast={laneForecast}
|
|
149
150
|
customerForecast={customerForecast}
|
|
@@ -154,6 +155,10 @@ export default function AnalyticsPage() {
|
|
|
154
155
|
onRetry={refetchForecast}
|
|
155
156
|
/>
|
|
156
157
|
|
|
158
|
+
{/* Forecast models (BOFF-10925) — which model forecasts each lane and
|
|
159
|
+
customer, with the back-test errors behind the choice. */}
|
|
160
|
+
<ForecastModelsPanel />
|
|
161
|
+
|
|
157
162
|
{/* Scenario planning and capacity vs demand (BOFF-10761) — what-if
|
|
158
163
|
scenarios on the lane forecast compared against fleet capacity. */}
|
|
159
164
|
<ScenarioPlanningPanel />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Demand forecasting (BOFF-4393) — query operations against the
|
|
1
|
+
# Demand forecasting (BOFF-4393, BOFF-10925) — query operations against the
|
|
2
2
|
# wspace-movethewheels-svc DemandForecast surface. Read-side only on the
|
|
3
3
|
# UI; recalculation is triggered from the admin console via a separate
|
|
4
4
|
# mutation that is not wired into the MFE yet.
|
|
@@ -15,6 +15,7 @@ query GetMovethewheelsDemandForecastByLane($weeks: Int!) {
|
|
|
15
15
|
actualVolume
|
|
16
16
|
actualRevenue
|
|
17
17
|
confidence
|
|
18
|
+
model
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -30,6 +31,7 @@ query GetMovethewheelsDemandForecastByCustomer($weeks: Int!) {
|
|
|
30
31
|
actualVolume
|
|
31
32
|
actualRevenue
|
|
32
33
|
confidence
|
|
34
|
+
model
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -48,3 +50,22 @@ query GetMovethewheelsDemandForecastVariance($scopeType: DemandForecastScope!, $
|
|
|
48
50
|
revenueVariance
|
|
49
51
|
}
|
|
50
52
|
}
|
|
53
|
+
|
|
54
|
+
query GetMovethewheelsDemandForecastModelChoices($scopeType: DemandForecastScope!, $limit: Int!) {
|
|
55
|
+
demandForecastModelChoices(scopeType: $scopeType, limit: $limit) {
|
|
56
|
+
scopeType
|
|
57
|
+
scopeKey
|
|
58
|
+
scopeLabel
|
|
59
|
+
historyWeeks
|
|
60
|
+
selectedModel
|
|
61
|
+
reason
|
|
62
|
+
evaluatedAt
|
|
63
|
+
candidates {
|
|
64
|
+
model
|
|
65
|
+
seasonLengthWeeks
|
|
66
|
+
mape
|
|
67
|
+
holdoutWeeks
|
|
68
|
+
selected
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|