BloomTech-Labs/underdog-devs-ds-a

DS Bug: sentiment analysis

randynobx opened this issue · 0 comments

Issue:
The application of sentiment.py/sentiment_rank is inconsistent and duplicated across the DS API codebase.

Description:
The analysis and addition of sentiment_rank to Feedback objects occur in both app/routers/feedback_router.py and data_generators/seeds.py. They are applied to different keys in the feedback dictionary before being passed to MongoDB. One saves the analysis to the vader_score field, and the other to the sentiment field of the dictionary.

This behavior will cause issues when attempting to retrieve the sentiment analysis from the database and should be addressed.

ToDo:

  1. Consolidate the application of sentiment_rank to Feedback dictionaries into a new function located in app/sentiment.py.
    • The run_sentiment() in data_generators/seeds.py should be removed
    • New function should take a feedback dictionary, run sentiment_rank() on the text field, and return the dict with an additional sentiment field containing the output from sentiment_rank()
  2. Replace current applications of sentiment_rank in the seeds.py and feedback_router.py modules with the new function.
    • Ensure consistency across the API and data_generator code behavior.