Sentiment Atlas API is a serverless backend for collecting, analyzing, and providing sentiment data across different countries. It is implemented using AWS Lambda and Python 3.13.
- AWS Lambda – Serverless functions for the API and data collection.
- AWS DynamoDB – NoSQL database for storing sentiment analysis results.
- AWS API Gateway – Routing requests to AWS Lambda.
- AWS Secrets Manager – Storing API credentials securely.
- AWS SAM (Serverless Application Model) – Infrastructure as code tool for managing AWS resources.
- AWS CloudFormation – Automating infrastructure deployment and management.
- GitHub Actions – CI/CD for testing and deployment.
- Python 3.13 – Main programming language.
- VADER Sentiment Analysis – Library for sentiment analysis.
- PRAW (Python Reddit API Wrapper) – Interaction with the Reddit API for data collection.
- boto3 – SDK for AWS services.
- Pytest and Moto – Unit testing and AWS service mocking.
- Real-time sentiment analysis – Fetch and analyze sentiment data from Reddit posts.
- Scalable and serverless – Uses AWS Lambda for efficient, cost-effective scaling.
- Automated deployment – Managed via GitHub Actions.
- Secure credentials management – Uses AWS Secrets Manager for storing API credentials.
- DynamoDB storage – Stores and retrieves sentiment data efficiently.
- Comprehensive unit testing – Ensures code reliability with Pytest and Moto.
- Clone the repository:
git clone https://github.com/mist941/sentiment-atlas.api cd sentiment-atlas.api
- Install dependencies:
pip install -r requirements.txt cd api_function && pip install -r requirements.txt && cd .. cd collect_data_function && pip install -r requirements.txt && cd ..
- Run locally using AWS SAM:
sam build sam local start-api
sentiment-atlas.api/
build artifacts
│── .github/workflows/ # CI/CD GitHub Actions for testing and deployment
│── api_function/ # Lambda function for API
│ │── main.py # Main API logic
│ │── requirements.txt # API dependencies
│── collect_data_function/ # Data collection function
│ │── main.py # Analysis and storage logic
│ │── countries.json # Countries for analysis
│── tests/ # Unit tests for API and data collection functions
│── template.yaml # AWS SAM template for deployment
Run unit tests using:
pytest tests/ --disable-warnings
Deployment is managed via GitHub Actions (see .github/workflows/deploy.yml
).
sam build
sam deploy --stack-name sentiment-atlas --resolve-s3 --capabilities CAPABILITY_IAM
⭐ If you like this project, don't forget to give it a star on GitHub!