mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 23:52:24 +00:00
The dose-window editor pulled DOSE_WINDOW_DEFAULTS from @/lib/analytics/compliance, dragging the server-only scheduling graph (which imports node:async_hooks) into the client bundle. Turbopack rejected the client chunk; tsc does not model the boundary so the type check stayed green. Move the constant into a leaf module with no server imports and re-export it from compliance so the server path is unchanged. The client-reachable editor now imports the leaf directly.
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
/**
|
|
* Default on-time / overdue window widths for the compliance engine.
|
|
*
|
|
* Kept in its own leaf module — free of any server-only import — so the
|
|
* client-side dose-window editor can read the same defaults without
|
|
* pulling the full analytics graph (and its `node:async_hooks` deps)
|
|
* into the browser bundle. `@/lib/analytics/compliance` re-exports this
|
|
* constant so existing server-side imports keep their path.
|
|
*
|
|
* DAILY / INTRADAY dose (minute-scale windows):
|
|
* - on-time: target ± 1h
|
|
* - overdue: up to target + 4h (late-but-counts)
|
|
* - missed: > target + 4h
|
|
*
|
|
* WEEKLY / ROLLING injectable (day-scale windows; the 4-day clinical rule):
|
|
* - on-time: target day ± 1 day
|
|
* - overdue: up to target + 4 days (late-but-counts)
|
|
* - missed: > target + 4 days
|
|
*/
|
|
export const DOSE_WINDOW_DEFAULTS = {
|
|
/** Daily / intraday on-time half-width around the target instant (min). */
|
|
dailyOnTimeMinutes: 60,
|
|
/**
|
|
* Daily / intraday overdue tail past the on-time window (min). A dose
|
|
* taken inside `[onTime, onTime + overdue]` still counts; beyond it the
|
|
* dose is missed.
|
|
*/
|
|
dailyOverdueMinutes: 240 - 60,
|
|
/** Weekly / rolling on-time half-width around the target day (days). */
|
|
weeklyOnTimeDays: 1,
|
|
/**
|
|
* Weekly / rolling overdue tail past the target day (days) — the clinical
|
|
* 4-day GLP-1 rule. A shot inside `[target, target + 4d]` still counts;
|
|
* beyond it the dose is missed and the user skips to the next slot.
|
|
*/
|
|
weeklyOverdueDays: 4,
|
|
} as const;
|