Repository navigation
fix(insights): divide Positive Sentiment by brand-mentioning results,… - #512
Conversation
|
Solid fix — the RPC body is faithful to the current definition on main (only the new counter + JSON key added), the cur/prev sentiment windows use the same denominator, and going through One mechanical blocker before this can land: #511 merged this morning and took migration numbers
Will approve as soon as the rebase is up. (Note for after merge: the migration gets applied to the hosted project by a maintainer — nothing you need to do there.) |
644746d to
71c354f
Compare
|
@gkhngyk done the rebase and the needed changes. |
Summary
The "Positive Sentiment" KPI on the Insights dashboard divided
positive_countby
total_results— but sentiment analysis is skipped entirely for answersthat never mention the brand, so those rows sit in the denominator and can
never be positive. On brands with low mention volume this collapses the
score toward zero (e.g. a real 43% positive rate among brand-mentioning
answers displayed as ~1% once 13,002 brand-absent rows were mixed in).
This adds
mentioning_results(mention_count > 0 OR citation_count > 0) tothe
insights_aggregates()RPC and divides by that instead, with an explicitzero-guard for brands that are tracked but never mentioned in the selected
window. Same fix covers the Insights dashboard, the Topics detail page, and
Reports (PDF + web), since they all read from
getInsightsSummary().Related issue
Closes #508
Type of change
fix— Bug fixChecklist
feature/,fix/,chore/,docs/)yarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)