feat: show nutrition source quality - #2313
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
📝 WalkthroughWalkthroughNutrition analytics now separates itemized food, provider daily totals, and supplements; reports selected-window data quality; and renders source context in web and mobile interfaces. ChangesNutrition analytics source context
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant AnalyticsScreen
participant NutritionAnalyticsRouter
participant NutritionAnalyticsRepository
participant Postgres
AnalyticsScreen->>NutritionAnalyticsRouter: request micronutrientAdequacyV2
NutritionAnalyticsRouter->>NutritionAnalyticsRepository: fetch nutrient review and data quality
NutritionAnalyticsRepository->>Postgres: query source classifications and daily resolution
Postgres-->>NutritionAnalyticsRepository: contributions and quality rows
NutritionAnalyticsRepository-->>NutritionAnalyticsRouter: expanded analytics result
NutritionAnalyticsRouter-->>AnalyticsScreen: nutrients, sourceBreakdown, and dataQuality
Assessment against linked issues
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (1 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideImplements server-computed nutrition data quality and source breakdown for micronutrient analytics, extending the analytics query and DTOs to distinguish itemized food, provider daily totals, and supplements, and surfaces this context with new UI panels and tests on web and mobile. Sequence diagram for micronutrientAdequacyV2 with data quality and source breakdownsequenceDiagram
actor User
participant Client as WebOrMobileClient
participant Router as nutritionAnalyticsRouter
participant Repo as NutritionAnalyticsRepository
participant DB as Postgres
User->>Client: Open NutritionAnalyticsPage / NutritionAnalyticsScreen
Client->>Router: trpc.nutritionAnalytics.micronutrientAdequacyV2({ days })
Router->>Repo: new NutritionAnalyticsRepository(...)
Router->>Repo: getMicronutrientSafetyReview(days)
Repo->>DB: executeWithSchema(..., micronutrient query)
DB-->>Repo: nutrient rows with source_breakdown
Repo-->>Router: MicronutrientSafetyReview[]
Router->>Repo: getMicronutrientDataQuality(days)
Repo->>DB: executeWithSchema(..., NutritionAnalyticsDataQuality query)
DB-->>Repo: daily rows from fitness.v_nutrition_daily
Repo-->>Router: NutritionAnalyticsDataQuality
Router->>Repo: getSupplementMedicationReview()
Repo->>DB: executeWithSchema(..., supplement query)
DB-->>Repo: supplement rows
Repo-->>Router: SupplementMedicationReview
Router-->>Client: MicronutrientSafetyReviewResult
activate Client
Client->>Client: MicronutrientChart uses intake.sourceBreakdown
Client->>Client: NutritionDataQualityPanel uses dataQuality
deactivate Client
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Summary by QodoShow nutrition analytics data quality and per-source contributions
AI Description
Diagram
High-Level Assessment
Files changed (23)
|
Mobile PreviewScan to open on device:
To test on device:
|
|
Storybook previews for This comment updates automatically on each PR push. |
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/mobile/components/NutritionDataQualityPanel.test.tsx`:
- Around line 11-46: Add a test case for the all-history branch of
NutritionDataQualityPanel by passing selectedWindowDays: null with data
representing 20 usable recorded days, then assert the rendered text is “20
recorded days are usable.” Keep the existing bounded-window and loading tests
unchanged.
In `@packages/mobile/components/NutritionDataQualityPanel.tsx`:
- Line 38: Update the panel View in NutritionDataQualityPanel so it does not
hide descendant accessibility content: remove the accessible grouping and label,
or replace the label with the complete coverage, conflict, and source summaries
while preserving separate loading, error, and data-state announcements.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: bfac508e-8a26-4648-b7ef-a7b57a7568ed
📒 Files selected for processing (23)
docs/superpowers/plans/2026-07-29-nutrition-source-breakdown.mdpackages/mobile/.storybook/nutrition-analytics-story-link.tspackages/mobile/app/nutrition-analytics.test.tsxpackages/mobile/app/nutrition-analytics.tsxpackages/mobile/components/NutritionDataQualityPanel.stories.tsxpackages/mobile/components/NutritionDataQualityPanel.test.tsxpackages/mobile/components/NutritionDataQualityPanel.tsxpackages/nutrition/README.mdpackages/server/src/repositories/nutrition-analytics-repository.test.tspackages/server/src/repositories/nutrition-analytics-repository.tspackages/server/src/repositories/nutrition-analytics-source-breakdown.integration.test.tspackages/server/src/routers/nutrition-analytics.test.tspackages/server/src/routers/nutrition-analytics.tspackages/web/src/components/MicronutrientChart.stories.tsxpackages/web/src/components/MicronutrientChart.test.tsxpackages/web/src/components/MicronutrientChart.tsxpackages/web/src/components/NutritionDataQualityPanel.stories.tsxpackages/web/src/components/NutritionDataQualityPanel.test.tsxpackages/web/src/components/NutritionDataQualityPanel.tsxpackages/web/src/components/SupplementSafetyReviewPanel.stories.tsxpackages/web/src/components/SupplementSafetyReviewPanel.test.tsxpackages/web/src/components/TimeRangeSelector.consumers.test.tsxpackages/web/src/pages/NutritionAnalyticsPage.tsx
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
Code Review by Qodo
Context used✅ Compliance rules (platform):
206 rules✅ Skills:
fix-provider, write-tests, cloudflare 1.
|
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
dec2ef2 to
46af337
Compare
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
Summary
Validation
pnpm vitest run --project unit packages/server/src/repositories/nutrition-analytics-repository.test.ts packages/server/src/routers/nutrition-analytics.test.tsTEST_DATABASE_URL=... pnpm vitest run --project integration packages/server/src/repositories/nutrition-analytics-source-breakdown.integration.test.tspnpm --dir packages/web buildpnpm test: 14,770 passed, 21 skipped; local command exited after an unrelated Docker-hung Compose test caused a Vitest worker RPC timeoutpnpm lint: code and policy checks passed; local analytics SQL validation could not connect to ClickHouseFixes #2136
Summary by Sourcery
Expose nutrition analytics source quality and per-source contributions across server, web, and mobile.
New Features:
Enhancements:
Tests:
Summary by cubic
Shows nutrition data source quality and per-source contributions on web and mobile, computed on the server. Implements #2136 with completeness/overlap context and split averages for itemized food, provider daily totals, and supplements.
New Features
packages/server):NutritionAnalyticsRepositoryreturns per‑nutrientsourceBreakdown, addsproviderDailyTotalAverage, andgetMicronutrientDataQuality()(coverage, overlap, conflicts, contributing/excluded labels); router addsdataQualitytonutritionAnalytics.micronutrientAdequacyV2.packages/web) and Mobile (packages/mobile):NutritionDataQualityPanelappears before charts; nutrient rows/tooltips show itemized food, provider daily totals, supplements, and escaped per‑source contributions.@dofek/nutritionfor reuse in both clients.packages/nutrition/README.md; recorded an Infisical iOS CI timeout indocs/production-incident-baseline.md.Bug Fixes
Written for commit 4e10645. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation