My Journey as a Backend Developer: Tackling AI-Powered Sentiment Analysis for Course Reviews
Tags: webdev, javascript, programming, node
Published: 2024-06-28 16:14:51

## INTRODUCTION

My name is Adekolu Samuel Oluwaseun, an undergraduate student of Veritas University Abuja studying Computer Science and Information Technology. I want to open up my journey as I talk about one of the most difficult backend projects I've worked on which I used as my final year project. But before that I'll like to say a little about myself, Python was one of the first programming language I learned, but I wasted a lot of time by not writing at an especially high volume. I had my first serious programming experience during the 6-month SIWES in 2023. While the organization I worked with as an intern (AUDA NEPAD) was not tech-focused, a friend by the name Mercy gave me her course from Udemy.The course which was taught by one of the best tutors in the tech space by the name Angela Yu was for HTML, CSS, JavaScript(Node js, Express. js, and more). Keeping up with the learning was a struggle but I kept going and attempted some more Frontend Mentor challenges to see how far i had come.

One Year year later, in 2024, I think I'll consider myself an intern-level developer looking to get hands on experience and wanting to be amongst other developers. So i registered for the HNG 11 internship even though I am an introvert and a person that cannot stay out of my comfort zone as it is very difficult to do but with advice from some friends and dad, I decided to go into this. One of my primary goal during the HNG internship is to work on projects where real-world impact can be seen and network in the right circles.
Now that you guys have an Idea about me let's talk about the backend project that pushed me to my limit.

## Building an AI-Powered Sentiment Analysis System

I have found one of the toughest projects to be my Final Year Project where I had built this AI-based Aspect Based Sentiment Analysis tool for course reviews. It aimed to invite students express course feedback in natural language, while the AI divides the content into seven categories and score sentiment (positive/ negative / neutral) respectively.
Initial Planning

I first came up with these requirements:

Student Route:

- Matric authentication with password.

- View submitted course forms.

- View course forms those not submitted

- Make reviews.

University Route:

- Create course review forms.

- Change form visibility.

- Update/delete forms.

- University Authentication

- View general reviews.

## 1. Implementing the Solution

Initially, I planned to handle authentication for both students and universities. However, after researching, I decided to manage authentication on the frontend using an authentication service called Auth0. This simplified the backend by removing the need for separate authentication routes for students and universities. Users authenticate via email/password or Google, receiving a unique ID stored in my database to identify them.

## 2. AI Model and Sentiment Analysis

My original plan was to fine-tune a BERT model using Python. However, due to my limited Python skills, I decided to use OpenAI's GPT-3.5 model. I sourced course review datasets from Hugging Face and created training data in OpenAI's JSONL file format for fine-tuning. The dataset can be accessed [here](https://huggingface.co/datasets/kkotkar1/course-reviews). The fine-tuned model performed well in splitting reviews into aspects and determining their sentiment.


## 3. Database and Schemas

I used MongoDB to store information and the Mongoose Node.js library to interact with the database. I created the following schemas:

- Course Feedback Form Schema
- Student Schema
- University Schema
- Student Feedback Schema

## Workflow
The architecture involves students submitting open-ended course reviews, which are processed by the AI model to extract aspects and sentiments. The results are then stored in the database. Here’s a simplified workflow:

1. Student Authentication: Using Auth0 on the frontend.

2. Review Submission: Students submit reviews.
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icimywaq74cotp1wpphh.jpg)
![_image showing Student course review route_](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbsdihhgox5rv6jmztza.jpg)

3. AI Processing: Reviews are processed by the fine-tuned GPT-3.5 model.
![_image showing the inference API to open AI to get course aspects_](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0fgpdmdk7rtmo6e8uan8.png)

4. Database Storage: Processed reviews are stored in MongoDB.
![_image showing the mongoose schema for course review storage_](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2thkxy5zy04zyg4iy0id.jpg)

5. University Access: Universities can create, update, and view reviews.
![_image showing university route_](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x69gy8lgqg1b3op1azlq.jpg)



## Final Thoughts

This project taught me a lot about backend development, AI integration, and real-world problem-solving. It was a challenging but rewarding experience that has prepared me for future projects. I'm eager to apply these skills in the HNG Internship, contribute to meaningful projects, and grow as a developer. The backend code can be reviewed on this github link [Class Insight Backend](https://github.com/SamixYasuke/Classinsight-Backend)
To access the full implementation you can use this web app link [class insight](https://class-insight-front-end.vercel.app/)

## Conclusion

Participating in the HNG Internship will provide me with the opportunity to work on real-world projects and connect with like-minded individuals. I look forward to contributing to the HNG community and further developing my skills. You can learn more about the [HNG Internship](https://hng.tech/internship)and about [HNG Hiring](https://hng.tech/hire).