Commit graph

27 commits

Author SHA1 Message Date
Daniel
ed45822cb6 test clinical note entrypoints 2026-05-08 06:33:34 +02:00
Daniel
f8b563e642 fix diagram delete confirmation 2026-05-08 06:28:12 +02:00
Daniel
9af599a0b0 remove redundant app wrappers 2026-05-08 06:21:55 +02:00
Daniel
fbae4ebc89 convert admin entrypoint to module 2026-05-08 06:19:51 +02:00
Daniel
f86b7cf1b7 extract STT provider handling 2026-05-08 06:05:39 +02:00
Daniel
d6dccd2c65 simplify TTS provider handling 2026-05-08 06:00:33 +02:00
Daniel
e7b706a4fa remove redundant module wrappers 2026-05-08 05:30:32 +02:00
Daniel
b4d7420f22 extract well visit schedule data 2026-05-08 05:11:29 +02:00
Daniel
acbd42aa43 consolidate calculator growth helpers 2026-05-08 04:36:39 +02:00
Daniel
15c74cba0a extract calculator GCS helper 2026-05-08 04:33:46 +02:00
Daniel
fc0536f38b extract calculator dosing helpers 2026-05-08 04:32:09 +02:00
Daniel
9aafa055d2 extract calculator BP data 2026-05-08 04:24:18 +02:00
Daniel
40926c8f5f extract calculator growth data 2026-05-08 04:05:51 +02:00
Daniel
56edfb8b8d add BMI calculator combination tests 2026-05-08 03:57:30 +02:00
Daniel
14c0d215fa avoid hardcoded BMI LMS anchors 2026-05-08 03:56:28 +02:00
Daniel
d676de471f extract calculator BMI data 2026-05-08 03:52:08 +02:00
Daniel
a1326b1c01 extract AAP bilirubin threshold data 2026-05-08 03:42:51 +02:00
Daniel
e64fe52f48 extract bilirubin risk zone data 2026-05-08 03:28:52 +02:00
Daniel
9a3b3643a7 extract calculator reference data 2026-05-08 03:18:37 +02:00
Daniel
a4b03e8195 extract calculator vitals data 2026-05-08 03:06:14 +02:00
Daniel
d99605c3c0 stabilize assistant and add diagrams 2026-05-08 00:23:00 +02:00
Daniel
baf05198a8 refactor clinical assistant prompt handling 2026-05-07 22:52:46 +02:00
Daniel
624d084b49 feat: improve clinical assistant export and citations 2026-05-07 17:15:26 +02:00
Daniel
18a69d2a13 feat: improve clinical assistant visual sources 2026-05-07 02:45:17 +02:00
Daniel
355c2a999b feat(notes): trash + restore + DOMPurify sanitizer + 9 contract tests
Soft-delete for notes — Daniel asked for "deleted notes go to trash"
so a slip of the finger doesn't lose work.

Schema: migrations/1777090000000_notes-trash.js adds a deleted_at
timestamptz column to personal_notes (NULL = active) plus an index
on (user_id, deleted_at).

Server (src/routes/notes.js):
  GET    /api/notes              now filters deleted_at IS NULL
  GET    /api/notes/trash        new — list trashed items, newest-
                                  deleted first
  DELETE /api/notes/:id          now soft-deletes (sets deleted_at)
  DELETE /api/notes/:id?hard=1   hard-delete, only allowed on items
                                  already in trash (UI bug can't
                                  erase an active note)
  POST   /api/notes/:id/restore  pull a note out of trash
  POST   /api/notes/trash/empty  hard-delete every trashed note for
                                  the user

Frontend (public/components/notes.html + public/js/notes.js +
public/css/styles.css):
  • Sidebar gets two tabs — "Notes" / "Trash (n)" with live count
  • Trash tab shows deleted-at timestamps, Restore + delete-forever
    per row, Empty-trash button at the bottom
  • Active list and trash count refresh in parallel after every
    save / delete / restore
  • Delete button in the editor now says "Move to trash" and uses
    the showConfirm helper (no native dialogs)

Sanitizer swap (public/js/notes.js):
  Replaced the homegrown allowlist walker with DOMPurify (already
  loaded from cdnjs in index.html, used by learningHub.js too).
  Custom HTML sanitizers historically have bypasses; DOMPurify is
  the right primitive.

Tests (test/notes-sanitize.test.js — node:test + jsdom + dompurify
       as new dev deps):
  9 contract tests covering script-tag stripping, inline event
  handlers, img onerror, iframe/object, style attributes, every
  preserved tag in the allowlist, javascript: URI rejection,
  null/undefined input, and nested-script-inside-paragraph. Total
  test count: 37 → 46 passing.

SW cache bumped to pedscribe-v12-notes5.
2026-04-25 01:02:49 +02:00
Daniel
54285865d5 feat: B — extract drug data to public/data/drugs.json (schema v1.0)
Moved 43 weight-based drug entries out of calculators.js string literals
into a structured JSON reference. Renderers now iterate JSON → S.drugRow.

Sections extracted (43 drugs):
- anaphylaxis (7), sedation (11), agitation (11), antiemetics (7), seizure (7)

Out of scope: seizure refractory drips (compound strings), NRP, antimicrobial
empiric regimens (already structured), airway/cardiac/tox/trauma/respiratory
/sepsis/burns sections (fine as-is or no drugs).

New:
- public/data/drugs.json — { version, last_reviewed, sections.<key>.drugs[] }
- public/js/drugs-loader.js — fetches JSON on boot, exposes window._DRUGS +
  window._DRUGS_READY Promise. Non-fatal: each calc function has a matching
  *_FALLBACK constant so a 404 on drugs.json doesn't break anything.

Schema:
- dose_mg_per_kg | dose_mg_per_kg_low/high (for ranges) | max_mg | unit |
  route | notes | source | optional special-cases (weight bands, age-dep text)

Added one unit test asserting drugs.json loads + has all 5 sections with
non-empty drugs arrays. 37/37 unit tests + 26/26 Playwright e2e tests pass.
2026-04-20 04:23:24 +02:00
Daniel
201a51830c feat: Bedside clinical reference module + age→weight estimator + dose-math unit tests
Calculators:
- Bedside tab consolidating emergency protocols (Neonatal+Apgar+NRP, Airway/RSI,
  Cardiac Arrest/PALS, Respiratory, O2 & Ventilation, Status Epilepticus,
  Sepsis & Fever with PECARN/Aronson/Rochester/Step-by-Step, Anaphylaxis,
  Procedural Sedation, Agitation, Antiemetics, Antimicrobials, Burns with
  Lund-Browder body-parts TBSA + Parkland, Toxicology, Trauma).
- Global age→weight estimator at top of Calculators tab (APLS + Best Guess).
- Pressure-time waveform SVG teaching graphic for Ventilation.
- Algorithm image lightbox (fullscreen, Esc/tap-to-close).
- Every weight-based dose shows mg/kg inline for clinician verification.
- Drug tables wrapped in overflow-x:auto for mobile.

Infrastructure:
- Pure dose math extracted to public/js/calc-math.js (dual-export Node+browser).
- 36 unit tests in test/calc-math.test.js via node:test (zero new deps).
- "npm test" added to package.json.
2026-04-20 02:49:42 +02:00