mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 08:02:12 +00:00
feat(medications): once-weekly cadence preset for GLP1 category
Phase 3 of W4d GLP-1 full integration. The form gains a small "Treatment class" selector (GENERIC | GLP-1 injection) sitting under the existing clinical-category dropdown. Picking GLP-1 reveals two helpers that stay hidden for every other medication: - "Once weekly on …" preset — a single-tap weekday row that writes daysOfWeek=[N] + intervalWeeks=1 into the first schedule and reveals the advanced block so the user can still tune the window. The last weekday picked persists in localStorage so a follow-up med starts on the same day. - "Doses per pen / vial" optional input that powers the inventory math (Mounjaro KwikPen = 4, Ozempic 0.25/0.5 mg = 4, Wegovy single-dose pen = 1). Leaving it blank keeps inventory tracking off. The wire schema gains optional `treatmentClass` and `dosesPerUnit` fields. Both default sensibly (GENERIC + null) so the v1.4.24 client keeps working untouched. Marc directive 2026-05-14: GLP-1 must integrate "harmonisch", not crowd the form. The new affordances live behind the treatment-class toggle — for every other med the form is byte-identical to v1.4.24.
This commit is contained in:
1 parent
c7eb226969
commit
94cc7f571d
7 files changed
+279
-3
No files matched your search
@@ -15,6 +15,18 @@ export const MEDICATION_CATEGORY_VALUES = [
|
||||
"OTHER",
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* v1.4.25 W4d — Prisma-level treatment class. Orthogonal to
|
||||
* `MEDICATION_CATEGORY_VALUES` (the clinical taxonomy that lives in the
|
||||
* `medication_categories` side-table). GLP1 turns on the GLP-1
|
||||
* specialist surfaces — injection-site picker, titration history, pen
|
||||
* inventory, GLP-1-aware Coach replies. Future treatment classes drop
|
||||
* into this list (INSULIN, BIOLOGIC, FERTILITY, …).
|
||||
*/
|
||||
export const MEDICATION_TREATMENT_CLASS_VALUES = ["GENERIC", "GLP1"] as const;
|
||||
export type MedicationTreatmentClass =
|
||||
(typeof MEDICATION_TREATMENT_CLASS_VALUES)[number];
|
||||
|
||||
export const scheduleSchema = z.object({
|
||||
windowStart: z.string().regex(timeRegex, "Format: HH:mm"),
|
||||
windowEnd: z.string().regex(timeRegex, "Format: HH:mm"),
|
||||
@@ -28,6 +40,10 @@ export const createMedicationSchema = z.object({
|
||||
name: z.string().min(1).max(100),
|
||||
dose: z.string().min(1).max(50),
|
||||
category: z.enum(MEDICATION_CATEGORY_VALUES).optional(),
|
||||
/** v1.4.25 W4d — treatment-class discriminator (GENERIC | GLP1). */
|
||||
treatmentClass: z.enum(MEDICATION_TREATMENT_CLASS_VALUES).optional(),
|
||||
/** v1.4.25 W4d — doses per pen/vial for inventory tracking. */
|
||||
dosesPerUnit: z.number().int().min(1).max(100).optional(),
|
||||
schedules: z.array(scheduleSchema).min(1, "Mindestens ein Zeitfenster"),
|
||||
});
|
||||
|
||||
@@ -35,6 +51,8 @@ export const updateMedicationSchema = z.object({
|
||||
name: z.string().min(1).max(100).optional(),
|
||||
dose: z.string().min(1).max(50).optional(),
|
||||
category: z.enum(MEDICATION_CATEGORY_VALUES).optional(),
|
||||
treatmentClass: z.enum(MEDICATION_TREATMENT_CLASS_VALUES).optional(),
|
||||
dosesPerUnit: z.number().int().min(1).max(100).nullable().optional(),
|
||||
active: z.boolean().optional(),
|
||||
notificationsEnabled: z.boolean().optional(),
|
||||
schedules: z.array(scheduleSchema).optional(),
|
||||
|
||||
Reference in new issue
Block a user