# Barkday Curves Helpers — How to Integrate ## Files - `js/barkday-curves.js`: helpers to generate Bark Day schedules - `data/curves.json`: tiny config (no big tables) - LOCT (Year1/Year2) params - Optional `analytic` anchors for t >= 2y (PCHIP) ## Steps 1. Copy files to your repo: - `js/barkday-curves.js` - `data/curves.json` 2. In `app.js` (where you compute the next Bark Day): ```js import { buildBarkdayTimes, barkdayDate, nextKAfterNow } from './js/barkday-curves.js'; // Load curves.json (your existing loader or fetch) // const CURVES = await fetch('data/curves.json').then(r=>r.json()); const curveId = CURVES.defaults.overrides[dog.primaryBreed] || CURVES.defaults.group_curve; const conf = CURVES.curves[curveId]; const times = buildBarkdayTimes(conf, { maxK: 80, tMaxYears: 12 }); const { k, tYears } = nextKAfterNow(dog.dob, times); const nextDate = barkdayDate(dog.dob, tYears); ``` 3. PDF header text: - “Next Bark Day Plan — turning {k} on {DATE}” - Optionally, if breed curve is an override, show a small note: “Using {conf.label}”. 4. Tuning knobs: - LOCT Year1: `a0_days` (default 10) — raise to avoid early compression. - LOCT Year2: `a0_hint_days` (default 38) — start Y2 not below last Y1 gap. - For Labs (and future breeds), edit `analytic.anchors` to shape later years smoothly. ## Notes Keep `curves.json` small (labels + anchors), and compute schedules on the client. When a breed override is applied, show a small note “Using {conf.label}”.