Design¶
Purpose¶
MedTracker records medication schedules and administrations with guardrails for timing and daily-dose safety, while preserving an auditable history.
Architecture¶
- Backend: Ruby on Rails
- Frontend: Hotwire (Turbo + Stimulus) with Phlex components
- Authentication: account-based auth with password + generic OIDC (any provider) + passkey support
- Database: PostgreSQL in development, test, and production
- Audit trail: PaperTrail on critical clinical and identity models
Domain logic is enforced on the server. UI forms and pages render server-sent HTML and use Turbo Streams for updates.
Core domain entities¶
Person: demographic and care-capacity record for an individualUser: login-enabled identity linked one-to-one toPersonMedicine: medicine catalog and supply attributesPrescription: prescribed regimen for a personPersonMedicine: non-prescription/ad-hoc medicine assignmentMedicationTake: immutable dose record for safety and complianceCarerRelationship: mapping of carers to dependent people
Use the Glossary as the source of truth for domain terms (for example, Remaining Supply vs Stock).
Safety rules¶
Timing restrictions are enforced in model logic:
max_daily_dosesmin_hours_between_doses
These rules apply before a dose is persisted to prevent unsafe administration.
Person types vs user roles¶
Person type models care needs:
adultminordependent_adult
User role models application permissions:
administratordoctornursecarerparentminor
Auditing and compliance¶
Critical model changes are versioned for traceability, including medication administrations and identity/relationship updates. See Audit Trail.
UI and accessibility direction¶
UI behavior and styling are guided by: