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

@ -1,21 +1,25 @@
# Normogen Project Status
## Project Overview
**Project Name**: Normogen (Balanced Life in Mapudungun)
**Goal**: Open-source health data platform for private, secure health data management
**Current Phase**: Phase 2.8 - Drug Interactions & Advanced Features (Planning)
**Last Updated**: 2026-03-09 10:43:00 UTC
**Project Name**: Normogen (Balanced Life in Mapudungun)
**Goal**: Open-source health data platform for private, secure health data management
**Current Phase**: Phase 2.8 — Implemented (drug interactions live). Open work is the frontend (Phase 3).
**Last Updated**: 2026-06-27
---
## 📊 Overall Progress
## 📊 Overall Status
| Component | Progress | Status |
|-----------|----------|--------|
| **Backend** | 91% | 🚧 Active Development |
| **Frontend** | 10% | 🚧 Early Development |
| **Testing** | 85% | ✅ Good Coverage |
| **Deployment** | 100% | ✅ Production Ready |
| Area | Status |
|------|--------|
| **Backend** | ✅ Phase 2.x feature-complete (through drug interactions). Production-deployed on Solaria. |
| **Security** | ✅ Hardening pass complete (token-version validation, refresh-token persistence, fail-fast config, real-IP audit). |
| **Tests** | ✅ 18 unit tests + 13 integration tests (auth + medication flows), CI-gated with a MongoDB service. |
| **Frontend** | 🚧 Early — Login/Register pages + API/store layer exist; router not yet wired; no dashboard. |
| **Deployment** | 🚧 Docker image is built manually (CI can't run DinD on Forgejo); otherwise operational. |
The backend implements every planned 2.x phase. The honest open work is the
**frontend** (Phase 3) and the operational gaps noted at the bottom.
---
@ -103,31 +107,41 @@
---
#### Phase 2.7: Health Data Features 🚧 91% COMPLETE
#### Phase 2.7: Health Data Features ✅ IMPLEMENTED
- [x] Medication management (CRUD operations)
- [x] Medication adherence tracking
- [x] Health statistics tracking (weight, BP, etc.)
- [x] Lab results storage
- [x] OpenFDA API integration for drug data
- [x] Comprehensive test coverage
- [ ] Drug interaction checking (moved to Phase 2.8)
- [ ] Full integration testing (in progress)
**Completed**: 2026-03-08 (91%)
**Completed**: 2026-03-08
---
#### Phase 2.8: Advanced Features & Enhancements 📋 PLANNING (0%)
- [ ] Drug interaction checking
- [ ] Automated reminder system
- [ ] Advanced health analytics
- [ ] Healthcare data export (FHIR, HL7)
- [ ] Medication refill tracking
- [ ] User preferences
- [ ] Caregiver access
#### Phase 2.8: Drug Interactions ✅ IMPLEMENTED
- [x] Drug interaction checking (`/api/interactions/check`, `/check-new`)
- [x] Ingredient mapper
- [x] Interaction service (in-memory interaction data)
- [ ] Automated reminder system *(not yet started)*
- [ ] Advanced health analytics *(not yet started)*
- [ ] Healthcare data export (FHIR, HL7) *(not yet started)*
- [ ] Medication refill tracking *(not yet started)*
- [ ] Caregiver access *(not yet started)*
**Estimated Start**: 2026-03-10
**Estimated Duration**: 2-3 weeks
**Completed (core)**: drug interaction checking is live. The remaining items are
future enhancements; see the [roadmap](./ROADMAP.md).
---
#### P0/P1 Security + Tests ✅ IMPLEMENTED
- [x] `token_version` validation in the JWT middleware (stale tokens rejected after password change)
- [x] Refresh tokens persisted **hashed** in MongoDB (survive restarts; revocable)
- [x] `/api/auth/refresh` (rotation + reuse detection) and `/api/auth/logout`
- [x] Fail-fast config (`APP_ENVIRONMENT=production` rejects insecure `JWT_SECRET`/`ENCRYPTION_KEY`)
- [x] Real client-IP resolution in audit logs (`X-Forwarded-For``X-Real-IP` → socket)
- [x] Handler `.unwrap()` cleanup (panics → clean error responses)
- [x] Integration tests rewritten against an isolated test DB
---
@ -182,48 +196,30 @@
## Current Status
**Active Development**: Phase 2.8 - Drug Interactions & Advanced Features
**Backend Status**: 91% complete, production-ready for most features
**Frontend Status**: 10% complete, basic structure exists
**Database**: MongoDB 7.0
**Deployment**: Docker on Solaria (homelab)
**Test Coverage**: 85%
**Backend**: Phase 2.x feature-complete; deployed on Solaria (Docker).
**Frontend**: Early stage — Login/Register pages + API/store layer; router not yet wired.
**Database**: MongoDB 7.0
**Deployment**: Docker on Solaria (homelab); image built manually (not in CI).
**Tests**: 18 unit + 13 integration (auth + medication), CI-gated with MongoDB.
---
## Recent Updates
### Phase 2.7 Progress (2026-03-08)
- ✅ **Completed**: Medication management backend (91%)
- CRUD operations for medications
- Dose logging and adherence tracking
- OpenFDA integration for drug data
- Comprehensive test suite
- 🚧 **In Progress**: Integration testing and documentation
- 📋 **Moved to Phase 2.8**: Drug interaction checking (to be implemented with interactions handler)
### Phase 2.6 Complete (2026-02-20)
- ✅ **Security Hardening Complete**
- Rate limiting with tower-governor
- Account lockout policies
- Security audit logging
- Session management API
### Known security gaps (tracked, not in current scope)
- Rate limiting middleware is a stub (deferred).
- A few borderline `.unwrap()` calls remain in repository `inserted_id` paths.
---
## Tech Stack
### Backend
- **Language**: Rust 1.93
- **Language**: Rust (edition 2021)
- **Framework**: Axum 0.7 (async web framework)
- **Database**: MongoDB 7.0
- **Authentication**: JWT (jsonwebtoken 9)
- Access tokens: 15 minute expiry
- Refresh tokens: 30 day expiry
- Access tokens: default 15 minute expiry (configurable)
- Refresh tokens: default 7 day expiry (configurable); stored hashed in MongoDB, rotated, revocable
- **Password Security**: PBKDF2 (100K iterations)
- **Deployment**: Docker, Docker Compose
- **Security**: `token_version` invalidation; account lockout; audit logging with real client-IP resolution
- **Deployment**: Docker, Docker Compose (image built manually)
- **CI/CD**: Forgejo Actions
### Frontend
@ -290,30 +286,22 @@
- ✅ `DELETE /:id` - Delete health stat
- ✅ `GET /trends` - Get trends
### Drug Interactions (`/api/interactions`) *(Phase 2.8)*
- ✅ `POST /check` - Check interactions between a set of medications
- ✅ `POST /check-new` - Check a new medication against existing ones
### Health Check
- ✅ `GET /health` - Health check endpoint
- ✅ `GET /ready` - Readiness check endpoint
---
## Next Milestones
1. 📋 **Phase 2.8** - Drug Interactions & Advanced Features (Planning)
- Drug interaction checking
- Automated reminders
- Advanced analytics
- Data export (FHIR, HL7)
2. 🔮 **Phase 3.0** - Frontend Development (Planned)
- Complete React app
- Dashboard and visualization
- Medication management UI
3. 🔮 **Phase 4.0** - Mobile Development (Future)
- iOS and Android apps
4. 🔮 **Phase 5.0** - Advanced Features (Future)
- AI/ML features
- Third-party integrations
1. 🚧 **Phase 3 — Frontend** — wire the router, build the dashboard and feature UIs.
2. 🔮 **Phase 2.8 follow-ups** — reminders, analytics, data export, caregiver access.
3. 🔮 **Phase 4 — Mobile** — iOS and Android apps.
4. 🔮 **Phase 5 — Advanced** — integrations, AI/ML features.
---
@ -343,6 +331,5 @@ tower-governor = "0.4.3"
---
**Last Updated**: 2026-03-09 10:43:00 UTC
**Next Review**: After Phase 2.8 completion
**Last Updated**: 2026-06-27
**Maintained By**: Project maintainers