Skip to content

feat(pgx): My Medications — Phase 1 (#25)#34

Merged
glebis merged 3 commits into
mainfrom
feat/pgx-my-medications
May 29, 2026
Merged

feat(pgx): My Medications — Phase 1 (#25)#34
glebis merged 3 commits into
mainfrom
feat/pgx-my-medications

Conversation

@glebis

@glebis glebis commented May 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Medication autocomplete input at the top of PGx panel — type 2+ chars to search all drug names from YAML config (generic names, brand names, full strings)
  • localStorage persistence — medications survive page reloads; pill chips with × remove and "Clear all"
  • Pinned "Your Medications" section — drug cards matching your medications are surfaced above the main list with enzyme context labels (e.g. "via CYP2C19 · G;G (*1)")
  • Dynamic filter chip — "My medications (N)" chip appears when medications are added, filters to only matching cards

New files

  • MedicationInput.tsx — autocomplete with keyboard nav, click-outside dismiss
  • useMyMedications.ts — hook with normalizeDrugName, localStorage sync, dedup
  • medications.css — CSS classes for input, pills, pinned section (no inline styles)
  • extractAllDrugNames added to usePGxData.ts — parses drug strings from config

Test plan

  • 508 tests passing (vitest run)
  • Browser-tested: autocomplete suggestions, pill chips, pinned section, filter chip
  • localStorage persistence verified across page reloads
  • Keyboard navigation (↑/↓/Enter/Escape) works
  • Deduplication: "Sertraline" and "Sertraline (Zoloft)" normalize to same entry

Closes phase 1 of #25

🤖 Generated with Claude Code

glebis and others added 3 commits May 7, 2026 14:35
…ase 1)

- useMyMedications hook: add/remove/clear with localStorage persistence,
  drug name normalization (strips brand names, deduplicates)
- extractAllDrugNames: parses pgx-drugs.yaml drug strings into searchable
  list of generic names, brand names, and full strings
- MedicationInput component: autocomplete with keyboard nav, pill chips,
  clear all — CSS classes instead of inline styles
- PGxPanel: "Your Medications" pinned section shows matched drug cards
  with enzyme context at the top; "My medications" filter chip appears
  when meds are set
- 16 new tests (508 total, all passing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The my-meds filter hid the pinned section AND filtered enzyme sections,
resulting in a blank page. Now pinned cards are always visible, enzyme
sections hide when my-meds is active, and an empty state handles missing data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e 2)

When a drug spans multiple enzymes (e.g., atorvastatin via CYP3A4 + SLCO1B1),
the pinned "Your Medications" section now groups them under one heading with
color-coded enzyme badges per impact level. Single-enzyme drugs still show the
simple "via ENZYME · alleles" label.

Also fixes blank page when my-meds filter was active (pinned cards now always
render, enzyme sections hidden when filtering by medications).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@glebis glebis merged commit 63f1753 into main May 29, 2026
2 checks passed
@glebis glebis deleted the feat/pgx-my-medications branch May 29, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant