feat: implement health statistics tracking (Phase 2.7 Task 2)

- Add HealthStatistics model with 10 stat types
- Implement HealthStatisticsRepository
- Create 6 health stats API endpoints
- Add trend analysis with summary calculations
- Follow medication repository pattern

Status: 60% complete, needs compilation fixes
This commit is contained in:
goose 2026-03-07 16:24:18 -03:00
parent d673415bc6
commit b59be78e4a
18 changed files with 2420 additions and 7 deletions

62
backend/deploy-and-test.sh Executable file
View file

@ -0,0 +1,62 @@
#!/bin/bash
echo "=========================================="
echo "Normogen Deployment & Testing Script"
echo "=========================================="
echo ""
# Step 1: Push to remote
echo "Step 1: Pushing to remote..."
git push origin main
if [ $? -ne 0 ]; then
echo "✗ Git push failed"
exit 1
fi
echo "✓ Git push successful"
echo ""
# Step 2: Connect to Solaria and update
echo "Step 2: Updating Solaria..."
ssh solaria 'cd /srv/normogen && git pull'
if [ $? -ne 0 ]; then
echo "✗ Git pull on Solaria failed"
exit 1
fi
echo "✓ Code updated on Solaria"
echo ""
# Step 3: Build new container
echo "Step 3: Building Docker container..."
ssh solaria 'cd /srv/normogen && docker compose -f docker/docker-compose.improved.yml build backend'
if [ $? -ne 0 ]; then
echo "✗ Docker build failed"
exit 1
fi
echo "✓ Docker build successful"
echo ""
# Step 4: Restart containers
echo "Step 4: Restarting containers..."
ssh solaria 'cd /srv/normogen && docker compose -f docker/docker-compose.improved.yml down && docker compose -f docker/docker-compose.improved.yml up -d'
if [ $? -ne 0 ]; then
echo "✗ Container restart failed"
exit 1
fi
echo "✓ Containers restarted"
echo ""
# Step 5: Wait for container to be healthy
echo "Step 5: Waiting for backend to be healthy..."
sleep 10
ssh solaria 'docker ps | grep normogen'
echo ""
# Step 6: Run API tests
echo "Step 6: Running API tests..."
chmod +x test-medication-endpoints.sh
./test-medication-endpoints.sh
echo ""
echo "=========================================="
echo "Deployment & Testing Complete"
echo "=========================================="