Topsis-Aryan-102316004 1.0.0
A Python package for TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)
Requires Python: >=3.6

# Topsis-Aryan-102316004

[![PyPI version](https://badge.fury.io/py/Topsis-Aryan-102316004.svg)](https://badge.fury.io/py/Topsis-Aryan-102316004)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Project on PyPI: [https://pypi.org/project/Topsis-Aryan-102316004/](https://pypi.org/project/Topsis-Aryan-102316004/)

A Python package to implement **TOPSIS** (Technique for Order of Preference by Similarity to Ideal Solution), a multi-criteria decision analysis method.

---

## ðŸ“‹ Table of Contents
- [Installation](#installation)
- [Part 1: Command Line Usage](#part-1-command-line-usage)
- [Part 2: Library Usage](#part-2-library-usage)
- [Part 3: Web Service](#part-3-web-service)
- [License](#license)

---

## ðŸ“¦ Installation

You can install the package directly from PyPI:

```bash
pip install Topsis-Aryan-102316004
```

---

## Part 1: Command Line Usage

You can use the `topsis` command directly in your terminal to process CSV files.

### Syntax
```bash
topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>
```

### Parameters
1.  **InputDataFile**: Path to the input CSV file. Must contain numeric data from the 2nd column onwards.
2.  **Weights**: Comma-separated weights (e.g., `1,1,1,1`).
3.  **Impacts**: Comma-separated impacts (`+` for beneficial, `-` for non-beneficial).
4.  **OutputResultFileName**: Name of the output CSV file to save results.

### Example
```bash
topsis data.csv "1,1,1,1,1" "+,+,+,+,+" result.csv
```

---

## Part 2: Library Usage

You can import the package in your Python scripts.

```python
from topsis.main import topsis_logic
import pandas as pd

# Load your dataset
df = pd.read_csv("data.csv")

# processing...
# ...
```

---

## Part 3: Web Service

A user-friendly web interface is provided to use the TOPSIS method without writing code.

### Features
*   **Upload CSV**: Easily upload your input file.
*   **Custom Parameters**: Enter weights and impacts.
*   **Email Results**: Get the resultant CSV file directly in your inbox.
*   **Interactive Table**: View the results (Topsis Score and Rank) instantly.

### Running the Web App

Ensure you have `streamlit` installed (`pip install streamlit`).

```bash
streamlit run app.py
```

### Screenshot

![Web Service Interface](images/final.png)

> *Note: Provide your sender Gmail and App Password in the sidebar to enable email functionality.*

---

## ï¿½ Sample Data

### Input Data (`data.csv`)

| Fund Name | P1 | P2 | P3 | P4 | P5 |
| :--- | :--- | :--- | :--- | :--- | :--- |
| M1 | 0.67 | 0.45 | 6.5 | 42.6 | 12.56 |
| M2 | 0.6 | 0.36 | 3.6 | 53.3 | 14.47 |
| M3 | 0.82 | 0.67 | 3.8 | 63.1 | 17.1 |
| M4 | 0.6 | 0.36 | 3.5 | 69.2 | 18.42 |
| M5 | 0.76 | 0.58 | 4.8 | 43 | 12.29 |
| M6 | 0.69 | 0.48 | 6.6 | 48.7 | 14.12 |
| M7 | 0.79 | 0.62 | 4.8 | 59.2 | 16.35 |
| M8 | 0.84 | 0.71 | 6.5 | 34.5 | 10.64 |

### Output Result (`result.csv`)

| Fund Name | P1 | P2 | P3 | P4 | P5 | Topsis Score | Rank |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| M1 | 0.67 | 0.45 | 6.5 | 42.6 | 12.56 | 0.4354 | 6 |
| M2 | 0.6 | 0.36 | 3.6 | 53.3 | 14.47 | 0.3038 | 8 |
| M3 | 0.82 | 0.67 | 3.8 | 63.1 | 17.1 | 0.6269 | 2 |
| M4 | 0.6 | 0.36 | 3.5 | 69.2 | 18.42 | 0.4730 | 5 |
| M5 | 0.76 | 0.58 | 4.8 | 43.0 | 12.29 | 0.4177 | 7 |
| M6 | 0.69 | 0.48 | 6.6 | 48.7 | 14.12 | 0.5234 | 4 |
| M7 | 0.79 | 0.62 | 4.8 | 59.2 | 16.35 | 0.6514 | 1 |
| M8 | 0.84 | 0.71 | 6.5 | 34.5 | 10.64 | 0.5237 | 3 |

---

## ï¿½ðŸ“„ License

This project is licensed under the MIT License.