feat: SOV endpoints for LLMO | LLMO-3605#1994
Merged
Conversation
- Implemented `createShareOfVoiceHandler` to handle Share of Voice requests. - Added `volumeToPopularity` and `aggregateShareOfVoice` functions for processing data. - Registered new routes for Share of Voice in `index.js` and updated required capabilities. - Enhanced tests for Share of Voice functionality, including edge cases and data aggregation.
- Introduced comprehensive documentation for the Share of Voice API, detailing endpoints, parameters, and response structures. - Included examples for both all brands and specific brand queries. - Documented internal query logic and response processing for clarity on data aggregation and handling.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Added `maxCompetitors` parameter to the Share of Voice API documentation, allowing users to specify the maximum number of competitors returned per topic. - Updated the `createShareOfVoiceHandler` to handle the new parameter and default to 5 if not provided. - Modified the `volumeToPopularity` function to return 'Low' for null or zero volume values instead of 'N/A'. - Enhanced tests to verify the correct handling of the `maxCompetitors` parameter in RPC calls and updated expectations for popularity values.
|
This PR will trigger a minor release when merged. |
- Added comments to clarify the purpose of `TOP_COMPETITORS_DISPLAYED` and `DEFAULT_MAX_COMPETITORS` constants. - Simplified logging in `createShareOfVoiceHandler` by removing redundant size calculations for RPC response and share of voice data. - Enhanced readability and maintainability of the code by streamlining the logging process.
igor-grubic
approved these changes
Mar 20, 2026
solaris007
pushed a commit
that referenced
this pull request
Mar 20, 2026
# [1.362.0](v1.361.1...v1.362.0) (2026-03-20) ### Features * SOV endpoints for LLMO | LLMO-3605 ([#1994](#1994)) ([d315ec4](d315ec4))
Member
|
🎉 This PR is included in version 1.362.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes Made
Implements the Share of Voice API endpoint for brand presence, returning per-topic brand mention share, popularity, ranking, and competitor breakdowns.
createShareOfVoiceHandlerinllmo-brand-presence.jsthat calls therpc_share_of_voiceSupabase RPC and shapes the results intoShareOfVoiceData[]volumeToPopularityhelper to map imputed volume sentinel values (-30/-20/-10) and legacy positive values toHigh/Medium/Low/N/AcategoriesaggregateShareOfVoicehelper to group flat RPC rows by topic, compute per-entity share-of-voice percentages, rank competitors, and sort results by popularity then share of voicellmo-mysticat-controller.jsand wired up two new routes inroutes/index.js:GET /org/:spaceCatId/brands/all/brand-presence/share-of-voiceGET /org/:spaceCatId/brands/:brandId/brand-presence/share-of-voicebrand:readcapability requirements for both routes inrequired-capabilities.jsdocs/llmo-brandalf-apis/share-of-voice-api.mdRelated Issues
Relates to LLMO-3605
Testing the PR changes
brand:readtoken.GET /org/<orgId>/brands/<brandId>/brand-presence/share-of-voiceand confirm a200response with ashareOfVoiceDataarray.topic,popularity(High/Medium/Low/N/A),shareOfVoice,ranking,brandMentions,totalMentions,topCompetitors, andallCompetitors.brands/allvariant and confirm it returns aggregated data across all brands for the org.startDate,endDate,siteId,categoryId,topic,region,origin) and verify they are forwarded to the RPC correctly.siteId(one not belonging to the org) and confirm a403 Forbiddenresponse.401response.Please ensure your pull request adheres to the following guidelines:
describe here the problem you're solving.
If the PR is changing the API specification:
yet. Ideally, return a 501 status code with a message explaining the feature is not implemented yet.
If the PR is changing the API implementation or an entity exposed through the API:
If the PR is introducing a new audit type: