This project collects and analyzes user feedback using Python, Google Cloud Platform (GCP), BigQuery, and sentiment analysis.
This system is designed to collect user feedback from a CSV file, store it in Google BigQuery, and perform sentiment analysis using the ChatGPT API. It demonstrates skills in data handling, cloud storage, and natural language processing.
- Load user feedback data from CSV into Google BigQuery
- Perform sentiment analysis on feedback text using ChatGPT API
- Store analyzed data back in BigQuery
- Scalable design for handling large datasets
- Modular architecture with separate modules for data, database, and utility operations
- Python 3.7+
- Google Cloud Platform account with BigQuery and Cloud Storage enabled
- OpenAI API key
-
Clone the repository:
git clone https://github.com/yourusername/user-feedback-analysis.git cd user-feedback-analysis
-
Install dependencies:
pip install -r requirements.txt
-
Set up Google Cloud credentials:
- Create a service account and download the JSON key
- Set the environment variable:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-key.json"
-
Set up OpenAI API key:
export OPENAI_API_KEY="your-api-key"
-
Configure the project:
- Update the
config.py
file in thesrc/utils
directory with your project-specific settings
- Update the
-
Load data into BigQuery:
from src.data import load_csv_to_bigquery load_csv_to_bigquery()
-
Set up BigQuery tables:
from src.database import setup_tables setup_tables()
-
Perform sentiment analysis:
from src.sentiment import analyze_sentiment analyze_sentiment()
user_feedback_analysis/
│
├── src/
│ ├── data/
│ │ ├── __init__.py
│ │ └── collection.py
│ ├── database/
│ │ ├── __init__.py
│ │ ├── connection.py
│ │ ├── operations.py
│ ├── sentiment/
│ │ ├── __init__.py
│ │ └── sentiment_analysis.py
│ └── utils/
│ ├── __init__.py
│ ├── config.py
│ └── logging.py
├── tests/
│ ├── test_sentiment_analysis.py
│ └── ...
├── requirements.txt
└── README.md
src/data/
: Contains modules for data collection and processingsrc/database/
: Contains modules for database connection and operationsconnection.py
: Handles connections to BigQuery and Google Cloud Storageoperations.py
: Provides functions for loading data, setting up tables, inserting rows, and querying data from BigQuery tables
src/analysis/
: Contains modules for sentiment analysissrc/utils/
: Contains utility modules for configuration and loggingconfig.py
: Manages configuration settings, including loading environment variables from a.env
filelogging.py
: Provides a singleton logger instance for consistent logging across the project
tests/
: Contains test scripts for various modules
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.