This commit implements the complete medication management system, which is a critical MVP feature for Normogen. Features Implemented: - 7 fully functional API endpoints for medication CRUD operations - Dose logging system (taken/skipped/missed) - Real-time adherence calculation with configurable periods - Multi-person support for families managing medications together - Comprehensive security (JWT authentication, ownership verification) - Audit logging for all operations API Endpoints: - POST /api/medications - Create medication - GET /api/medications - List medications (by profile) - GET /api/medications/:id - Get medication details - PUT /api/medications/:id - Update medication - DELETE /api/medications/:id - Delete medication - POST /api/medications/:id/log - Log dose - GET /api/medications/:id/adherence - Calculate adherence Security: - JWT authentication required for all endpoints - User ownership verification on every request - Profile ownership validation - Audit logging for all CRUD operations Multi-Person Support: - Parents can manage children's medications - Caregivers can track family members' meds - Profile-based data isolation - Family-focused workflow Adherence Tracking: - Real-time calculation: (taken / total) × 100 - Configurable time periods (default: 30 days) - Tracks taken, missed, and skipped doses - Actionable health insights Files Modified: - backend/src/handlers/medications.rs - New handler with 7 endpoints - backend/src/handlers/mod.rs - Added medications module - backend/src/models/medication.rs - Enhanced with repository pattern - backend/src/main.rs - Added 7 new routes Phase: 2.7 - Task 1 (Medication Management) Status: Complete and production-ready Lines of Code: ~550 lines
68 lines
1.5 KiB
YAML
68 lines
1.5 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
mongodb:
|
|
image: mongo:6.0
|
|
container_name: normogen-mongodb
|
|
restart: unless-stopped
|
|
ports:
|
|
- "27017:27017"
|
|
environment:
|
|
MONGO_INITDB_DATABASE: normogen
|
|
volumes:
|
|
- mongodb_data:/data/db
|
|
- mongodb_config:/data/configdb
|
|
networks:
|
|
- normogen-network
|
|
healthcheck:
|
|
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
backend:
|
|
build:
|
|
context: ..
|
|
dockerfile: docker/Dockerfile.improved
|
|
image: normogen-backend:latest
|
|
container_name: normogen-backend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8001:8000"
|
|
environment:
|
|
RUST_LOG: ${RUST_LOG:-info}
|
|
MONGODB_URI: mongodb://mongodb:27017
|
|
MONGODB_DATABASE: ${MONGODB_DATABASE:-normogen}
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
SERVER_PORT: 8000
|
|
SERVER_HOST: 0.0.0.0
|
|
depends_on:
|
|
mongodb:
|
|
condition: service_healthy
|
|
networks:
|
|
- normogen-network
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 512M
|
|
reservations:
|
|
cpus: '0.25'
|
|
memory: 128M
|
|
|
|
volumes:
|
|
mongodb_data:
|
|
driver: local
|
|
mongodb_config:
|
|
driver: local
|
|
|
|
networks:
|
|
normogen-network:
|
|
driver: bridge
|