med-det-samme/app/schemas
Ole-Morten Duesund eeed098b1a Cyclic and tapering dose schedules (schema v3)
Extends DoseTime with two orthogonal filters, as the brief foresaw
('cyclic/taper extend from the same model'):
- Cyclic (cycleActiveDays/cycleLengthDays from anchor): N-on/M-off, e.g.
  21/28 contraception. occursOn gains a cycle-window check; nextOccurrence
  is now a uniform day-by-day scan over occursOn (replacing the interval
  fast-path) so weekly/interval/cyclic/windowed all fall out of one
  correct path.
- Validity window (startEpochDay/endEpochDay, inclusive): a taper is
  several daily rows with descending amount and adjacent windows.
dailyConsumption now takes : cyclic scales by active/length, and
rows outside their window contribute 0 so a finished taper step stops
inflating days-of-supply.

UI: dose-time dialog gains a Syklisk section (på/av days) and is now
scrollable; a 'Lag nedtrapping' generator creates the windowed rows from
start dose / step-down / days-per-step / step-count. ScheduleText renders
'· syklus 21/28' and '· 11. juni–13. juni'.

Migration 2→3 is additive ADD COLUMNs with defaults matching the entity
(@ColumnInfo defaultValue), proven by an instrumented MigrationTestHelper
test. Backup DTO extended with defaults so v2 files still parse. 9 new
engine unit tests; versionCode 3 / 0.3.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 22:09:51 +02:00
..
no.naiv.meddetsamme.data.MedDatabase Cyclic and tapering dose schedules (schema v3) 2026-06-11 22:09:51 +02:00