@burdenoff/microfe-movethewheels 2026.1108.1 → 2026.1108.3
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/DocumentsCard.js +183 -55
- 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 +3301 -144
- package/dist/hooks/useDemandForecast.js +1 -1
- package/dist/hooks/useDocumentExtractions.js +100 -0
- 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/useDocumentExtractions.d.ts +49 -0
- package/dist/movethewheels/hooks/useEntityDocuments.d.ts +5 -5
- package/dist/movethewheels/hooks/useForecastModelChoices.d.ts +34 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/file-search.js +24 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/sigma.js +8 -0
- package/dist/pages/AnalyticsPage.js +83 -81
- package/dist/pages/MultiModalShipmentPage.js +125 -121
- package/dist/pages/RouteDetailsPage.js +212 -207
- package/package.json +1 -1
- package/src/generated/wspace-operations.ts +13 -4
- package/src/generated/wspace-types.ts +3623 -144
- package/src/movethewheels/components/DocumentsCard.tsx +174 -29
- 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/useDocumentExtractions.ts +246 -0
- package/src/movethewheels/hooks/useEntityDocuments.ts +5 -5
- package/src/movethewheels/hooks/useForecastModelChoices.ts +138 -0
- package/src/movethewheels/pages/AnalyticsPage.tsx +7 -2
- package/src/movethewheels/pages/MultiModalShipmentPage.tsx +2 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +2 -0
- package/src/operations/wspace/movethewheels/queries/forecast.graphql +22 -1
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useDocumentExtractions — freight document intelligence (BOFF-3892).
|
|
3
|
+
*
|
|
4
|
+
* Lists the extraction runs a platform File has been through and drives the
|
|
5
|
+
* two mutations: mtwExtractDocument (vision model proposes typed fields with
|
|
6
|
+
* per-field confidence, metered on the shared AI runtime) and
|
|
7
|
+
* mtwApplyDocumentExtraction (a human accepts fields per-field; the mapped
|
|
8
|
+
* writes — POD delivery event, invoice comparison, BOL tracking number —
|
|
9
|
+
* happen only then, once each).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { useMoveTheWheels } from '../providers/MoveTheWheelsProvider';
|
|
14
|
+
import { executeGraphQL } from '../utils/graphqlClient';
|
|
15
|
+
|
|
16
|
+
export type DocumentType =
|
|
17
|
+
'BILL_OF_LADING' | 'PROOF_OF_DELIVERY' | 'CARRIER_INVOICE' | 'PACKING_LIST';
|
|
18
|
+
|
|
19
|
+
export const DOCUMENT_TYPE_OPTIONS: ReadonlyArray<{ value: DocumentType; label: string }> = [
|
|
20
|
+
{ value: 'BILL_OF_LADING', label: 'Bill of lading' },
|
|
21
|
+
{ value: 'PROOF_OF_DELIVERY', label: 'Proof of delivery' },
|
|
22
|
+
{ value: 'CARRIER_INVOICE', label: 'Carrier invoice' },
|
|
23
|
+
{ value: 'PACKING_LIST', label: 'Packing list' },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export interface ExtractionField {
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
value: string | null;
|
|
30
|
+
confidence: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface DocumentExtraction {
|
|
34
|
+
id: string;
|
|
35
|
+
fileId: string;
|
|
36
|
+
docType: DocumentType;
|
|
37
|
+
status: 'PROPOSED' | 'PARTIALLY_APPLIED' | 'APPLIED';
|
|
38
|
+
fields: ExtractionField[];
|
|
39
|
+
acceptedFields: string[];
|
|
40
|
+
shipmentId: string | null;
|
|
41
|
+
model: string;
|
|
42
|
+
costMicroUsd: string | null;
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
appliedAt: Date | null;
|
|
45
|
+
appliedBy: string | null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ApiExtraction {
|
|
49
|
+
id: string;
|
|
50
|
+
fileId: string;
|
|
51
|
+
docType: DocumentType;
|
|
52
|
+
status: DocumentExtraction['status'];
|
|
53
|
+
fields: ExtractionField[];
|
|
54
|
+
acceptedFields: string[];
|
|
55
|
+
shipmentId: string | null;
|
|
56
|
+
model: string;
|
|
57
|
+
costMicroUsd: string | null;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
appliedAt: string | null;
|
|
60
|
+
appliedBy: string | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const LIST_QUERY = `
|
|
64
|
+
query MtwDocumentExtractions($fileId: ID!) {
|
|
65
|
+
mtwDocumentExtractions(fileId: $fileId) {
|
|
66
|
+
id
|
|
67
|
+
fileId
|
|
68
|
+
docType
|
|
69
|
+
status
|
|
70
|
+
fields { key label value confidence }
|
|
71
|
+
acceptedFields
|
|
72
|
+
shipmentId
|
|
73
|
+
model
|
|
74
|
+
costMicroUsd
|
|
75
|
+
createdAt
|
|
76
|
+
appliedAt
|
|
77
|
+
appliedBy
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
const EXTRACT_MUTATION = `
|
|
83
|
+
mutation MtwExtractDocument($fileId: ID!, $docType: MtwDocumentType!) {
|
|
84
|
+
mtwExtractDocument(fileId: $fileId, docType: $docType) {
|
|
85
|
+
id
|
|
86
|
+
fileId
|
|
87
|
+
docType
|
|
88
|
+
status
|
|
89
|
+
fields { key label value confidence }
|
|
90
|
+
acceptedFields
|
|
91
|
+
shipmentId
|
|
92
|
+
model
|
|
93
|
+
costMicroUsd
|
|
94
|
+
createdAt
|
|
95
|
+
appliedAt
|
|
96
|
+
appliedBy
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
const APPLY_MUTATION = `
|
|
102
|
+
mutation MtwApplyDocumentExtraction($extractionId: ID!, $accept: [String!]!, $corrections: [MtwExtractionCorrectionInput!]) {
|
|
103
|
+
mtwApplyDocumentExtraction(extractionId: $extractionId, accept: $accept, corrections: $corrections) {
|
|
104
|
+
id
|
|
105
|
+
status
|
|
106
|
+
fields { key label value confidence }
|
|
107
|
+
acceptedFields
|
|
108
|
+
appliedAt
|
|
109
|
+
appliedBy
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
|
|
114
|
+
function mapExtraction(raw: ApiExtraction): DocumentExtraction {
|
|
115
|
+
return {
|
|
116
|
+
...raw,
|
|
117
|
+
createdAt: new Date(raw.createdAt),
|
|
118
|
+
appliedAt: raw.appliedAt ? new Date(raw.appliedAt) : null,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface UseDocumentExtractionsResult {
|
|
123
|
+
extractions: DocumentExtraction[];
|
|
124
|
+
isLoading: boolean;
|
|
125
|
+
error: string | null;
|
|
126
|
+
extracting: boolean;
|
|
127
|
+
extractError: string | null;
|
|
128
|
+
extract: (fileId: string, docType: DocumentType) => Promise<DocumentExtraction | null>;
|
|
129
|
+
apply: (
|
|
130
|
+
extractionId: string,
|
|
131
|
+
accept: string[],
|
|
132
|
+
corrections: Array<{ key: string; value: string }> | null
|
|
133
|
+
) => Promise<boolean>;
|
|
134
|
+
refetch: () => void;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function useDocumentExtractions(fileId: string | undefined): UseDocumentExtractionsResult {
|
|
138
|
+
const { apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser } =
|
|
139
|
+
useMoveTheWheels();
|
|
140
|
+
const [extractions, setExtractions] = useState<DocumentExtraction[]>([]);
|
|
141
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
142
|
+
const [error, setError] = useState<string | null>(null);
|
|
143
|
+
const [extracting, setExtracting] = useState(false);
|
|
144
|
+
const [extractError, setExtractError] = useState<string | null>(null);
|
|
145
|
+
|
|
146
|
+
const graphQLOptions = useMemo(
|
|
147
|
+
() => ({
|
|
148
|
+
apiGatewayUrl,
|
|
149
|
+
authToken,
|
|
150
|
+
workspaceToken,
|
|
151
|
+
workspaceId,
|
|
152
|
+
tenantId,
|
|
153
|
+
actorId: currentUser?.id,
|
|
154
|
+
}),
|
|
155
|
+
[apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser?.id]
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const load = useCallback(async () => {
|
|
159
|
+
if (!fileId) {
|
|
160
|
+
setExtractions([]);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
setIsLoading(true);
|
|
164
|
+
setError(null);
|
|
165
|
+
try {
|
|
166
|
+
const data = await executeGraphQL<{ mtwDocumentExtractions: ApiExtraction[] }>(
|
|
167
|
+
graphQLOptions,
|
|
168
|
+
LIST_QUERY,
|
|
169
|
+
{ fileId }
|
|
170
|
+
);
|
|
171
|
+
setExtractions((data.mtwDocumentExtractions ?? []).map(mapExtraction));
|
|
172
|
+
} catch (loadError) {
|
|
173
|
+
setError(loadError instanceof Error ? loadError.message : 'Failed to load extractions');
|
|
174
|
+
setExtractions([]);
|
|
175
|
+
} finally {
|
|
176
|
+
setIsLoading(false);
|
|
177
|
+
}
|
|
178
|
+
}, [fileId, graphQLOptions]);
|
|
179
|
+
|
|
180
|
+
useEffect(() => {
|
|
181
|
+
void load();
|
|
182
|
+
}, [load]);
|
|
183
|
+
|
|
184
|
+
const extract = useCallback(
|
|
185
|
+
async (targetFileId: string, docType: DocumentType): Promise<DocumentExtraction | null> => {
|
|
186
|
+
setExtracting(true);
|
|
187
|
+
setExtractError(null);
|
|
188
|
+
try {
|
|
189
|
+
const data = await executeGraphQL<{ mtwExtractDocument: ApiExtraction }>(
|
|
190
|
+
graphQLOptions,
|
|
191
|
+
EXTRACT_MUTATION,
|
|
192
|
+
{ fileId: targetFileId, docType }
|
|
193
|
+
);
|
|
194
|
+
const created = mapExtraction(data.mtwExtractDocument);
|
|
195
|
+
setExtractions((previous) => [
|
|
196
|
+
created,
|
|
197
|
+
...previous.filter((item) => item.id !== created.id),
|
|
198
|
+
]);
|
|
199
|
+
return created;
|
|
200
|
+
} catch (extractFailure) {
|
|
201
|
+
setExtractError(
|
|
202
|
+
extractFailure instanceof Error ? extractFailure.message : 'Extraction failed'
|
|
203
|
+
);
|
|
204
|
+
return null;
|
|
205
|
+
} finally {
|
|
206
|
+
setExtracting(false);
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
[graphQLOptions]
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
const apply = useCallback(
|
|
213
|
+
async (
|
|
214
|
+
extractionId: string,
|
|
215
|
+
accept: string[],
|
|
216
|
+
corrections: Array<{ key: string; value: string }> | null
|
|
217
|
+
): Promise<boolean> => {
|
|
218
|
+
try {
|
|
219
|
+
const data = await executeGraphQL<{ mtwApplyDocumentExtraction: ApiExtraction }>(
|
|
220
|
+
graphQLOptions,
|
|
221
|
+
APPLY_MUTATION,
|
|
222
|
+
{ extractionId, accept, corrections }
|
|
223
|
+
);
|
|
224
|
+
const updated = mapExtraction(data.mtwApplyDocumentExtraction);
|
|
225
|
+
setExtractions((previous) =>
|
|
226
|
+
previous.map((item) => (item.id === updated.id ? { ...item, ...updated } : item))
|
|
227
|
+
);
|
|
228
|
+
return true;
|
|
229
|
+
} catch {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
[graphQLOptions]
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
return {
|
|
237
|
+
extractions,
|
|
238
|
+
isLoading,
|
|
239
|
+
error,
|
|
240
|
+
extracting,
|
|
241
|
+
extractError,
|
|
242
|
+
extract,
|
|
243
|
+
apply,
|
|
244
|
+
refetch: () => void load(),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* useEntityDocuments — real document listing via wspace-files-svc.
|
|
3
3
|
*
|
|
4
4
|
* MoveTheWheels does NOT own a Document model. Documents attached to a vehicle,
|
|
5
|
-
* driver or
|
|
6
|
-
* federates into the same workspace gateway. We tag
|
|
7
|
-
* marqueue entity tags — `mtwEntityType` and
|
|
8
|
-
* here through `getFiles(filter:{ tags:[...] })`.
|
|
5
|
+
* driver, order, shipment or route live in the platform Files module
|
|
6
|
+
* (wspace-files-svc), which federates into the same workspace gateway. We tag
|
|
7
|
+
* each uploaded file with two marqueue entity tags — `mtwEntityType` and
|
|
8
|
+
* `mtwEntityId` — and list them back here through `getFiles(filter:{ tags:[...] })`.
|
|
9
9
|
*
|
|
10
10
|
* There is no upload UI here (out of scope): uploading/managing happens in the
|
|
11
11
|
* Files module, deep-linked from DocumentsCard. This hook is read-only.
|
|
@@ -31,7 +31,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
31
31
|
import { useMoveTheWheels } from '../providers/MoveTheWheelsProvider';
|
|
32
32
|
import { executeGraphQL } from '../utils/graphqlClient';
|
|
33
33
|
|
|
34
|
-
export type EntityDocumentType = 'vehicle' | 'driver' | 'order';
|
|
34
|
+
export type EntityDocumentType = 'vehicle' | 'driver' | 'order' | 'shipment' | 'route';
|
|
35
35
|
|
|
36
36
|
export interface EntityDocument {
|
|
37
37
|
id: string;
|
|
@@ -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 />
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from 'lucide-react';
|
|
21
21
|
import { PageLayout, PageSection, EmptyState, LoadingState } from '../components/PageLayout';
|
|
22
22
|
import { FormError } from '../components/FormError';
|
|
23
|
+
import { DocumentsCard } from '../components/DocumentsCard';
|
|
23
24
|
import {
|
|
24
25
|
Card,
|
|
25
26
|
CardContent,
|
|
@@ -578,6 +579,7 @@ export default function MultiModalShipmentPage() {
|
|
|
578
579
|
);
|
|
579
580
|
})}
|
|
580
581
|
</div>
|
|
582
|
+
<DocumentsCard entityType="shipment" entityId={shipment.id} />
|
|
581
583
|
</CardContent>
|
|
582
584
|
</Card>
|
|
583
585
|
))}
|
|
@@ -51,6 +51,7 @@ import { RouteMap, type RouteStop as MapRouteStop } from '../components/maps';
|
|
|
51
51
|
import { firstRealLatLng } from '../utils/mapMarkers';
|
|
52
52
|
import { EntityCombobox } from '../components/EntityCombobox';
|
|
53
53
|
import { useRoute, useRoutes } from '../hooks/useRoutes';
|
|
54
|
+
import { DocumentsCard } from '../components/DocumentsCard';
|
|
54
55
|
import { useVehicles, useVehicle, useDrivers, useDriver } from '../hooks/useFleet';
|
|
55
56
|
import { useAssignmentSuggestions } from '../hooks/useFleetIntelligence';
|
|
56
57
|
import { useRefetchOnLeaveEdit } from '../hooks/useRefetchOnLeaveEdit';
|
|
@@ -702,6 +703,7 @@ export default function RouteDetailsPage() {
|
|
|
702
703
|
</div>
|
|
703
704
|
|
|
704
705
|
<div className="space-y-6">
|
|
706
|
+
<DocumentsCard entityType="route" entityId={route.id} />
|
|
705
707
|
{(route.status === 'planned' || route.status === 'in_progress') && (
|
|
706
708
|
<AssignmentSuggestions
|
|
707
709
|
suggestions={suggestions.data}
|
|
@@ -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
|
+
}
|