Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/claspog/salesanalyticstool-dockerized

A Python application for analyzing customer orders, calculating monthly, product-wise, and customer-wise revenues, and identifying the top 10 customers by revenue.
https://github.com/claspog/salesanalyticstool-dockerized

automation docker docker-compose dockerfile sales-analysis testing tool

Last synced: 6 days ago
JSON representation

A Python application for analyzing customer orders, calculating monthly, product-wise, and customer-wise revenues, and identifying the top 10 customers by revenue.

Awesome Lists containing this project

README

        

# Sales Analytics Tool - Dockerized File

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
> ```
## Table of Contents

1. [Project Structure](#project-structure)
2. [Prerequisites](#prerequisites)
3. [Cloning the Repository](#cloning-the-repository)
4. [Running the Application](#running-the-application)
- [With Docker](#with-docker)
- [Without Docker](#without-docker)
5. [Running Tests](#running-tests)
- [With Docker](#with-docker-tests)
- [Without Docker](#without-docker-tests)
6. [Troubleshooting](#troubleshooting)

## Project Structure

- `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.

## Prerequisites

### With Docker

- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose](https://docs.docker.com/compose/install/)

### Without Docker

- [Python 3.12](https://www.python.org/downloads/)
- [Pipenv](https://pipenv.pypa.io/en/latest/install/)

## Cloning the Repository

To clone the repository, use the following command:

```sh
git clone https://github.com/anasjawed283/orders_analysis.git
cd orders_analysis
```

## Running the Application

![image](https://github.com/user-attachments/assets/d3df98f6-e9b8-4ae8-ae47-f87bbc8df9f4)

![image](https://github.com/user-attachments/assets/1985bf19-f2f9-4be4-8f43-b24f5bca5b91)

### With Docker

1. **Build the Docker image**:

```sh
docker-compose build app
```

2. **Run the application**:

```sh
docker-compose up app
```

### Without Docker

1. **Install dependencies**:

```sh
pipenv install
```

2. **Run the application**:

```sh
pipenv run python orders_analysis.py
```

## Running Tests

![image](https://github.com/user-attachments/assets/34f0838e-e8ec-449c-af2d-6068f8be020b)

![image](https://github.com/user-attachments/assets/632f021b-aed4-40c7-af05-45a8ff8e602c)

### With Docker

1. **Build the test Docker image**:

```sh
docker-compose build test
```

2. **Run the tests**:

```sh
docker-compose up test
```

### Without Docker

1. **Install dependencies**:

```sh
pipenv install --dev
```

2. **Run the tests**:

```sh
pipenv run pytest test_orders_analysis.py
```

## Troubleshooting

### Common Issues

1. **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.

2. **Permission Issues**:
- If you encounter permission issues, try running the commands with `sudo` (for Linux/macOS) or as an Administrator (for Windows).

3. **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.

4. **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](https://docs.microsoft.com/en-us/windows/wsl/install) for more information.

5. **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.

### Docker Specific Issues

- **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:

```sh
docker-compose down
```

## Conclusion

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](https://github.com/CLASPOG/SalesAnalyticsTool-Dockerized).

---