A single-file web app for parents to track a child's sleep (3–14+ days) and share results with their sleep clinic. No server, no accounts: all data stays in the parent's browser until the parent exports it (plain-text summary for MyChart, CSV for research, JSON/Google Drive for backup).
index.html— the clinical app. This is what parents use.demo.html— identical, but pre-loads 7 nights of sample data on first open (for demonstrating to colleagues). Safe to delete.
- Sign in at github.com → + (top right) → New repository.
Name it
sleep-diary, leave it Public, click Create repository. - On the new repo page: uploading an existing file link → drag in
index.html(anddemo.html,README.mdif you like) → Commit changes. - Repo Settings → Pages (left sidebar) → under "Build and deployment", Source = Deploy from a branch, Branch = main / (root) → Save.
- Wait ~1 minute. Your app is live at:
https://YOUR-USERNAME.github.io/sleep-diary/
Updating later: edit/replace index.html in the repo (the pencil icon or
re-upload). Pages redeploys automatically. Parents who added it to their home
screen get the new version on next load — no reinstall.
- Open the camera and scan this QR code (or type the link).
- iPhone: tap Share → "Add to Home Screen." Android: tap menu (⋮) → "Add to Home screen." This keeps your diary safe on your phone.
- Each morning, tap Add last night (about 1 minute).
- At your next visit — or when we ask — open the Share tab, tap Copy summary, and paste it into a MyChart message to the clinic.
Generate the QR code from your Pages URL with any QR generator. "Add to Home Screen" matters on iPhone: it prevents iOS from purging the diary's storage after 7 days of not opening Safari to that site.
- No data is transmitted to, or stored by, the clinic, Yale, or GitHub. GitHub Pages serves the static page only; it never receives diary entries.
- Parents are asked for initials only, never names or DOB.
- Sharing is patient-initiated (paste into MyChart / email attachment), mirroring existing patient-generated-data workflows.
- The optional Google Drive backup writes one file to the parent's own
Google account using the
drive.filescope (the app can only access the one file it created). Disabled until configured — see below.
- console.cloud.google.com → create a project (e.g., "Sleep Diary").
- APIs & Services → OAuth consent screen: External; fill app name,
support email, developer contact. Add scope
https://www.googleapis.com/auth/drive.file. - APIs & Services → Library: enable the Google Drive API.
- Credentials → Create credentials → OAuth client ID → Web application.
Under "Authorized JavaScript origins" add your Pages origin, e.g.
https://YOUR-USERNAME.github.io(origin only — no path). - Copy the client ID into
index.html: findconst GOOGLE_CLIENT_ID = "";and paste it between the quotes. Commit. - Before clinic-wide rollout, submit the consent screen for verification; unverified apps are capped at ~100 test users and show a warning screen.
One row per night: date, lights_out, sleep_onset, final_wake, out_of_bed, sol_min, tst_min, tib_min, se_pct, waso_min, n_awakenings, n_parent_interventions, awakenings_detail, n_naps, nap_sleep_min, naps_detail, notes. Times are 24-h clock; durations are minutes. Suitable for REDCap import.
Summary metrics shown in-app: mean ± SD lights-out / onset / wake / midsleep; mean sleep latency, night TST, TIB, sleep efficiency (TST÷TIB), WASO, awakenings and parental interventions per night, nap sleep, 24-h TST, and the Sleep Regularity Index (Phillips et al., 5-min epochs, consecutive days).
Chart format inspired by the Mindell & Owens pediatric sleep log. The app code may be reused by other institutions; add a license file (MIT suggested) before publicizing.