assignment-user-matcher 1.16.0 → 1.22.0
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/README.md +312 -20
- package/dist/escalation/policy.d.ts +11 -0
- package/dist/escalation/policy.d.ts.map +1 -1
- package/dist/escalation/policy.js +22 -1
- package/dist/forecasting/backtest.d.ts +52 -0
- package/dist/forecasting/backtest.d.ts.map +1 -0
- package/dist/forecasting/backtest.js +195 -0
- package/dist/forecasting/calendar.d.ts +44 -0
- package/dist/forecasting/calendar.d.ts.map +1 -0
- package/dist/forecasting/calendar.js +85 -0
- package/dist/forecasting/cover.d.ts +69 -0
- package/dist/forecasting/cover.d.ts.map +1 -0
- package/dist/forecasting/cover.js +103 -0
- package/dist/forecasting/days.d.ts +17 -0
- package/dist/forecasting/days.d.ts.map +1 -0
- package/dist/forecasting/days.js +35 -0
- package/dist/forecasting/distributions.d.ts +31 -0
- package/dist/forecasting/distributions.d.ts.map +1 -0
- package/dist/forecasting/distributions.js +154 -0
- package/dist/forecasting/effects.d.ts +88 -0
- package/dist/forecasting/effects.d.ts.map +1 -0
- package/dist/forecasting/effects.js +303 -0
- package/dist/forecasting/erlang.d.ts +31 -0
- package/dist/forecasting/erlang.d.ts.map +1 -0
- package/dist/forecasting/erlang.js +86 -0
- package/dist/forecasting/forecast.d.ts +7 -0
- package/dist/forecasting/forecast.d.ts.map +1 -0
- package/dist/forecasting/forecast.js +221 -0
- package/dist/forecasting/index.d.ts +18 -0
- package/dist/forecasting/index.d.ts.map +1 -0
- package/dist/forecasting/index.js +54 -0
- package/dist/forecasting/model.d.ts +145 -0
- package/dist/forecasting/model.d.ts.map +1 -0
- package/dist/forecasting/model.js +583 -0
- package/dist/forecasting/nowcast.d.ts +26 -0
- package/dist/forecasting/nowcast.d.ts.map +1 -0
- package/dist/forecasting/nowcast.js +92 -0
- package/dist/forecasting/simulation.d.ts +91 -0
- package/dist/forecasting/simulation.d.ts.map +1 -0
- package/dist/forecasting/simulation.js +478 -0
- package/dist/forecasting/spikes.d.ts +6 -0
- package/dist/forecasting/spikes.d.ts.map +1 -0
- package/dist/forecasting/spikes.js +73 -0
- package/dist/forecasting/staffing.d.ts +64 -0
- package/dist/forecasting/staffing.d.ts.map +1 -0
- package/dist/forecasting/staffing.js +765 -0
- package/dist/forecasting/stats.d.ts +11 -0
- package/dist/forecasting/stats.d.ts.map +1 -0
- package/dist/forecasting/stats.js +45 -0
- package/dist/forecasting/types.d.ts +299 -0
- package/dist/forecasting/types.d.ts.map +1 -0
- package/dist/forecasting/types.js +8 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/learning/auto-weights.d.ts +1 -5
- package/dist/learning/auto-weights.d.ts.map +1 -1
- package/dist/learning/auto-weights.js +0 -3
- package/dist/lua/book-slot.lua +84 -0
- package/dist/lua/claim-queued.lua +47 -0
- package/dist/managers/DecisionTraceManager.d.ts +15 -0
- package/dist/managers/DecisionTraceManager.d.ts.map +1 -1
- package/dist/managers/DecisionTraceManager.js +117 -11
- package/dist/managers/LearningManager.d.ts +12 -0
- package/dist/managers/LearningManager.d.ts.map +1 -1
- package/dist/managers/LearningManager.js +21 -7
- package/dist/managers/ReliabilityManager.d.ts +1 -2
- package/dist/managers/ReliabilityManager.d.ts.map +1 -1
- package/dist/managers/ReliabilityManager.js +1 -1
- package/dist/managers/TelemetryManager.d.ts.map +1 -1
- package/dist/managers/TelemetryManager.js +9 -3
- package/dist/managers/WorkflowManager.d.ts.map +1 -1
- package/dist/managers/WorkflowManager.js +3 -4
- package/dist/matcher.class.d.ts +319 -4
- package/dist/matcher.class.d.ts.map +1 -1
- package/dist/matcher.class.js +1428 -102
- package/dist/queries/lane-stats.d.ts +51 -0
- package/dist/queries/lane-stats.d.ts.map +1 -0
- package/dist/queries/lane-stats.js +78 -0
- package/dist/schedule/recurrence.d.ts +11 -0
- package/dist/schedule/recurrence.d.ts.map +1 -1
- package/dist/schedule/recurrence.js +19 -2
- package/dist/schedule/slot.d.ts +60 -0
- package/dist/schedule/slot.d.ts.map +1 -0
- package/dist/schedule/slot.js +86 -0
- package/dist/scheduling/constraints/availability.d.ts +2 -14
- package/dist/scheduling/constraints/availability.d.ts.map +1 -1
- package/dist/scheduling/constraints/availability.js +14 -15
- package/dist/scheduling/constraints/consecutive.d.ts +10 -0
- package/dist/scheduling/constraints/consecutive.d.ts.map +1 -1
- package/dist/scheduling/constraints/consecutive.js +64 -1
- package/dist/scheduling/constraints/contract.d.ts.map +1 -1
- package/dist/scheduling/constraints/contract.js +12 -3
- package/dist/scheduling/constraints/employee-scope.d.ts.map +1 -1
- package/dist/scheduling/constraints/employee-scope.js +10 -2
- package/dist/scheduling/constraints/group-composition.js +2 -2
- package/dist/scheduling/constraints/min-staffing.d.ts.map +1 -1
- package/dist/scheduling/constraints/min-staffing.js +51 -8
- package/dist/scheduling/constraints/rolling-hours.d.ts.map +1 -1
- package/dist/scheduling/constraints/rolling-hours.js +29 -4
- package/dist/scheduling/constraints/support.d.ts +4 -8
- package/dist/scheduling/constraints/support.d.ts.map +1 -1
- package/dist/scheduling/constraints/support.js +23 -2
- package/dist/scheduling/constraints/weekly-rest.d.ts +28 -0
- package/dist/scheduling/constraints/weekly-rest.d.ts.map +1 -1
- package/dist/scheduling/constraints/weekly-rest.js +108 -21
- package/dist/scheduling/engine/construction.d.ts.map +1 -1
- package/dist/scheduling/engine/construction.js +56 -7
- package/dist/scheduling/engine/objective.d.ts +0 -1
- package/dist/scheduling/engine/objective.d.ts.map +1 -1
- package/dist/scheduling/engine/objective.js +65 -6
- package/dist/scheduling/engine/search.d.ts +4 -0
- package/dist/scheduling/engine/search.d.ts.map +1 -1
- package/dist/scheduling/engine/search.js +2 -1
- package/dist/scheduling/engine/state.d.ts +14 -0
- package/dist/scheduling/engine/state.d.ts.map +1 -1
- package/dist/scheduling/engine/state.js +7 -0
- package/dist/scheduling/engine/timeline.d.ts +23 -1
- package/dist/scheduling/engine/timeline.d.ts.map +1 -1
- package/dist/scheduling/engine/timeline.js +85 -27
- package/dist/scheduling/engine/verdicts.d.ts +40 -1
- package/dist/scheduling/engine/verdicts.d.ts.map +1 -1
- package/dist/scheduling/engine/verdicts.js +177 -17
- package/dist/scheduling/index.d.ts +3 -2
- package/dist/scheduling/index.d.ts.map +1 -1
- package/dist/scheduling/index.js +7 -1
- package/dist/scheduling/model.d.ts +8 -4
- package/dist/scheduling/model.d.ts.map +1 -1
- package/dist/scheduling/model.js +239 -23
- package/dist/scheduling/operations.d.ts +174 -2
- package/dist/scheduling/operations.d.ts.map +1 -1
- package/dist/scheduling/operations.js +558 -21
- package/dist/scheduling/preference-report.d.ts +15 -0
- package/dist/scheduling/preference-report.d.ts.map +1 -0
- package/dist/scheduling/preference-report.js +111 -0
- package/dist/scheduling/preferences.d.ts +30 -0
- package/dist/scheduling/preferences.d.ts.map +1 -0
- package/dist/scheduling/preferences.js +85 -0
- package/dist/scheduling/resilience.d.ts +46 -0
- package/dist/scheduling/resilience.d.ts.map +1 -0
- package/dist/scheduling/resilience.js +45 -0
- package/dist/scheduling/scheduler.class.d.ts +12 -1
- package/dist/scheduling/scheduler.class.d.ts.map +1 -1
- package/dist/scheduling/scheduler.class.js +28 -4
- package/dist/scheduling/sites.d.ts +1 -1
- package/dist/scheduling/sites.d.ts.map +1 -1
- package/dist/scheduling/sites.js +34 -1
- package/dist/scheduling/time.d.ts +28 -6
- package/dist/scheduling/time.d.ts.map +1 -1
- package/dist/scheduling/time.js +59 -17
- package/dist/scheduling/types.d.ts +247 -7
- package/dist/scheduling/types.d.ts.map +1 -1
- package/dist/scoring/fair-arbitration.d.ts.map +1 -1
- package/dist/scoring/fair-arbitration.js +2 -1
- package/dist/tracing/decision-trace.d.ts +5 -0
- package/dist/tracing/decision-trace.d.ts.map +1 -1
- package/dist/tracing/decision-trace.js +3 -0
- package/dist/types/matcher.d.ts +369 -2
- package/dist/types/matcher.d.ts.map +1 -1
- package/dist/updates/assignment-update.d.ts +93 -0
- package/dist/updates/assignment-update.d.ts.map +1 -0
- package/dist/updates/assignment-update.js +91 -0
- package/dist/utils/keys.d.ts +10 -0
- package/dist/utils/keys.d.ts.map +1 -1
- package/dist/utils/keys.js +43 -0
- package/package.json +25 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forecast.d.ts","sourceRoot":"","sources":["../../src/forecasting/forecast.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAA8C,MAAM,SAAS,CAAC;AAG3H,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAM1C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,uBAAuB,CAqDxF"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forecastWorkspace = exports.DEFAULT_BACKTEST_SERIES = exports.DEFAULT_BACKTEST_ORIGINS = exports.DEFAULT_HORIZON_WEEKS = exports.DEFAULT_HORIZON_HOURS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* `forecastWorkspace` — every series of one workspace, forecast hourly for the
|
|
6
|
+
* next weeks and weekly out to six months, with ranges from its own backtests,
|
|
7
|
+
* its accuracy, the effects it learned, and the recent spikes nobody has
|
|
8
|
+
* explained. Deterministic: the same history, occurrences and `now` give the
|
|
9
|
+
* same numbers.
|
|
10
|
+
*
|
|
11
|
+
* Everything shown by local date is a sum of `projectHour` over that date's
|
|
12
|
+
* local hours (`projectDay`, the same sum in closed form) — a week row is its
|
|
13
|
+
* 167, 168 or 169 hours added up, with the nowcast its hours carry — so the
|
|
14
|
+
* hours and the weeks a planner reads can never disagree.
|
|
15
|
+
*
|
|
16
|
+
* Callers should always pass the workspace total (`totalSeries`, default
|
|
17
|
+
* `'*'`): it is the series spikes are found on, and the one whose backtested
|
|
18
|
+
* ranges the long tail of series outside the busiest few borrows. Without it
|
|
19
|
+
* every series pays for its own backtests and there is no "What was this?".
|
|
20
|
+
*/
|
|
21
|
+
const backtest_1 = require("./backtest");
|
|
22
|
+
const calendar_1 = require("./calendar");
|
|
23
|
+
const days_1 = require("./days");
|
|
24
|
+
const effects_1 = require("./effects");
|
|
25
|
+
const model_1 = require("./model");
|
|
26
|
+
const nowcast_1 = require("./nowcast");
|
|
27
|
+
const spikes_1 = require("./spikes");
|
|
28
|
+
const stats_1 = require("./stats");
|
|
29
|
+
exports.DEFAULT_HORIZON_HOURS = 672;
|
|
30
|
+
exports.DEFAULT_HORIZON_WEEKS = 26;
|
|
31
|
+
exports.DEFAULT_BACKTEST_ORIGINS = 6;
|
|
32
|
+
exports.DEFAULT_BACKTEST_SERIES = 10;
|
|
33
|
+
/** One-sided z for p10/p90 under Poisson noise: the range is never narrower than counting noise. */
|
|
34
|
+
const Z90 = 1.2816;
|
|
35
|
+
/** Under this many complete weeks of history the forecast is low confidence. */
|
|
36
|
+
const SHORT_HISTORY_WEEKS = 4;
|
|
37
|
+
function forecastWorkspace(input) {
|
|
38
|
+
const started = Date.now();
|
|
39
|
+
const horizonHours = input.horizonHours ?? exports.DEFAULT_HORIZON_HOURS;
|
|
40
|
+
const horizonWeeks = input.horizonWeeks ?? exports.DEFAULT_HORIZON_WEEKS;
|
|
41
|
+
const origins = input.backtestOrigins ?? exports.DEFAULT_BACKTEST_ORIGINS;
|
|
42
|
+
const occurrences = (0, effects_1.prepareOccurrences)(input.occurrences ?? []);
|
|
43
|
+
const prepared = input.series.map(model_1.prepareHistory);
|
|
44
|
+
// The calendar reads hours from the shape window before the earliest
|
|
45
|
+
// backtest origin to the end of the hourly or weekly horizon, whichever is later.
|
|
46
|
+
const calendar = new calendar_1.ForecastCalendar(input.timeZone, input.now - (origins * 7 + 8 * 7 + 2) * days_1.DAY_MS, input.now + Math.max((horizonHours + 48) * calendar_1.HOUR_MS, (horizonWeeks * 7 + 9) * days_1.DAY_MS));
|
|
47
|
+
const totalName = input.totalSeries ?? '*';
|
|
48
|
+
// Backtests are most of the cost: the total and the busiest series get
|
|
49
|
+
// their own, the long tail borrows the total's ranges.
|
|
50
|
+
const today = (0, days_1.utcDay)(input.now);
|
|
51
|
+
const recent = (h) => {
|
|
52
|
+
let sum = 0;
|
|
53
|
+
for (let d = today - 28; d < today; d++)
|
|
54
|
+
sum += h.daily[d - h.firstDay] ?? 0;
|
|
55
|
+
return sum;
|
|
56
|
+
};
|
|
57
|
+
const busiest = new Set(prepared
|
|
58
|
+
.filter((h) => h.series !== totalName)
|
|
59
|
+
.sort((a, b) => recent(b) - recent(a) || a.series.localeCompare(b.series))
|
|
60
|
+
.slice(0, input.backtestSeries ?? exports.DEFAULT_BACKTEST_SERIES)
|
|
61
|
+
.map((h) => h.series));
|
|
62
|
+
const own = (h) => (0, backtest_1.backtest)(h, occurrences, calendar, input.now, origins);
|
|
63
|
+
const totalHistory = prepared.find((h) => h.series === totalName);
|
|
64
|
+
const totalBacktest = totalHistory ? own(totalHistory) : null;
|
|
65
|
+
const fitted = [];
|
|
66
|
+
const series = prepared.map((history) => {
|
|
67
|
+
const model = (0, model_1.fitSeries)(history, occurrences, calendar, input.now);
|
|
68
|
+
fitted.push(model);
|
|
69
|
+
const bt = history === totalHistory && totalBacktest
|
|
70
|
+
? totalBacktest
|
|
71
|
+
: busiest.has(history.series) || !totalBacktest
|
|
72
|
+
? own(history)
|
|
73
|
+
: (0, backtest_1.borrowed)(totalBacktest);
|
|
74
|
+
return forecastOne(history, model, bt, calendar, input.now, horizonHours, horizonWeeks);
|
|
75
|
+
});
|
|
76
|
+
const total = fitted.find((m) => m.series === totalName);
|
|
77
|
+
const spikes = total
|
|
78
|
+
? (0, spikes_1.detectSpikes)(total, fitted.filter((m) => m !== total))
|
|
79
|
+
: [];
|
|
80
|
+
return { series, spikes, ms: Date.now() - started };
|
|
81
|
+
}
|
|
82
|
+
exports.forecastWorkspace = forecastWorkspace;
|
|
83
|
+
/**
|
|
84
|
+
* How far a local day's holidays could move volume from their factor, as
|
|
85
|
+
* multipliers on low and high. `projectHour` carries a holiday's factor only
|
|
86
|
+
* (`DayEffect.holiday`), so a first-time default holiday's 0.3–1.2 around 0.7
|
|
87
|
+
* would otherwise be missing from the range; a learned holiday's range is
|
|
88
|
+
* narrower and widens accordingly less.
|
|
89
|
+
*/
|
|
90
|
+
function holidaySpread(model, day) {
|
|
91
|
+
let factor = 1;
|
|
92
|
+
let low = 1;
|
|
93
|
+
let high = 1;
|
|
94
|
+
for (const [occ, effect] of model.effects) {
|
|
95
|
+
if (!occ.holiday || day < occ.from || day > occ.to)
|
|
96
|
+
continue;
|
|
97
|
+
const shape = effect.shape[Math.min(day - occ.from, effect.shape.length - 1)] ?? 1;
|
|
98
|
+
factor *= effect.size * shape;
|
|
99
|
+
low *= effect.low * shape;
|
|
100
|
+
high *= effect.high * shape;
|
|
101
|
+
}
|
|
102
|
+
// A closed holiday is zero, range and all: the multipliers do not matter.
|
|
103
|
+
if (factor <= 0)
|
|
104
|
+
return [1, 1];
|
|
105
|
+
return [Math.min(1, low / factor), Math.max(1, high / factor)];
|
|
106
|
+
}
|
|
107
|
+
function forecastOne(history, model, bt, calendar, now, horizonHours, horizonWeeks) {
|
|
108
|
+
const current = Math.floor(now / calendar_1.HOUR_MS) * calendar_1.HOUR_MS;
|
|
109
|
+
const today = calendar.slot(current);
|
|
110
|
+
const from = calendar.midnight(today.date);
|
|
111
|
+
const spreads = new Map();
|
|
112
|
+
const spreadOn = (day) => {
|
|
113
|
+
let spread = spreads.get(day);
|
|
114
|
+
if (!spread)
|
|
115
|
+
spreads.set(day, (spread = holidaySpread(model, day)));
|
|
116
|
+
return spread;
|
|
117
|
+
};
|
|
118
|
+
// Hourly bands: the event and holiday low/high, widened by a negative binomial p10/p90 whose relative
|
|
119
|
+
// model error `c` the backtests measured for the hour's lead — never narrower than Poisson noise.
|
|
120
|
+
const raw = [];
|
|
121
|
+
for (let h = 0; h < horizonHours; h++) {
|
|
122
|
+
const at = from + h * calendar_1.HOUR_MS;
|
|
123
|
+
const p = (0, model_1.projectHour)(model, calendar, at);
|
|
124
|
+
const c = bt.dispersion[(0, backtest_1.bucketOf)(Math.max(0, (at - current) / calendar_1.HOUR_MS))];
|
|
125
|
+
const [hl, hh] = spreadOn(calendar.slot(at).day);
|
|
126
|
+
const band = Z90 * Math.sqrt(p.likely + c * p.likely * p.likely);
|
|
127
|
+
raw.push({
|
|
128
|
+
at,
|
|
129
|
+
likely: (0, stats_1.round)(p.likely),
|
|
130
|
+
low: (0, stats_1.round)(Math.max(0, Math.min(p.low * hl, p.likely) - band)),
|
|
131
|
+
high: (0, stats_1.round)(Math.max(p.high * hh, p.likely) + band),
|
|
132
|
+
components: {
|
|
133
|
+
base: (0, stats_1.round)(p.components.base, 3),
|
|
134
|
+
trend: (0, stats_1.round)(p.components.trend, 4),
|
|
135
|
+
season: (0, stats_1.round)(p.components.season, 4),
|
|
136
|
+
holiday: (0, stats_1.round)(p.components.holiday, 4),
|
|
137
|
+
events: p.components.events.map((e) => ({ label: e.label, factor: (0, stats_1.round)(e.factor, 4) })),
|
|
138
|
+
nowcast: 1,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
// The nowcast reads today's drained hours only; a daily-only series, or an hourly feed more than three
|
|
143
|
+
// hours behind, gets none.
|
|
144
|
+
const hours = (0, nowcast_1.applyNowcast)(raw, history.hourlyPoints, now);
|
|
145
|
+
// What the nowcast added, per local day, so a week row carries the nowcast its hours carry.
|
|
146
|
+
const nowcastLift = new Map();
|
|
147
|
+
hours.forEach((h, i) => {
|
|
148
|
+
if (h.components.nowcast === 1)
|
|
149
|
+
return;
|
|
150
|
+
const day = calendar.slot(h.at).day;
|
|
151
|
+
nowcastLift.set(day, (nowcastLift.get(day) ?? 0) + h.likely - raw[i].likely);
|
|
152
|
+
});
|
|
153
|
+
const weeks = [];
|
|
154
|
+
const firstMonday = (0, days_1.mondayOfDay)(today.day);
|
|
155
|
+
const [lo, hi] = bt.weekRange;
|
|
156
|
+
for (let w = 0; w < horizonWeeks; w++) {
|
|
157
|
+
const monday = firstMonday + 7 * w;
|
|
158
|
+
let likely = 0;
|
|
159
|
+
let lift = 0;
|
|
160
|
+
let low = 0;
|
|
161
|
+
let high = 0;
|
|
162
|
+
const labels = new Set();
|
|
163
|
+
for (let d = monday; d < monday + 7; d++) {
|
|
164
|
+
const p = (0, model_1.projectDay)(model, calendar, d);
|
|
165
|
+
const [hl, hh] = spreadOn(d);
|
|
166
|
+
likely += p.likely;
|
|
167
|
+
low += p.low * hl;
|
|
168
|
+
high += p.high * hh;
|
|
169
|
+
lift += nowcastLift.get(d) ?? 0;
|
|
170
|
+
for (const e of (0, model_1.effectOn)(model, d).events)
|
|
171
|
+
labels.add(e.label);
|
|
172
|
+
}
|
|
173
|
+
const scale = likely > 0 ? (likely + lift) / likely : 1;
|
|
174
|
+
likely += lift;
|
|
175
|
+
low *= scale;
|
|
176
|
+
high *= scale;
|
|
177
|
+
// The weekly spread from backtests covers weeks 1–4; later weeks widen with √(weeks / 4). The
|
|
178
|
+
// negative binomial of weekly totals is the floor, as it is for hours.
|
|
179
|
+
const widen = Math.sqrt(Math.max(1, w / 4));
|
|
180
|
+
const band = Z90 * Math.sqrt(likely + bt.weekDispersion * widen * widen * likely * likely);
|
|
181
|
+
weeks.push({
|
|
182
|
+
weekStart: (0, days_1.dateOf)(monday),
|
|
183
|
+
likely: (0, stats_1.round)(likely, 1),
|
|
184
|
+
low: (0, stats_1.round)(Math.max(0, Math.min(low * (1 - (1 - lo) * widen), Math.min(low, likely) - band)), 1),
|
|
185
|
+
high: (0, stats_1.round)(Math.max(high * (1 + (hi - 1) * widen), Math.max(high, likely) + band), 1),
|
|
186
|
+
season: (0, stats_1.round)((0, model_1.seasonFor)(model, monday), 4),
|
|
187
|
+
events: [...labels],
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const reasons = [];
|
|
191
|
+
if (model.historyWeeks < SHORT_HISTORY_WEEKS)
|
|
192
|
+
reasons.push('short-history');
|
|
193
|
+
const wape72 = bt.accuracy.wape['72h'];
|
|
194
|
+
if (wape72 !== null && wape72 > backtest_1.HIGH_ERROR_WAPE)
|
|
195
|
+
reasons.push('high-error');
|
|
196
|
+
if (!model.hasHourlyShape)
|
|
197
|
+
reasons.push('no-hourly-shape');
|
|
198
|
+
const lastDay = Math.max(today.day + Math.ceil(horizonHours / 24), firstMonday + 7 * horizonWeeks);
|
|
199
|
+
for (const [occ, effect] of model.effects) {
|
|
200
|
+
if (effect.source !== 'default' || occ.holiday)
|
|
201
|
+
continue;
|
|
202
|
+
if (occ.to < today.day || occ.from > lastDay)
|
|
203
|
+
continue;
|
|
204
|
+
reasons.push(`first-time-event:${occ.o.label}`);
|
|
205
|
+
}
|
|
206
|
+
const unique = [...new Set(reasons)];
|
|
207
|
+
const effects = new Map();
|
|
208
|
+
for (const effect of [...model.effects.values(), ...model.learned.values()])
|
|
209
|
+
effects.set(effect.label, effect);
|
|
210
|
+
return {
|
|
211
|
+
series: history.series,
|
|
212
|
+
from,
|
|
213
|
+
hours,
|
|
214
|
+
weeks,
|
|
215
|
+
accuracy: { ...bt.accuracy, lowConfidence: unique.some((r) => r !== 'no-hourly-shape'), reasons: unique },
|
|
216
|
+
yearly: model.yearly !== null,
|
|
217
|
+
historyWeeks: model.historyWeeks,
|
|
218
|
+
hasHourlyShape: model.hasHourlyShape,
|
|
219
|
+
effects: [...effects.values()],
|
|
220
|
+
};
|
|
221
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the forecasting module (`assignment-user-matcher/forecasting`):
|
|
3
|
+
* work volume per series — forecast, explained and ranged — and the aggregate
|
|
4
|
+
* staffing it takes under the router's own rules. Pure, Redis-free and
|
|
5
|
+
* deterministic; nothing here predicts anything about a person.
|
|
6
|
+
*/
|
|
7
|
+
export { forecastWorkspace, DEFAULT_HORIZON_HOURS, DEFAULT_HORIZON_WEEKS, DEFAULT_BACKTEST_ORIGINS, DEFAULT_BACKTEST_SERIES, } from './forecast';
|
|
8
|
+
export { applyNowcast, nowcastRatio, NOWCAST_HOURS, NOWCAST_PRIOR, NOWCAST_MAX_LAG_HOURS } from './nowcast';
|
|
9
|
+
export { suggestEffect, DEFAULT_EFFECTS, KNOCK_ON_DAYS } from './effects';
|
|
10
|
+
export { YEARLY_MIN_WEEKS, OUTLIER } from './model';
|
|
11
|
+
export { HIGH_ERROR_WAPE, LEAD_BUCKETS } from './backtest';
|
|
12
|
+
export { SPIKE_LOOKBACK_DAYS } from './spikes';
|
|
13
|
+
export { ForecastCalendar, type LocalSlot } from './calendar';
|
|
14
|
+
export { staffingNeed, rateNeed, headcountNeed, quantize, DEFAULT_SEEDS, DEFAULT_OVERDISPERSION, DEFAULT_QUANTIZE, DEFAULT_MAX_PEOPLE, STAFFING_BUDGET, staffingBudgetMs, } from './staffing';
|
|
15
|
+
export { coverNeed, coverPersonHours, type CoverShift, type CoverResult, type CoverUnmet } from './cover';
|
|
16
|
+
export { exponentialQuantiles, meanOf, sampleQuantiles, assertDistribution } from './distributions';
|
|
17
|
+
export type { HourlyPoint, DailyPoint, SeriesHistory, KnownOccurrence, EffectSource, LearnedEffect, HourComponents, HourForecast, WeekForecast, LeadBucket, ForecastAccuracy, SeriesForecast, SpikeSpan, ForecastWorkspaceInput, ForecastWorkspaceResult, QuantileDistribution, TagProfile, PoolMember, StaffingInterval, StaffingOptions, Range, IntervalNeed, StaffingResult, } from './types';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forecasting/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACH,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,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", { value: true });
|
|
3
|
+
exports.assertDistribution = exports.sampleQuantiles = exports.meanOf = exports.exponentialQuantiles = exports.coverPersonHours = exports.coverNeed = exports.staffingBudgetMs = exports.STAFFING_BUDGET = exports.DEFAULT_MAX_PEOPLE = exports.DEFAULT_QUANTIZE = exports.DEFAULT_OVERDISPERSION = exports.DEFAULT_SEEDS = exports.quantize = exports.headcountNeed = exports.rateNeed = exports.staffingNeed = exports.ForecastCalendar = exports.SPIKE_LOOKBACK_DAYS = exports.LEAD_BUCKETS = exports.HIGH_ERROR_WAPE = exports.OUTLIER = exports.YEARLY_MIN_WEEKS = exports.KNOCK_ON_DAYS = exports.DEFAULT_EFFECTS = exports.suggestEffect = exports.NOWCAST_MAX_LAG_HOURS = exports.NOWCAST_PRIOR = exports.NOWCAST_HOURS = exports.nowcastRatio = exports.applyNowcast = exports.DEFAULT_BACKTEST_SERIES = exports.DEFAULT_BACKTEST_ORIGINS = exports.DEFAULT_HORIZON_WEEKS = exports.DEFAULT_HORIZON_HOURS = exports.forecastWorkspace = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Public surface of the forecasting module (`assignment-user-matcher/forecasting`):
|
|
6
|
+
* work volume per series — forecast, explained and ranged — and the aggregate
|
|
7
|
+
* staffing it takes under the router's own rules. Pure, Redis-free and
|
|
8
|
+
* deterministic; nothing here predicts anything about a person.
|
|
9
|
+
*/
|
|
10
|
+
var forecast_1 = require("./forecast");
|
|
11
|
+
Object.defineProperty(exports, "forecastWorkspace", { enumerable: true, get: function () { return forecast_1.forecastWorkspace; } });
|
|
12
|
+
Object.defineProperty(exports, "DEFAULT_HORIZON_HOURS", { enumerable: true, get: function () { return forecast_1.DEFAULT_HORIZON_HOURS; } });
|
|
13
|
+
Object.defineProperty(exports, "DEFAULT_HORIZON_WEEKS", { enumerable: true, get: function () { return forecast_1.DEFAULT_HORIZON_WEEKS; } });
|
|
14
|
+
Object.defineProperty(exports, "DEFAULT_BACKTEST_ORIGINS", { enumerable: true, get: function () { return forecast_1.DEFAULT_BACKTEST_ORIGINS; } });
|
|
15
|
+
Object.defineProperty(exports, "DEFAULT_BACKTEST_SERIES", { enumerable: true, get: function () { return forecast_1.DEFAULT_BACKTEST_SERIES; } });
|
|
16
|
+
var nowcast_1 = require("./nowcast");
|
|
17
|
+
Object.defineProperty(exports, "applyNowcast", { enumerable: true, get: function () { return nowcast_1.applyNowcast; } });
|
|
18
|
+
Object.defineProperty(exports, "nowcastRatio", { enumerable: true, get: function () { return nowcast_1.nowcastRatio; } });
|
|
19
|
+
Object.defineProperty(exports, "NOWCAST_HOURS", { enumerable: true, get: function () { return nowcast_1.NOWCAST_HOURS; } });
|
|
20
|
+
Object.defineProperty(exports, "NOWCAST_PRIOR", { enumerable: true, get: function () { return nowcast_1.NOWCAST_PRIOR; } });
|
|
21
|
+
Object.defineProperty(exports, "NOWCAST_MAX_LAG_HOURS", { enumerable: true, get: function () { return nowcast_1.NOWCAST_MAX_LAG_HOURS; } });
|
|
22
|
+
var effects_1 = require("./effects");
|
|
23
|
+
Object.defineProperty(exports, "suggestEffect", { enumerable: true, get: function () { return effects_1.suggestEffect; } });
|
|
24
|
+
Object.defineProperty(exports, "DEFAULT_EFFECTS", { enumerable: true, get: function () { return effects_1.DEFAULT_EFFECTS; } });
|
|
25
|
+
Object.defineProperty(exports, "KNOCK_ON_DAYS", { enumerable: true, get: function () { return effects_1.KNOCK_ON_DAYS; } });
|
|
26
|
+
var model_1 = require("./model");
|
|
27
|
+
Object.defineProperty(exports, "YEARLY_MIN_WEEKS", { enumerable: true, get: function () { return model_1.YEARLY_MIN_WEEKS; } });
|
|
28
|
+
Object.defineProperty(exports, "OUTLIER", { enumerable: true, get: function () { return model_1.OUTLIER; } });
|
|
29
|
+
var backtest_1 = require("./backtest");
|
|
30
|
+
Object.defineProperty(exports, "HIGH_ERROR_WAPE", { enumerable: true, get: function () { return backtest_1.HIGH_ERROR_WAPE; } });
|
|
31
|
+
Object.defineProperty(exports, "LEAD_BUCKETS", { enumerable: true, get: function () { return backtest_1.LEAD_BUCKETS; } });
|
|
32
|
+
var spikes_1 = require("./spikes");
|
|
33
|
+
Object.defineProperty(exports, "SPIKE_LOOKBACK_DAYS", { enumerable: true, get: function () { return spikes_1.SPIKE_LOOKBACK_DAYS; } });
|
|
34
|
+
var calendar_1 = require("./calendar");
|
|
35
|
+
Object.defineProperty(exports, "ForecastCalendar", { enumerable: true, get: function () { return calendar_1.ForecastCalendar; } });
|
|
36
|
+
var staffing_1 = require("./staffing");
|
|
37
|
+
Object.defineProperty(exports, "staffingNeed", { enumerable: true, get: function () { return staffing_1.staffingNeed; } });
|
|
38
|
+
Object.defineProperty(exports, "rateNeed", { enumerable: true, get: function () { return staffing_1.rateNeed; } });
|
|
39
|
+
Object.defineProperty(exports, "headcountNeed", { enumerable: true, get: function () { return staffing_1.headcountNeed; } });
|
|
40
|
+
Object.defineProperty(exports, "quantize", { enumerable: true, get: function () { return staffing_1.quantize; } });
|
|
41
|
+
Object.defineProperty(exports, "DEFAULT_SEEDS", { enumerable: true, get: function () { return staffing_1.DEFAULT_SEEDS; } });
|
|
42
|
+
Object.defineProperty(exports, "DEFAULT_OVERDISPERSION", { enumerable: true, get: function () { return staffing_1.DEFAULT_OVERDISPERSION; } });
|
|
43
|
+
Object.defineProperty(exports, "DEFAULT_QUANTIZE", { enumerable: true, get: function () { return staffing_1.DEFAULT_QUANTIZE; } });
|
|
44
|
+
Object.defineProperty(exports, "DEFAULT_MAX_PEOPLE", { enumerable: true, get: function () { return staffing_1.DEFAULT_MAX_PEOPLE; } });
|
|
45
|
+
Object.defineProperty(exports, "STAFFING_BUDGET", { enumerable: true, get: function () { return staffing_1.STAFFING_BUDGET; } });
|
|
46
|
+
Object.defineProperty(exports, "staffingBudgetMs", { enumerable: true, get: function () { return staffing_1.staffingBudgetMs; } });
|
|
47
|
+
var cover_1 = require("./cover");
|
|
48
|
+
Object.defineProperty(exports, "coverNeed", { enumerable: true, get: function () { return cover_1.coverNeed; } });
|
|
49
|
+
Object.defineProperty(exports, "coverPersonHours", { enumerable: true, get: function () { return cover_1.coverPersonHours; } });
|
|
50
|
+
var distributions_1 = require("./distributions");
|
|
51
|
+
Object.defineProperty(exports, "exponentialQuantiles", { enumerable: true, get: function () { return distributions_1.exponentialQuantiles; } });
|
|
52
|
+
Object.defineProperty(exports, "meanOf", { enumerable: true, get: function () { return distributions_1.meanOf; } });
|
|
53
|
+
Object.defineProperty(exports, "sampleQuantiles", { enumerable: true, get: function () { return distributions_1.sampleQuantiles; } });
|
|
54
|
+
Object.defineProperty(exports, "assertDistribution", { enumerable: true, get: function () { return distributions_1.assertDistribution; } });
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The forecast model for one series: a weekly level with a damped trend, a
|
|
3
|
+
* yearly factor once there is a year of history, the share of a week each
|
|
4
|
+
* weekday carries, the share of a day each hour carries, and the effects of
|
|
5
|
+
* holidays and events — each a plain number a planner can read back.
|
|
6
|
+
*
|
|
7
|
+
* Fitting reads only history strictly before `asOf`, so a rolling-origin
|
|
8
|
+
* backtest is the same function called with an earlier `asOf`.
|
|
9
|
+
*
|
|
10
|
+
* Grains: level, trend, the yearly factor and effects read the daily table's
|
|
11
|
+
* UTC days (`utcDayShare`, `expectedDay`); what an hour is forecast at reads
|
|
12
|
+
* local days (`dayShare` and `hourShape` from hourly history), since a UTC day
|
|
13
|
+
* is up to a day off a local one outside Europe. Shares are pooled ratios, not
|
|
14
|
+
* medians, so a sparse series keeps its quiet hours; learned effects and
|
|
15
|
+
* one-year yearly factors are shrunk towards 1 by their evidence.
|
|
16
|
+
*/
|
|
17
|
+
import { ForecastCalendar } from './calendar';
|
|
18
|
+
import { type DayEffect, type Occ } from './effects';
|
|
19
|
+
import type { HourComponents, LearnedEffect, SeriesHistory } from './types';
|
|
20
|
+
/** Level smoothing (recency weight), trend smoothing, trend damping per week. */
|
|
21
|
+
export declare const HOLT: {
|
|
22
|
+
readonly alpha: 0.35;
|
|
23
|
+
readonly beta: 0.1;
|
|
24
|
+
readonly phi: 0.9;
|
|
25
|
+
};
|
|
26
|
+
/** Weeks of daily history before a yearly factor is fitted (spec §7.1). */
|
|
27
|
+
export declare const YEARLY_MIN_WEEKS = 56;
|
|
28
|
+
/** A day this far off the model, relatively and in Poisson terms, is an outlier (and a spike candidate). */
|
|
29
|
+
export declare const OUTLIER: {
|
|
30
|
+
readonly relative: 0.35;
|
|
31
|
+
readonly sigmas: 3;
|
|
32
|
+
};
|
|
33
|
+
/** A series' history in the form the fit reads: dense daily totals and an hourly lookup. Built once per run. */
|
|
34
|
+
export interface PreparedHistory {
|
|
35
|
+
series: string;
|
|
36
|
+
/** Day number of `daily[0]`. */
|
|
37
|
+
firstDay: number;
|
|
38
|
+
/** Daily totals, one per day from `firstDay`; days the daily table lacks are filled from hourly rows. */
|
|
39
|
+
daily: Float64Array;
|
|
40
|
+
/** Hourly values by epoch ms. */
|
|
41
|
+
hourly: Map<number, number>;
|
|
42
|
+
/** Hourly points, oldest first. */
|
|
43
|
+
hourlyPoints: Array<{
|
|
44
|
+
at: number;
|
|
45
|
+
value: number;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
export declare function prepareHistory(history: SeriesHistory): PreparedHistory;
|
|
49
|
+
export interface FittedSeries {
|
|
50
|
+
series: string;
|
|
51
|
+
asOf: number;
|
|
52
|
+
history: PreparedHistory;
|
|
53
|
+
/** First and last UTC day number of history used (inclusive); null for an empty series. */
|
|
54
|
+
span: {
|
|
55
|
+
from: number;
|
|
56
|
+
to: number;
|
|
57
|
+
} | null;
|
|
58
|
+
/**
|
|
59
|
+
* Share of a week's volume per local ISO weekday (index 0 = Monday); sums to 1. Read from hourly
|
|
60
|
+
* history on local days; a daily-only series falls back to `utcDayShare`. Drives `projectHour`.
|
|
61
|
+
*/
|
|
62
|
+
dayShare: number[];
|
|
63
|
+
/** Share of a week's volume per UTC weekday of the daily table; drives weekly totals and `expectedDay`. */
|
|
64
|
+
utcDayShare: number[];
|
|
65
|
+
/** Share of a day's volume per hour of the week; each weekday's 24 values sum to 1. */
|
|
66
|
+
hourShape: number[];
|
|
67
|
+
hasHourlyShape: boolean;
|
|
68
|
+
/** Holt state after the last complete week, deseasonalised, per week. */
|
|
69
|
+
level: number;
|
|
70
|
+
trend: number;
|
|
71
|
+
/** Monday (day number) of the last complete week fitted; null without one. */
|
|
72
|
+
lastWeek: number | null;
|
|
73
|
+
/** One-step-ahead level per fitted week (Monday → level), for in-sample expectations. */
|
|
74
|
+
levels: Map<number, number>;
|
|
75
|
+
/** Week-of-year (0–52) → factor; null under 56 weeks of history. */
|
|
76
|
+
yearly: Map<number, number> | null;
|
|
77
|
+
historyWeeks: number;
|
|
78
|
+
/** Learned effects by label. */
|
|
79
|
+
learned: Map<string, LearnedEffect>;
|
|
80
|
+
/** Every occurrence and the effect it gets. */
|
|
81
|
+
effects: Map<Occ, LearnedEffect>;
|
|
82
|
+
occurrences: readonly Occ[];
|
|
83
|
+
}
|
|
84
|
+
/** Actual volume on a day inside the fitted span; null outside it. */
|
|
85
|
+
export declare function actualOn(model: FittedSeries, day: number): number | null;
|
|
86
|
+
/**
|
|
87
|
+
* Yearly factor per week of year, once ≥ 56 weeks of weekly totals exist.
|
|
88
|
+
* Each week is read against a straight trend line fitted over whole years
|
|
89
|
+
* only (the most recent 52·k weeks), so the season cancels out of the slope
|
|
90
|
+
* and a growing series does not read its latest weeks as "high season".
|
|
91
|
+
* Neighbouring weeks of the year are pooled (±1) and the factors normalised
|
|
92
|
+
* to average 1.
|
|
93
|
+
*/
|
|
94
|
+
export declare function fitYearly(weekly: ReadonlyArray<{
|
|
95
|
+
monday: number;
|
|
96
|
+
total: number;
|
|
97
|
+
}>): Map<number, number> | null;
|
|
98
|
+
/** Days a same-direction outlier run must span to be read as a level shift rather than a spike. */
|
|
99
|
+
export declare const LEVEL_SHIFT_DAYS = 7;
|
|
100
|
+
/** Fits one series as of `asOf`, then once more without its outlier days. */
|
|
101
|
+
export declare function fitSeries(history: PreparedHistory, occurrences: readonly Occ[], calendar: ForecastCalendar, asOf: number): FittedSeries;
|
|
102
|
+
/** Whether an actual is far enough from an expectation to be unexplained. */
|
|
103
|
+
export declare function isOutlier(actual: number, expected: number): boolean;
|
|
104
|
+
/** Expected volume on a day with every known holiday and event applied. */
|
|
105
|
+
export declare function explainedDay(model: FittedSeries, day: number): number;
|
|
106
|
+
/** Deseasonalised weekly level for a week: one-step-ahead in-sample, damped trend beyond. */
|
|
107
|
+
export declare function levelFor(model: FittedSeries, monday: number): number;
|
|
108
|
+
export declare function seasonFor(model: FittedSeries, monday: number): number;
|
|
109
|
+
/**
|
|
110
|
+
* Baseline volume for a UTC day of the daily table — level × season × UTC weekday share, no holiday
|
|
111
|
+
* or event. It is the in-sample yardstick effects and outliers are judged against, so it reads the
|
|
112
|
+
* table's own grain; an hour's local forecast is `projectHour`.
|
|
113
|
+
*/
|
|
114
|
+
export declare function expectedDay(model: FittedSeries, day: number): number;
|
|
115
|
+
export declare function effectOn(model: FittedSeries, day: number): DayEffect;
|
|
116
|
+
/** What applies to every hour of one local day: the week's level and season, holidays, and events. */
|
|
117
|
+
export interface DayFactors {
|
|
118
|
+
/** Deseasonalised weekly level for the day's week. */
|
|
119
|
+
ahead: number;
|
|
120
|
+
season: number;
|
|
121
|
+
holiday: number;
|
|
122
|
+
/** Product of the events' factors, and of their low and high factors. */
|
|
123
|
+
factor: number;
|
|
124
|
+
low: number;
|
|
125
|
+
high: number;
|
|
126
|
+
events: DayEffect['events'];
|
|
127
|
+
}
|
|
128
|
+
export declare function dayFactors(model: FittedSeries, day: number): DayFactors;
|
|
129
|
+
/** One hour's expectation with its components (nowcast 1). */
|
|
130
|
+
export declare function projectHour(model: FittedSeries, calendar: ForecastCalendar, at: number): {
|
|
131
|
+
likely: number;
|
|
132
|
+
low: number;
|
|
133
|
+
high: number;
|
|
134
|
+
components: HourComponents;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* One local day's expectation: exactly the sum of `projectHour` over the day's local hours (23, 24 or 25),
|
|
138
|
+
* in closed form — every hour of a day shares its factors, so only the hour shape is summed.
|
|
139
|
+
*/
|
|
140
|
+
export declare function projectDay(model: FittedSeries, calendar: ForecastCalendar, day: number): {
|
|
141
|
+
likely: number;
|
|
142
|
+
low: number;
|
|
143
|
+
high: number;
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/forecasting/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,gBAAgB,EAAW,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAkE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AACrH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG5E,iFAAiF;AACjF,eAAO,MAAM,IAAI;;;;CAAgD,CAAC;AAClE,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAKnC,4GAA4G;AAC5G,eAAO,MAAM,OAAO;;;CAAyC,CAAC;AAE9D,gHAAgH;AAChH,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,yGAAyG;IACzG,KAAK,EAAE,YAAY,CAAC;IACpB,iCAAiC;IACjC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,mCAAmC;IACnC,YAAY,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAsBtE;AAED,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAA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