Skip to content

[WIP] Add competitor sentiment view to dashboard and reports - #23

Merged
jaydestro merged 2 commits into
mainfrom
copilot/featcompetitor-sentiment-dashboard
Jul 20, 2026
Merged

[WIP] Add competitor sentiment view to dashboard and reports#23
jaydestro merged 2 commits into
mainfrom
copilot/featcompetitor-sentiment-dashboard

Conversation

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
  • Understand existing codebase (competitors.mjs, report-index.mjs, server.js, dashboard-enhancer.js)
  • Extend _buildIndex in server.js to include competitorAggregates + competitorSourceFailures in reportsMeta
  • Add /api/competitor-sentiment GET endpoint in server.js
  • Add competitor signals card HTML to index.html (in Community signals section, visually distinct)
  • Add loadCompetitorSentiment() to dashboard-enhancer.js — per-competitor rows, sentinel states, link to Reports → Competitors
  • Populate full report Competitor & Market Signals inline section from structured data (via buildCompetitorSectionMd + enhanced readMarkdown)
  • Add tests to report-index.test.js for partial-source states, reconciliation, multiple competitors, and round-trip JSON sidecar

@jaydestro

Copy link
Copy Markdown
Owner

Closes: #17

@jaydestro
jaydestro marked this pull request as ready for review July 20, 2026 16:44
…ection

- Extend _buildIndex in server.js to include competitorAggregates and
  competitorSourceFailures in each report's metadata entry, enabling
  the new API endpoint to serve them without re-parsing reports.

- Add GET /api/competitor-sentiment endpoint that returns per-slug
  competitor mention volumes, sentiment distributions, source coverage,
  and failure states from the most recent scan with competitor data.
  Falls back to the newest scan when no scan has competitor mentions,
  so the endpoint always responds with a usable structure.

- Add buildCompetitorSectionMd() helper and enhance readMarkdown() in
  server.js to synthesise a ## Competitor & Market Signals markdown
  section from the JSON sidecar when the markdown report omits it.
  The Reports → Competitors tab extraction regex already matches the
  generated heading, so both the full report view and the tab work
  consistently from the same structured data.

- Add #dash-competitor-sentiment-card HTML card to index.html in the
  Community signals dashboard section, visually distinct from the
  primary sentiment card via a left accent border.

- Add loadCompetitorSentiment() to dashboard-enhancer.js which fetches
  /api/competitor-sentiment and renders per-competitor rows (mention
  count, sentiment dot-bar, sources), stale-data and partial-coverage
  banners, and an Open report button that navigates to the Reports →
  Competitors tab. Handles no-config, no-data, error, and loading states.

- Add competitor card styles to theme-scout.css: .dash-competitor-card,
  .comp-group, .comp-table, .comp-sent-dot, .comp-partial-warning, etc.

- Add four new tests to report-index.test.js covering:
  - Reconciliation: competitor mentions do not affect primary sentiment totals
  - Partial-source failures propagated correctly
  - Multiple competitors aggregated independently
  - Round-trip through JSON sidecar (loadReport preserves competitor fields)

Co-authored-by: jaydestro <2974195+jaydestro@users.noreply.github.com>
@jaydestro
jaydestro merged commit c587cf7 into main Jul 20, 2026
3 checks passed
@jaydestro
jaydestro deleted the copilot/featcompetitor-sentiment-dashboard branch July 20, 2026 16:56
Copilot stopped work on behalf of jaydestro due to an error July 20, 2026 16:56
Copilot AI requested a review from jaydestro July 20, 2026 16:56
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.

Surface competitor sentiment in the dashboard and full report

2 participants