Files
maternal-app/maternal-app
Andrei 2c9ae0c3bf
Some checks failed
CI/CD Pipeline / Build Application (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
feat: Implement analytics comparison endpoint for multi-child analysis
Comparison API:
- GET /api/v1/analytics/compare?childIds=id1,id2&metric=sleep-patterns&startDate=...&endDate=...
- Supports 2+ children comparison
- Validates user access to all children
- Date range validation with ISO 8601 format

Supported Metrics:
- sleep-patterns: Average hours, night sleep %, nap frequency, daily breakdown
- feeding-frequency: Total feedings, average per day, methods, amounts
- diaper-changes: Total changes, wet/dirty/both breakdown
- activities: Total count, types distribution, most common activity

ComparisonService:
- compareSleepPatterns() - Detailed sleep analysis with night vs day sleep
- compareFeedingFrequency() - Feeding patterns and methods tracking
- compareDiaperChanges() - Diaper change patterns by type
- compareActivities() - Activity type distribution and frequency

Response Structure:
{
  metric: "sleep-patterns",
  dateRange: { start, end },
  children: [{
    childId, childName, age,
    data: { detailed metrics },
    summary: { key stats }
  }],
  overallSummary: {
    averageAcrossChildren,
    childWithMost/Least,
    ...
  }
}

Daily Breakdown:
- Each metric includes day-by-day data
- Allows chart rendering on frontend
- Supports trend analysis

Use Cases:
- "How does Emma's sleep compare to Noah's?"
- "Which child eats more frequently?"
- "Compare diaper patterns for twins"
- Side-by-side analytics dashboards

Security:
- Family-level permission checks
- User must have access to all children
- Cross-family comparison supported

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 21:24:02 +00:00
..
2025-10-01 19:01:52 +00:00
2025-10-01 19:01:52 +00:00
2025-10-01 19:01:52 +00:00
2025-10-01 19:01:52 +00:00
2025-10-01 19:01:52 +00:00
2025-10-01 19:01:52 +00:00
2025-10-01 19:01:52 +00:00
2025-10-01 19:01:52 +00:00