Date: January 24, 2026
Status: Ready for execution
Objective: Split MindTrackAI into 3 focused apps
MindTrackAI (Mental Health Focus)
├── Dashboard (mental health metrics only)
├── Mental Health tab
├── Sleep tracking
└── Journal
MedsTrackAI (Medication Management) - NEW REPO
├── Dashboard (medication metrics)
├── Medications tab (full feature set)
└── Prescription management
GymPulse (Fitness Tracking) - EXISTING REPO
├── Dashboard (fitness metrics)
└── Exercise tracking
- Dashboard tab - Keep, but remove medication/exercise metrics
- Mental Health tab - Keep entire section
- Sleep tab - Keep entire section
- Journal tab - Keep entire section
-
Mental Health Section (lines 1640-1675)
- Mood tracking slider (1-10 scale)
- Notes field
- Save mood functionality
- Mood history display
-
Sleep Section (lines 2112-2146)
- Sleep hours input
- Sleep quality selector
- Sleep notes
- Sleep history and stats
-
Journal Section (lines 2194-2328)
- Journal entry form
- Entry history
- Writing stats
- Analytics (lines 2387-2427)
- ErrorHandler (lines 2429-2477)
- InputValidator (lines 2479-2531)
- DB helpers (lines 3407-3410)
- Service Worker (docs/service-worker.js)
- Mental health chart
- Sleep chart
- Weekly mood trends
- Sleep quality trends
- Medication tab (line 1487) - Remove entire tab button
- Medical disclaimer
- Emergency contacts
- Location selector
- Pill identification tool
- Add medication form
- Medication tabs (8 sub-tabs):
- Today's Medications
- Supplements
- Prescription Details
- History
- Effectiveness
- Side Effects
- Adherence Insights
- Interactions
addMedication()saveMedication()logMedicationTaken()logMedicationSkipped()deleteMedication()switchMedicationTab()updateMedicationStats()checkDrugInteractions()validateDosage()searchMedication()identifyPill()saveContacts()toggleContactsEdit()handleCountryChange()savePrescriptionDetails()showPregnancySection()togglePregnancyFields()trackSideEffect()deleteSideEffect()setMedicationReminder()
medicationsarraymedicationDefinitionsarraymedicationLogsarraysideEffectsarraymedicationRemindersobject
- Medication adherence chart
- Medication effectiveness chart
- Drug interaction warnings
- Exercise tab (line 1489) - Remove entire tab button
- Log exercise form
- Exercise type selector
- Duration input
- Intensity selector
- Exercise stats cards
- Exercise history display
saveExercise()updateExerciseStats()deleteExercise()
exercisesarray
- Exercise duration chart
- Weekly exercise stats
{
profile: { name, exportDate },
moods: [], // ✅ KEEP
medications: [], // ❌ REMOVE
medicationDefinitions: [], // ❌ REMOVE
medicationLogs: [], // ❌ REMOVE
sideEffects: [], // ❌ REMOVE
sleeps: [], // ✅ KEEP
exercises: [], // ❌ REMOVE
journalEntries: [] // ✅ KEEP
}{
profile: { name, exportDate, appVersion: 'MindTrackAI v2.0' },
moods: [],
sleeps: [],
journalEntries: [],
analytics: [] // Optional
}{
profile: { name, exportDate, appVersion: 'MedsTrackAI v1.0' },
medications: [],
medicationDefinitions: [],
medicationLogs: [],
sideEffects: [],
prescriptionDetails: [],
emergencyContacts: {},
analytics: []
}{
profile: { name, exportDate, appVersion: 'GymPulse v1.0' },
exercises: [],
analytics: []
}mental-health-tracker.test.jsmental-health-insights.test.jssleep-tracker.test.jssleep-tracker-cli.test.jsanalytics-engine.test.jsanalytics-cli.test.jsbackup-manager.test.jsexport-manager.test.jsdata-operations.test.jschart-utils.test.jsvalidation-utils.test.jserror-handling.test.jspwa-onboarding.test.jsdaily-dashboard.test.js(modified)integration.test.js(modified)
medication-tracker.test.jsmedication-tracker-enhanced.test.jsmedication-tracker-enhanced.active.test.jsmedication-tracker-regulatory.test.jsmedication-enrichment.test.jsmedication-interactions.test.jsmedication-validator.test.jsenhanced-medication-manager.test.js- Parts of
integration.test.js - Parts of
daily-dashboard.test.js - Parts of
docs/__tests__/critical-features.test.js
exercise-tracker.test.jsexercise-tracker-cli.test.js- Parts of
integration.test.js - Parts of
daily-dashboard.test.js
Pros:
- Each app is completely independent
- No dependency management
- Easier deployment
- Simple versioning
Cons:
- Code duplication (~500 lines)
- Bug fixes need to be applied 3x
Pros:
- Single source of truth
- Easier bug fixes
Cons:
- Need to maintain NPM package
- Version conflicts possible
- Deployment complexity
DECISION: Use Option A (duplicate) for simplicity. Apps are small enough.
Create export/import tools for users to migrate data:
- Add "Export for MedsTrackAI" button in MindTrackAI
- Add "Export for GymPulse" button in MindTrackAI
- Create import functionality in MedsTrackAI
- Create import functionality in GymPulse
# New repo structure
MedsTrackAI/
├── docs/
│ ├── index.html (medication features only)
│ └── service-worker.js
├── __tests__/
│ ├── medication-tracker.test.js
│ ├── medication-interactions.test.js
│ └── ... (8 test files)
├── package.json
└── README.mdLine Ranges to Copy:
- Lines 1676-2111: Full medication section HTML
- Medication functions (search for all medication-related functions)
- Medication CSS styles
- Medication test files
Line Ranges to Copy:
- Lines 2147-2193: Full exercise section HTML
- Exercise functions
- Exercise CSS styles
- Exercise test files
Remove:
- Medication navigation button (line 1487)
- Exercise navigation button (line 1489)
- Medication section HTML (lines 1676-2111)
- Exercise section HTML (lines 2147-2193)
- All medication functions
- All exercise functions
- Medication/exercise from dashboard charts
- Update mobile navigation
- Update data export function
Modify dashboard to show only:
- Mental health trends (moods)
- Sleep patterns
- Journal activity
- Overall wellness score (mood + sleep)
- ✅ Run all MindTrackAI tests (should pass with mental health tests only)
- ✅ Run all MedsTrackAI tests
- ✅ Run all GymPulse tests
- ✅ Test data export/import between apps
- ✅ Test offline functionality (service worker)
- Update README files for each app
- Create migration guide for users
- Add cross-app linking documentation
Lines TBD - need to search:
- addMedication()
- saveMedication()
- logMedicationTaken()
- logMedicationSkipped()
- deleteMedication()
- switchMedicationTab()
- updateMedicationStats()
- checkDrugInteractions()
- validateDosage()
- searchMedication()
- identifyPill()
- saveContacts()
- toggleContactsEdit()
- handleCountryChange()
- savePrescriptionDetails()
- showPregnancySection()
- togglePregnancyFields()
- trackSideEffect()
- deleteSideEffect()
- setMedicationReminder()
- updateMedTypePlaceholder()
- handleDosageAmountInput()
- updateDosagePreview()
Lines TBD - need to search:
- saveExercise()
- updateExerciseStats()
- deleteExercise()
Mitigation:
- Create backup before any changes
- Add migration guide with screenshots
- Export all data before cleanup
Mitigation:
- Search for all
DB.get('medications')references - Search for all
DB.get('exercises')references - Update dashboard charts carefully
Mitigation:
- Run tests after each major change
- Keep git history clean (commit per feature removal)
- Create rollback branch
Mitigation:
- Update service worker version number
- Clear old cache on version bump
- Test offline functionality
- All tests passing (2117/2117)
- No code errors
- Create git branch:
feature/split-medication-exercise - Run full test suite
- Export sample data for testing migration
- Document current localStorage keys
- Backup production data (if applicable)
Ready to proceed to:
- Create detailed function extraction map (grep all medication/exercise functions)
- Set up MedsTrackAI repo structure
- Create data migration export tools
- Begin extraction process
Awaiting user confirmation to proceed with Step 1
- ✅ MindTrackAI: Only mental health, sleep, journal features
- ✅ MedsTrackAI: Complete medication management system
- ✅ GymPulse: Exercise tracking features
- ✅ All apps: 100% test pass rate
- ✅ Data export/import works between apps
- ✅ Service workers functional in all apps
- ✅ No code duplication except utilities
- ✅ Documentation complete for all apps
Phase 1 Complete - Ready for Phase 2 (Extraction)