docs: reconcile documentation with reality (P3)

Make the project's documentation match the code and remove the sprawl. The docs
claimed Phase 2.8 (drug interactions) was 'planning/0%' and the backend '~91%
complete' — both wrong: 2.8 is implemented and live, plus the P0/P1 security
and test work is done. Five root CI/CD docs described a 'docker-build' CI job
that was removed; ~18 backend/ status snapshots and ~24 docs/implementation
duplicates cluttered the tree.

Deletions (85 files):
- Root: 4 stale CI/CD reports (CI-CD-{COMPLETION-REPORT,IMPLEMENTATION-SUMMARY,
  STATUS-REPORT,FINAL-STATUS}.md) — all describe the removed docker-build job.
- backend/: 18 phase/build/fix snapshots and code-dump .txt files.
- docs/: the 3 one-time reorg reports; ~17 docs/implementation duplicates and
  process artifacts; 4 stale docs/development CI docs + git snapshots;
  redundant deployment/testing files.
- thoughts/: STATUS.md (said Phase 2.4 in-progress), superseded phase notes and
  duplicative research inputs. tmp/ (928KB of CI debug logs, gitignored).

Moves (18 files):
- 9 genuine decision records -> docs/adr/ (Architecture Decision Records),
  date-prefixes stripped, with an index README.
- 8 historical-but-valuable phase plans/specs + the old CI-CD-FINAL-SOLUTION ->
  docs/archive/ (now-populated, with a README explaining it's superseded
  material). thoughts/ tree removed.

Rewrites (13 files) to match reality:
- Drop the fake '% complete' figures everywhere in favor of Implemented /
  In-Progress / Planned with concrete endpoint/feature lists.
