This repository contains a Python application for analyzing customer orders from an online store. The application performs the following tasks:
- Computes the total revenue generated by the online store for each month in the dataset.
- Computes the total revenue generated by each product in the dataset.
- Computes the total revenue generated by each customer in the dataset.
- Identifies the top 10 customers by revenue generated.
Note
I am a windows user explaination are detailed for windows.
Warning
Turn on docker before starting the task.
Either use docker desktop directly OR
Open cmd as Administrator
net stop com.docker.service
net start com.docker.service
- Project Structure
- Prerequisites
- Cloning the Repository
- Running the Application
- Running Tests
- Troubleshooting
orders_analysis.py
: Main application script for processing the orders.test_orders_analysis.py
: Test script for the application.Dockerfile
: Dockerfile for the main application.Dockerfile.test
: Dockerfile for the test service.docker-compose.yml
: Docker Compose file to build and run the services.orders.csv
: Sample dataset of customer orders.README.md
: This readme file.
To clone the repository, use the following command:
git clone https://github.com/anasjawed283/orders_analysis.git
cd orders_analysis
-
Build the Docker image:
docker-compose build app
-
Run the application:
docker-compose up app
-
Install dependencies:
pipenv install
-
Run the application:
pipenv run python orders_analysis.py
-
Build the test Docker image:
docker-compose build test
-
Run the tests:
docker-compose up test
-
Install dependencies:
pipenv install --dev
-
Run the tests:
pipenv run pytest test_orders_analysis.py
-
Docker Daemon Not Running:
- Ensure Docker Desktop is running on your machine. You can start it from the Start menu on Windows or via the terminal on macOS/Linux.
-
Permission Issues:
- If you encounter permission issues, try running the commands with
sudo
(for Linux/macOS) or as an Administrator (for Windows).
- If you encounter permission issues, try running the commands with
-
Version Compatibility:
- Ensure you are using compatible versions of Python and Docker. This application is tested with Python 3.12 and the latest Docker versions.
-
WSL 2 Backend for Docker:
- If you are using Docker with WSL 2, ensure that WSL 2 is properly installed and configured. Refer to the WSL 2 installation guide for more information.
-
Docker Compose Version:
- If you encounter a warning about the Docker Compose version being obsolete, update your
docker-compose.yml
to a more recent version or update Docker Compose itself.
- If you encounter a warning about the Docker Compose version being obsolete, update your
-
Docker Daemon Not Starting:
- Ensure Docker Desktop is running. If not, start Docker Desktop from the Start menu.
-
Containers Not Stopping:
-
Use the following command to stop and remove containers:
docker-compose down
-
This repository provides a comprehensive solution for analyzing customer orders. You can run the application and tests using Docker for a consistent environment, or directly on your local machine with Python and Pipenv. Follow the instructions in this README to set up and use the application effectively.
For any issues or contributions, feel free to open an issue or pull request on the GitHub repository.