Skip to content

feat: daily granularity for sentiment-overview endpoint | LLMO-5307#2551

Open
aniham wants to merge 1 commit into
mainfrom
LLMO-5307
Open

feat: daily granularity for sentiment-overview endpoint | LLMO-5307#2551
aniham wants to merge 1 commit into
mainfrom
LLMO-5307

Conversation

@aniham

@aniham aniham commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

https://jira.corp.adobe.com/browse/LLMO-5307

Summary

Adds granularity=day query parameter to
GET /org/:spaceCatId/brands/{all|:brandId}/brand-presence/sentiment-overview.

  • Backward compatible — omitting granularity or passing week produces the existing
    weeklyTrends response unchanged (now also includes granularity: "week" and
    dailyTrends: [])
  • granularity=day returns one bucket per calendar date in dailyTrends; each entry
    carries date (YYYY-MM-DD), week (ISO week string), and the same sentiment/prompt
    shape as weekly
  • 90-day range cap enforced for daily granularity; invalid values return 400
  • Passes p_granularity to the RPC (requires the mysticat-data-service migration deployed first)
  • Adds aggregateSentimentByDay as a JS reference implementation and test oracle
    (same dedup and percentage rules as aggregateSentimentByWeek)

Files changed

File Change
src/controllers/llmo/llmo-brand-presence.js aggregateSentimentByDay, updated createSentimentOverviewHandler
test/controllers/llmo/llmo-brand-presence.test.js 9 aggregator tests + 6 handler tests for daily path

Test plan

  • npm test passes (11 k+ tests, no regressions)
  • Weekly request (no granularity param) → response shape unchanged, weeklyTrends populated
  • granularity=day with 28-day range → dailyTrends array, one entry per date
  • granularity=day with 91-day range → 400 Date range too large for daily granularity (max 90 days)
  • granularity=month → 400 granularity must be 'week' or 'day'

Deploy order

  1. mysticat-data-service (RPC migration) — deploy first
  2. This PR
  3. project-elmo-ui (pass granularity=day for daily-prompt sites) — separate PR

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@aniham aniham temporarily deployed to dev-branches June 4, 2026 03:54 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant