How brook-sheet/med-reminder-web-app works
Rx Box is a medication-adherence product spanning patient and family web/mobile interfaces, a connected pillbox, and predictive risk awareness. The principal workflow configures medicines and schedules, receives device or manual medication events, records adherence, and presents history and monitoring information with reminders or selected risk notifications. The graph also preserves authentication, chat, food monitoring, and reporting capabilities documented or represented in the repository. Some subsystem wiring is inferred only from README descriptions; those relationships cite the README rather than unsampled implementation.
Main entry points: history/route.ts Medication history API · dashboard/route.ts Dashboard API · login/route.ts Authentication API · medicines/route.ts Medicine API
Components 28
Access and accounts
- Account screens
app/(auth)/sign-in/page.tsx - Authentication API
app/api/auth/login/route.ts - JWT authentication
lib/auth.ts
Medication adherence
- Medicine schedules
app/(main)/medicines/page.tsx - Medicine API
app/api/medicines/route.ts - Device event APIs
app/api/esp32/event/route.ts - Medication verification
lib/medicationVerification.ts - Medication history API
app/api/history/route.ts - History view
app/(main)/history/page.tsx
Monitoring and insights
- Adherence engine
lib/adherenceEngine.ts - Dashboard API
app/api/dashboard/route.ts - Patient dashboard
app/(main)/page.tsx - Risk prediction
lib/prediction/adherencePrediction.ts - Family monitoring
app/(main)/monitor/[patientID]/page.tsx - Medication reports
app/api/reports/medication/route.ts - Food monitoring
app/api/food-monitoring/route.ts
Notifications and chat
- Risk alert engine
lib/alertEngine.ts - Notification channels
lib/notificationChannels.ts - Family chat
components/chats/ChatsPageClient.tsx - Chat API
app/api/chats/route.ts
Persistence and services
- MongoDB Atlas
- User records
models/User.ts - Medicine schedules
models/Medicine.ts - Medication logs
models/MedicationLog.ts - Monitoring requests
models/MonitoringRequest.ts - Notification records
models/Notification.ts
Other components
- Patient / family
- ESP32 pillbox
Connections 31
- Patient / family → Account screens: starts account
README.md - Account screens → Authentication API: submits credentials
- Authentication API → JWT authentication: verifies identity
- Patient / family → Medicine schedules: sets schedule
README.md - Medicine schedules → Medicine API: manages medicines
app/(main)/medicines/page.tsx - Medicine API → Medicine schedules: reads and writes
app/api/medicines/route.ts - ESP32 pillbox → Device event APIs: sends events
README.md - Device event APIs → Medication verification: records activity
- Medication verification → Medication logs: updates outcomes
lib/medicationVerification.ts - Patient / family → History view: reviews history
README.md - History view → Medication history API: requests records
app/(main)/history/page.tsx - Medication history API → Medication verification: finalizes events
app/api/history/route.ts - Medication history API → Medication logs: reads and writes
app/api/history/route.ts - Dashboard API → Adherence engine: calculates adherence
app/api/dashboard/route.ts - Dashboard API → Medication logs: reads outcomes
app/api/dashboard/route.ts - Patient dashboard → Dashboard API: loads dashboard
- Adherence engine → Risk prediction: provides behavior features
- Risk prediction → Risk alert engine: identifies risk
README.md - Patient / family → Family monitoring: views family status
README.md - Family monitoring → Medication reports: requests reports
- Patient / family → Food monitoring: submits questionnaire
README.md - Risk alert engine → Notification channels: dispatches alerts
lib/alertEngine.ts - Notification channels → Notification records: records delivery
- Patient / family → Family chat: communicates
README.md - Family chat → Chat API: uses chat API
components/chats/ChatsPageClient.tsx - Chat API → Notification channels: sends push
app/api/chats/route.ts - Chat API → Monitoring requests: checks monitoring link
app/api/chats/route.ts - Medicine API → MongoDB Atlas: persists schedules
- Medication history API → MongoDB Atlas: connects database
app/api/history/route.ts - Dashboard API → MongoDB Atlas: connects database
app/api/dashboard/route.ts - Authentication API → User records: uses account data