Medications & Reminders Subsystem
Relevant source files
The following files were used as context for generating this wiki page:
The Medications & Reminders Subsystem is a critical component of the Hospice Roadmap mobile application designed to assist caregivers and patients in managing complex end-of-life medication regimens. It provides a centralized interface for tracking medications, scheduling reminders, and receiving local push notifications to ensure adherence to comfort-focused care plans.
The subsystem integrates clinical educational content regarding common hospice medications with practical tools for day-to-day management. It leverages local storage for persistence and utilizes the expo-notifications library to handle time-sensitive alerts, ensuring that even in offline scenarios, caregivers are prompted for essential care tasks.
Sources: replit.md, artifacts/mobile/app/reminders.tsx, artifacts/mobile/data/resources.ts:503-505
Architecture and Data Flow
The subsystem follows a React Context-based architecture where global state is managed via RemindersContext. This context handles the persistence of data to AsyncStorage and coordinates with the device's notification system.
Component Hierarchy and Interaction
The UI components interact with the context to perform CRUD operations on reminders. A specialized MedicationPicker component allows for searching and selecting specific medications, which can then be associated with a schedule.
The diagram shows the flow from user interaction in the UI through the context layer to local storage and the system notification service.
Sources: artifacts/mobile/context/RemindersContext.tsx, artifacts/mobile/app/reminders.tsx, artifacts/mobile/components/MedicationPicker.tsx
Core Data Structures
The system defines specific types for managing the lifecycle of a reminder and its association with medications.
Reminder Model
The Reminder interface is the primary data structure, containing metadata about the event and its scheduling.
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the reminder. |
title | string | The name of the medication or appointment. |
type | 'medication' | 'appointment' | Categorization of the reminder. |
time | string | ISO string representing the scheduled time. |
repeat | 'none' | 'daily' | 'weekly' | Recurrence pattern for the notification. |
notificationId | string (Optional) | ID returned by the system notification manager. |
Sources: artifacts/mobile/context/RemindersContext.tsx
Key Logic and Implementation
Notification Management
The subsystem utilizes expo-notifications to schedule alerts. When a reminder is added, the RemindersContext calculates the trigger based on the selected time and recurrence pattern.
- Scheduling: Uses
Notifications.scheduleNotificationAsync. - Cancellation: Uses
Notifications.cancelScheduledNotificationAsyncwhen a reminder is deleted. - Clearing All: A global
clearRemindersfunction iterates through all reminders with activenotificationIds and cancels them before clearing local storage.
Sources: artifacts/mobile/context/RemindersContext.tsx, attached_assets/Pasted-Build-granular-saved-data-controls-for-the-React-Native_1774841501598.txt
Medication Selection and Search
The MedicationPicker component provides a search interface for medications. It likely interfaces with a search utility or hook like useRxNorm (based on file naming) to provide a list of medications for the user to choose from.
This sequence illustrates the interaction between the UI picker and the underlying data hook during medication selection.
Sources: artifacts/mobile/components/MedicationPicker.tsx, artifacts/mobile/hooks/useRxNorm.ts
Clinical Context Integration
The subsystem is supported by extensive educational content. The application includes a "Comfort Kit" guide explaining common hospice medications such as Morphine (for pain/breathlessness), Lorazepam (for anxiety), and Haloperidol (for agitation). This content informs caregivers on when to use the medications they are tracking.
Sources: artifacts/mobile/data/resources.ts:503-535
Conclusion
The Medications & Reminders Subsystem serves as a bridge between clinical knowledge and actionable care. By combining a robust local notification engine with a user-friendly medication management interface, it ensures caregivers can maintain the "Comfort Kit" protocols essential for hospice care, even under the stress of end-of-life navigation.