mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 16:12:11 +00:00
Merge branch 'v143/fixdata' into release/v1.43.0
This commit is contained in:
commit
a806676a71
62 files changed
+2018
-209
No files matched your search
@@ -392,6 +392,10 @@ const customMedicationCategorySchema = z
|
||||
const medicationSchema = z
|
||||
.object({
|
||||
id: z.string().min(1).optional(),
|
||||
// The source row's id in a portable file, which carries no `id`: the
|
||||
// relation links name the medication by it, and the restore re-points
|
||||
// them at the row it writes (`relation-links-backup.ts`).
|
||||
ref: z.string().min(1).optional(),
|
||||
name: z.string().min(1),
|
||||
dose: z.string(),
|
||||
treatmentClass: z.enum(MedicationCategory).optional(),
|
||||
@@ -1126,6 +1130,8 @@ const appSettingsBackupSchema = z
|
||||
const labResultBackupSchema = z
|
||||
.object({
|
||||
id: z.string().min(1).optional(),
|
||||
// The source row's id in a portable file, as on a medication.
|
||||
ref: z.string().min(1).optional(),
|
||||
panel: z.string().nullable().optional(),
|
||||
analyte: z.string().min(1),
|
||||
value: z.number().nullable().optional(),
|
||||
|
||||
@@ -9,7 +9,9 @@ import { z } from "zod/v4";
|
||||
import type { PulseDayMeanMethod } from "@/lib/measurements/day-statistic";
|
||||
|
||||
export const pulseDayMeanActionSchema = z.strictObject({
|
||||
action: z.enum(["dry_run", "apply"]),
|
||||
// `rebuild` runs the recalculation again after an apply whose rebuild
|
||||
// stopped, without a new dry run: the method is already switched.
|
||||
action: z.enum(["dry_run", "apply", "rebuild"]),
|
||||
});
|
||||
export type PulseDayMeanActionInput = z.infer<typeof pulseDayMeanActionSchema>;
|
||||
|
||||
@@ -46,20 +48,47 @@ const dryRunResultSchema = z.object({
|
||||
});
|
||||
export type PulseDayMeanDryRunResult = z.infer<typeof dryRunResultSchema>;
|
||||
|
||||
/** `app_settings.pulse_day_mean_dry_run_json`: the last dry run. */
|
||||
export const pulseDayMeanDryRunSchema = z.object({
|
||||
status: z.enum(["queued", "running", "done", "failed"]),
|
||||
const runStatusSchema = z.enum(["queued", "running", "done", "failed"]);
|
||||
|
||||
/** The last dry run. */
|
||||
const pulseDayMeanDryRunSchema = z.object({
|
||||
status: runStatusSchema,
|
||||
startedAt: z.string(),
|
||||
finishedAt: z.string().nullable(),
|
||||
result: dryRunResultSchema.nullable(),
|
||||
});
|
||||
export type PulseDayMeanDryRun = z.infer<typeof pulseDayMeanDryRunSchema>;
|
||||
|
||||
/** The last recalculation of the pulse rollups after an apply. */
|
||||
const pulseDayMeanRebuildSchema = z.object({
|
||||
status: runStatusSchema,
|
||||
startedAt: z.string(),
|
||||
finishedAt: z.string().nullable(),
|
||||
/** Accounts and rollup rows done; null until the run has finished. */
|
||||
accounts: z.number().int().nonnegative().nullable(),
|
||||
rows: z.number().int().nonnegative().nullable(),
|
||||
});
|
||||
export type PulseDayMeanRebuild = z.infer<typeof pulseDayMeanRebuildSchema>;
|
||||
|
||||
/**
|
||||
* `app_settings.pulse_day_mean_dry_run_json`: the last dry run, and beside it
|
||||
* the last rebuild. One column holds both, because the rebuild only ever
|
||||
* follows an apply that needed a dry run; a blob written before the rebuild
|
||||
* was recorded has no `rebuild` key and reads as none.
|
||||
*/
|
||||
export const pulseDayMeanStoredRunsSchema = pulseDayMeanDryRunSchema.extend({
|
||||
rebuild: pulseDayMeanRebuildSchema.nullable().optional(),
|
||||
});
|
||||
export type PulseDayMeanStoredRuns = z.infer<
|
||||
typeof pulseDayMeanStoredRunsSchema
|
||||
>;
|
||||
|
||||
/** `GET /api/admin/maintenance/pulse-day-mean`. */
|
||||
export interface PulseDayMeanStatus {
|
||||
method: PulseDayMeanMethod;
|
||||
appliedAt: string | null;
|
||||
lastDryRun: PulseDayMeanDryRun | null;
|
||||
lastRebuild: PulseDayMeanRebuild | null;
|
||||
}
|
||||
|
||||
/** How old a finished dry run may be for the apply step to accept it. */
|
||||
|
||||
Reference in new issue
Block a user