- Phase 2.8 -> Implemented; add /api/interactions/* and /api/auth/{refresh,
  logout} to the endpoint lists; fix 'Rust 1.93' -> edition 2021.
- Add a Security section (token_version validation, hashed refresh-token
  persistence, fail-fast config, real-IP audit) and correct the test-coverage
  and deployment claims to reality.
- New canonical docs/development/CI-CD.md (4 jobs: format/clippy/build/test,
  mongo service, no docker-build + why).
- README, docs/README, product/{STATUS,ROADMAP,PROGRESS,README,introduction},
  implementation/README, development/README, testing/README, AI_AGENT_GUIDE,
  .cursorrules, .gooserules all updated.

Verified: greps for 'Phase 2.8 (Planning)', 'PLANNING (0%)', 'Rust 1.93',
'91%/10%/85% complete', and 'docker-build' return nothing outside docs/archive;
all internal doc links resolve; backend/src untouched (cargo build clean).
This commit is contained in:
goose 2026-06-27 16:02:16 -03:00
parent bd1b7c2925
commit 17efc4f656
119 changed files with 469 additions and 17801 deletions

View file

@ -0,0 +1,440 @@
# 🎯 Phase 2.7 Plan - MVP Prioritized
**Based on:** Normogen MVP Research Summary (2026-01-05)
**Phase:** 2.7 - Health Data Features (MVP-Focused)
**Status:** ⏳ Not Started
**MVP Core Value:** Tracking medication adherence and health trends
---
## 🚨 MVP Priority Shift
### Original Plan (Generic)
1. Medications
2. Lab Results
3. Health Statistics
4. Appointments
5. Health Documents
### ✅ MVP-Aligned Plan (Prioritized)
1. **Medications** - MVP CRITICAL (adherence tracking)
2. **Health Statistics** - MVP CRITICAL (trends & patterns)
3. **Lab Results** - MVP IMPORTANT (reference ranges)
4. **Simple Notifications** - MVP CRITICAL (reminders)
5. **Basic Sharing** - MVP IMPORTANT (family access)
---
## 📋 MVP Requirements Analysis
### Core MVP Users (from research)
1. **Parents** tracking children's health
2. **Individuals** managing medications
3. **Families** sharing health data
### MVP Core Value Propositions
- 📊 **Track health variables over time**
- 💊 **Medication reminders & adherence**
- 👨‍👩‍👧 **Multi-person profiles** (family)
- 🔗 **Secure sharing** with caregivers
- 📱 **Simple, mobile-first UX**
---
## 🎯 MVP-Feature Matrix
| Feature | MVP Priority | Use Case | Effort | Value |
|---------|--------------|----------|--------|-------|
| **Medication Tracking** | 🔴 CRITICAL | Daily meds, adherence | Medium | 🔥🔥🔥🔥🔥 |
| **Health Statistics** | 🔴 CRITICAL | Track trends (BP, weight) | Medium | 🔥🔥🔥🔥🔥 |
| **Simple Reminders** | 🔴 CRITICAL | Never miss a dose | High | 🔥🔥🔥🔥🔥 |
| **Basic Sharing** | 🔴 IMPORTANT | Family access | Medium | 🔥🔥🔥🔥 |
| **Profile Management** | 🔴 IMPORTANT | Multi-person | Low | 🔥🔥🔥🔥 |
| **Lab Results** | 🟡 NICE-TO-HAVE | Track values | Medium | 🔥🔥🔥 |
| **Appointments** | 🟡 NICE-TO-HAVE | Scheduling | Low | 🔥🔥 |
| **Document Upload** | 🟢 DEFER | Medical records | High | 🔥 |
| **Advanced Analytics** | 🟢 DEFER | Insights | Very High | 🔥 |
---
## 🚀 Revised Implementation Order
### Sprint 1: Core MVP (Week 1)
**Focus:** Medication adherence + Health tracking
#### Task 1.1: Medication Management 💊
**Priority:** 🔴 CRITICAL (MVP Blocker)
**Time:** 3 days
**Endpoints:**
- `POST /api/medications` - Add medication
- `GET /api/medications` - List medications (by profile)
- `PUT /api/medications/:id` - Update medication
- `DELETE /api/medications/:id` - Delete medication
- `POST /api/medications/:id/log` - Log dose taken
- `GET /api/medications/:id/adherence` - Get adherence %
**Key Features:**
- Medication name, dosage, frequency
- Time-based reminders
- Dose logging (taken/skipped)
- Adherence calculation
- Profile-based (multi-person support)
**Handler:** `backend/src/handlers/medications.rs`
---
#### Task 1.2: Health Statistics Tracking 📈
**Priority:** 🔴 CRITICAL (MVP Blocker)
**Time:** 3 days
**Endpoints:**
- `POST /api/health-stats` - Add stat (weight, BP, etc.)
- `GET /api/health-stats` - List stats (by profile & type)
- `GET /api/health-stats/trend/:type` - Get trend data
- `DELETE /api/health-stats/:id` - Delete stat
**Key Features:**
- Support for common metrics (weight, BP, temp, etc.)
- Date-based tracking
- Trend visualization support
- Profile-based (track for each family member)
**Handler:** `backend/src/handlers/health_stats.rs`
**Important Stats for MVP:**
- Weight
- Blood Pressure (systolic/diastolic)
- Heart Rate
- Temperature
- Blood Glucose
- Custom notes
---
#### Task 1.3: Profile Selection API 👤
**Priority:** 🔴 CRITICAL (Multi-person support)
**Time:** 1 day
**Endpoints:**
- `GET /api/profiles` - List user's profiles
- `POST /api/profiles` - Create profile (family member)
- `PUT /api/profiles/:id` - Update profile
- `GET /api/profiles/:id/health-stats` - Get profile's stats
- `GET /api/profiles/:id/medications` - Get profile's meds
**Handler:** `backend/src/handlers/profiles.rs`
---
### Sprint 2: Sharing & Notifications (Week 2)
#### Task 2.1: Basic Health Sharing 🔗
**Priority:** 🔴 IMPORTANT (MVP Core Value)
**Time:** 3 days
**Endpoints:**
- `POST /api/shares` - Share health data
- `GET /api/shares` - List shares
- `DELETE /api/shares/:id` - Revoke share
- `GET /api/shares/:token` - Access shared data (public link)
**Key Features:**
- Share specific data types (meds, stats)
- Expiring links (1 day, 7 days, 30 days)
- Access control (read-only)
- Already mostly implemented (use existing Share model)
**Enhancement to existing:** `backend/src/handlers/shares.rs`
---
#### Task 2.2: Simple Notification System 🔔
**Priority:** 🔴 CRITICAL (Medication reminders)
**Time:** 4 days
**Endpoints:**
- `POST /api/notifications` - Create notification
- `GET /api/notifications` - List notifications
- `PUT /api/notifications/:id/read` - Mark as read
- `DELETE /api/notifications/:id` - Delete notification
**Key Features:**
- Medication reminders (time-based)
- Missed dose alerts
- Simple in-app notifications
- Email notification support (basic)
**Model:** Create `Notification` model
**Handler:** `backend/src/handlers/notifications.rs`
**Notification Types:**
- `MEDICATION_REMINDER`
- `MISSED_DOSE`
- `SHARING_INVITE`
- `HEALTH_ALERT`
---
### Sprint 3: Polish & Integration (Week 3)
#### Task 3.1: Lab Results (If Time) 🧪
**Priority:** 🟡 NICE-TO-HAVE
**Time:** 3 days
**Endpoints:**
- `POST /api/lab-results` - Add lab result
- `GET /api/lab-results` - List results
- `GET /api/lab-results/:id` - Get result
**Handler:** `backend/src/handlers/lab_results.rs`
---
#### Task 3.2: Comprehensive Testing 🧪
**Priority:** 🔴 CRITICAL
**Time:** 2 days
- Integration tests for all MVP features
- End-to-end workflows
- Performance testing
- Security testing
---
#### Task 3.3: API Documentation 📚
**Priority:** 🟡 IMPORTANT
**Time:** 2 days
- OpenAPI/Swagger spec
- Endpoint documentation
- Example requests/responses
---
## 📊 MVP Completion Criteria
### Must Have for MVP ✅
- [x] Users can create profiles for family members
- [x] Users can add medications with schedules
- [x] Users can log medication doses
- [x] Users can track health statistics (weight, BP, etc.)
- [x] Users can view trends over time
- [x] Users receive medication reminders
- [x] Users can share health data with family
- [x] All data is private and secure
- [x] Multi-person support works
### Nice to Have for MVP 🎁
- [ ] Lab result tracking
- [ ] Appointment scheduling
- [ ] Document upload
- [ ] Advanced analytics
- [ ] Data export
---
## 🎯 MVP User Stories
### Story 1: Parent Tracking Child's Medication
**As** a parent
**I want** to add my child's medication and set reminders
**So that** I never miss a dose
**Tasks:**
- Create profile for child
- Add medication with schedule
- Receive daily reminder
- Log dose when given
- View adherence history
---
### Story 2: Individual Tracking Blood Pressure
**As** an individual monitoring my health
**I want** to track my blood pressure daily
**So that** I can see trends and share with my doctor
**Tasks:**
- Create health stat entry for BP
- View BP trend over time
- Identify abnormal readings
- Export data for doctor
---
### Story 3: Family Sharing Health Data
**As** a caregiver
**I want** to view my elderly parent's medications
**So that** I can help them manage their health
**Tasks:**
- Parent creates share link
- Caregiver accesses shared data
- View medications and schedules
- See adherence data
---
## 📁 Files to Create (MVP-Focused)
### Handlers (4 critical)
```
backend/src/handlers/
├── medications.rs # MVP CRITICAL
├── health_stats.rs # MVP CRITICAL
├── notifications.rs # MVP CRITICAL
└── profiles.rs # MVP CRITICAL (multi-person)
```
### Models (1 new)
```
backend/src/models/
└── notification.rs # Notification model
```
### Tests
```
backend/tests/
└── mvp_tests.rs # MVP integration tests
```
### Scripts
```
backend/
├── test-mvp-workflow.sh # End-to-end MVP test
└── mvp-demo-data.sh # Seed demo data
```
---
## 🔒 MVP Security Requirements
### All Endpoints Must:
1. **Profile Isolation** - Users can only access their profiles
2. **Permission Checks** - Use existing permission middleware
3. **Audit Logging** - Log all health data access
4. **Input Validation** - Sanitize all health data
### Special Considerations:
- **Children's data** - Extra protection
- **Sharing** - Explicit consent only
- **Reminders** - No sensitive data in notifications
---
## 📅 Revised Timeline
### Week 1: Core MVP
- **Days 1-3:** Medication management
- **Days 4-6:** Health statistics
- **Day 7:** Profile management
### Week 2: Sharing & Notifications
- **Days 1-3:** Health sharing
- **Days 4-7:** Notification system
### Week 3: Polish
- **Days 1-3:** Lab results (if time)
- **Days 4-5:** Integration testing
- **Days 6-7:** Documentation & deployment
---
## ✅ Definition of Done (MVP)
### Functional
- All MVP endpoints work
- Multi-person profiles work
- Medication reminders work
- Health trends work
- Sharing works
- All tests pass
### Non-Functional
- < 500ms response time
- 80%+ test coverage
- No security vulnerabilities
- Production-ready
- Deployed to Solaria
---
## 🚀 Getting Started (MVP-Focused)
### Step 1: Create MVP branch
```bash
git checkout -b phase-2.7-mvp
```
### Step 2: Start with highest value
Begin with **medications** - it's the core MVP feature
### Step 3: Build incrementally
1. Medications (3 days)
2. Health stats (3 days)
3. Profiles (1 day)
4. Sharing (3 days)
5. Notifications (4 days)
### Step 4: Test & deploy
Comprehensive testing, then deploy to Solaria
---
## 📊 Success Metrics (MVP)
### Technical
- ✅ All MVP endpoints operational
- ✅ < 500ms p95 response time
- ✅ 99.9% uptime
- ✅ Zero security issues
### User Value
- ✅ Can manage medications for family
- ✅ Can track health trends
- ✅ Can receive reminders
- ✅ Can share with caregivers
---
## 🎯 Next Phase Preview
### Phase 3: Frontend Development
After MVP backend is complete:
- React web app (mobile-first)
- Profile switching UI
- Medication dashboard
- Health trend charts
- Notification center
- Sharing management
---
## 📝 Summary
**Phase 2.7 is now MVP-focused and prioritized.**
**Key Changes:**
- ✅ Medications moved to CRITICAL (was just "first")
- ✅ Health stats moved to CRITICAL (core value)
- ✅ Notifications added as CRITICAL (adherence)
- ✅ Profiles prioritized (multi-person support)
- ⚠️ Lab results demoted to NICE-TO-HAVE
- ⚠️ Appointments demoted to NICE-TO-HAVE
- ❌ Documents removed from MVP (defer to Phase 4)
**Focus:** Build the MINIMUM viable product that delivers core value:
1. Track medications
2. Track health stats
3. Set reminders
4. Share with family
**Estimated time:** 2-3 weeks (same, but focused on MVP)
**Ready to start?** Begin with **Task 1.1: Medication Management** - the heart of the MVP!
---
**📄 Saved to:** `PHASE_2.7_MVP_PRIORITIZED_PLAN.md`