This analytics service microservice is a Python-based backend service for the Coding Progress Dashboard, responsible for processing, aggregating, and analyzing coding activity data.
- LeetCode data scraping and analysis
- Redis-based caching and task management
- Celery for asynchronous task processing
- Comprehensive logging and monitoring
- Pytest-based testing suite
- Python 3.10+
- FastAPI
- Celery
- Redis
- pytest
- Docker
- GraphQL integration
.
├── Dockerfile
├── README.md
├── docker-compose.yaml
├── config.py
├── main.py
├── requirements.txt
├── filebeat/
│ └── filebeat.yml
├── logstash/
│ ├── config/
│ └── pipeline/
├── src/
│ ├── services/
│ ├── models/
│ └── utils/
├── tests/
│ └── test_analytics_service.py
└── pytest.ini
- Python 3.10+
- Docker
- Docker Compose
- Redis
- Celery
- FastAPI
# Create virtual environment
python -m venv latest
# Activate virtual environment
# On Unix or MacOS
source latest/bin/activate
# On Windows
latest\Scripts\activate- Clone the repository
git clone https://github.com/your-org/coding-progress-analytics-service.git
cd coding-progress-analytics-service- Install dependencies
pip install -r requirements.txtCreate a .env file with the following configurations:
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
# Logging Configuration
LOG_LEVEL=INFO
LOG_FILE=devquest.log
# Celery Configuration
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0
# Start Redis
docker-compose up redis
# Run main application
python main.py
# Run Celery worker
celery -A tasks worker --loglevel=info# Build docker image
docker-compose build
# Start all services
docker-compose up# Run all tests
pytest
# Run with coverage
pytest --cov=.
# Generate HTML coverage report
pytest --cov=. --cov-report=htmlmain.py: Primary application entry pointtasks.py: Celery background tasksredis_service.py: Redis interaction utilitiesleetcode_service.py: LeetCode data scraping and processingleetcode_graphql.py: GraphQL interactionsmodels.py: Data models and schemaslogging_config.py: Logging configuration
- Configured log file:
devquest.log - Supports different log levels (DEBUG, INFO, WARNING, ERROR)
- Integrated with Filebeat for log management
- Celery for asynchronous task management
- Background tasks for data scraping and processing
- Redis as message broker and result backend
- Filebeat for log shipping
- Logstash for log processing
- Configurable logging levels
- Comprehensive error tracking
- pytest for unit and integration testing
- Code coverage reporting
- GitHub Actions workflow (recommended)
- Ensure Redis is running
- Check
.envfile configurations - Verify Python and dependency versions
- Review Celery worker logs
- Check network connectivity
Distributed under the MIT License. See LICENSE for more information.