Skip to content

feat(data-processing): add visual sentiment indicators for news & assets (#414)#506

Merged
Cedarich merged 3 commits intoPulsefy:mainfrom
titilayo967:feature/Visual-Sentiment-Indicators-for-News-and-Assets
Mar 29, 2026
Merged

feat(data-processing): add visual sentiment indicators for news & assets (#414)#506
Cedarich merged 3 commits intoPulsefy:mainfrom
titilayo967:feature/Visual-Sentiment-Indicators-for-News-and-Assets

Conversation

@titilayo967
Copy link
Copy Markdown
Contributor

Summary

Integrates color-coded sentiment indicators (Green/Bullish, Red/Bearish, Gray/Neutral) into News and Asset API responses, adding sentiment badges and a legend endpoint for frontend visualization.

Linked Issue

Closes #414

Type of Change

  • feat
  • fix
  • docs
  • refactor
  • test
  • chore

Validation

  • Lint passed
  • Tests passed
  • Manual verification completed

Documentation

  • Documentation updated (or N/A with explanation)
  • Screenshots/videos attached for UI changes

Files Added/Modified

File Description
apps/data-processing/src/analytics/sentiment_indicators.py Sentiment mapper utility (score → color/label/indicator)
apps/data-processing/tests/test_sentiment_indicators.py Unit tests for mapping and API schemas
apps/data-processing/src/api/server.py Extended responses with sentiment fields, added legend endpoint

API Changes

Endpoint Added Fields
GET /news sentiment_score, sentiment_label, indicator
POST /analyze indicator in response
GET /analyze indicator in response
GET /sentiment/legend Color legend and thresholds

Sentiment Mapping

Score Range Color Label Indicator
> 0.2 Green Bullish 🟢
-0.2 to 0.2 Gray Neutral
< -0.2 Red Bearish 🔴

Acceptance Criteria

  • News items return sentiment badge/color data
  • Asset analysis includes sentiment score and indicator
  • Legend endpoint provides color explanation
  • Boundary values handled correctly
  • Unit tests cover mapping, thresholds, and API responses

Checklist

  • Branch name uses feat/
  • Commit messages follow Conventional Commits

Closes #414

…ets (Pulsefy#414)

- Add SentimentIndicatorMapper utility in src/analytics/sentiment_indicators.py
  mapping scores (-1 to 1) to color-coded indicators (Green/Red/Gray)
- Extend NewsArticleResponse with sentiment_score, sentiment_label, and indicator fields
- Extend AnalyzeResponse and AssetAnalysisResponse with indicator field
- Add GET /sentiment/legend endpoint returning colour legend and thresholds
- Wire indicator into POST /analyze, GET /analyze, and GET /news responses
- Add comprehensive test suite in tests/test_sentiment_indicators.py covering
  score→color mapping, boundary values, display text, legend, and API schemas
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@titilayo967 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

- add missing test dependency httpx to requirements
- prevent import-time crash when API_KEY is unset by deferring auth enforcement to request-time
- return JSON auth errors from security middleware instead of bubbling exceptions
- exempt /sentiment/legend from API-key middleware to match endpoint contract
- make SlowAPI-compatible endpoint signatures by using request: Request on rate-limited handlers
- silence Pydantic protected namespace warning for model_backend via ConfigDict(protected_namespaces=())
@titilayo967
Copy link
Copy Markdown
Contributor Author

@Cedarich check has passed.

@Cedarich Cedarich merged commit 1662772 into Pulsefy:main Mar 29, 2026
1 check passed
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.

Visual Sentiment Indicators for News & Assets

2 participants