topsis-sachin-102303557 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.4
2
+ Name: topsis-sachin-102303557
3
+ Version: 1.0.0
4
+ Summary: TOPSIS decision method Python package
5
+ Author: Sachin Goyal
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: numpy
9
+ Requires-Dist: pandas
10
+ Dynamic: author
11
+ Dynamic: description
12
+ Dynamic: description-content-type
13
+ Dynamic: requires-dist
14
+ Dynamic: requires-python
15
+ Dynamic: summary
16
+
17
+ # TOPSIS Implementation - Sachin Goyal
18
+
19
+ [![Python](https://img.shields.io/badge/Python-3.6+-blue.svg)](https://www.python.org/)
20
+ [![PyPI](https://img.shields.io/badge/PyPI-1.0.0-green.svg)](https://pypi.org/project/topsis-sachingoyal-102303557/)
21
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
22
+
23
+ A complete TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) implementation in Python with both **CLI** and **Web Service** interfaces.
24
+
25
+ ---
26
+
27
+ ## 🚀 Quick Start
28
+
29
+ ### 📦 Install from PyPI
30
+
31
+ ```bash
32
+ pip install topsis-sachingoyal-102303557==1.0.0
33
+ ```
34
+
35
+ ### 🌐 Try the Web Interface
36
+
37
+ Access the live web service at:
38
+ **[https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)**
39
+
40
+ Upload your CSV, enter weights and impacts, and receive results via email!
41
+
42
+ ---
43
+
44
+ ## 📁 Project Structure
45
+
46
+ ```
47
+ Topsis_SachinGoyal_102303557/
48
+
49
+ ├── topsis/ # Python package
50
+ │ ├── __init__.py
51
+ │ └── topsis.py # Core TOPSIS implementation
52
+
53
+ ├── templates/ # Web frontend
54
+ │ └── index.html # Beautiful web UI
55
+
56
+ ├── uploads/ # Temporary file storage (created automatically)
57
+
58
+ ├── main.py # FastAPI backend server
59
+ ├── data.csv # Sample input data
60
+ ├── setup.py # Package setup configuration
61
+ ├── requirements.txt # Python dependencies
62
+ ├── sample.env # Environment variables template
63
+ ├── README.md # This file
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 📋 Requirements
69
+
70
+ - **Python 3.6+**
71
+ - **Dependencies:** pandas, numpy, fastapi, mailjet-rest, python-dotenv
72
+
73
+ Install all dependencies:
74
+
75
+ ```bash
76
+ pip install -r requirements.txt
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 🔧 Setup for Local Development
82
+
83
+ ### 1. Clone the Repository
84
+
85
+ ```bash
86
+ git clone <https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557>
87
+ cd Topsis_SachinGoyal_102303557
88
+ ```
89
+
90
+ ### 2. Install Dependencies
91
+
92
+ ```bash
93
+ pip install -r requirements.txt
94
+ ```
95
+
96
+ ### 3. Configure Environment Variables
97
+
98
+ Create a `.env` file in the project root with the following:
99
+
100
+ ```env
101
+ SENDER_NAME=Your Name
102
+ SENDER_EMAIL=your-verified-email@example.com
103
+ MJ_APIKEY_PUBLIC=your-mailjet-public-key
104
+ MJ_APIKEY_PRIVATE=your-mailjet-private-key
105
+ ```
106
+
107
+ > **Note:** A `sample.env` file is provided as a template. Copy it to `.env` and fill in your credentials.
108
+
109
+ **Required Variables:**
110
+ - `SENDER_NAME` - Your name or service name
111
+ - `SENDER_EMAIL` - Verified sender email in Mailjet
112
+ - `MJ_APIKEY_PUBLIC` - Your Mailjet API public key
113
+ - `MJ_APIKEY_PRIVATE` - Your Mailjet API secret key
114
+
115
+ ### 4. Run the Backend Server
116
+
117
+ ```bash
118
+ uvicorn main:app --reload
119
+ ```
120
+
121
+ The API will be available at `http://127.0.0.1:8000`
122
+
123
+ ### 5. Open the Frontend
124
+
125
+ Navigate to `http://127.0.0.1:8000` in your browser (if serving static files) or open `templates/index.html` directly.
126
+
127
+ ---
128
+
129
+ ## 💻 CLI Usage
130
+
131
+ ### Command Syntax
132
+
133
+ ```bash
134
+ python -m topsis.topsis <InputFile> "<Weights>" "<Impacts>" <OutputFile>
135
+ ```
136
+
137
+ ### Arguments
138
+
139
+ | Argument | Description | Example |
140
+ |----------|-------------|---------|
141
+ | `InputFile` | Path to input CSV file | `data.csv` |
142
+ | `Weights` | Comma-separated numeric weights | `"1,1,1,1,2"` |
143
+ | `Impacts` | Comma-separated + or - | `"+,+,-,+,+"` |
144
+ | `OutputFile` | Path for output CSV | `result.csv` |
145
+
146
+ ### Example
147
+
148
+ ```bash
149
+ python -m topsis.topsis data.csv "1,1,1,1,2" "+,+,+,-,+" result.csv
150
+ ```
151
+
152
+ **Output:** Creates `result.csv` with two additional columns:
153
+ - `Topsis Score` (higher is better)
154
+ - `Rank` (1 = best)
155
+
156
+ ---
157
+
158
+ ## 📊 Input CSV Format
159
+
160
+ Your CSV must have:
161
+ - **First column:** Identifier (e.g., product name, model ID)
162
+ - **Remaining columns:** Numeric criteria values
163
+
164
+ ### Example Input
165
+
166
+ ```csv
167
+ Name,Cost,Performance,Reliability,Efficiency
168
+ ProductA,250,8,9,7
169
+ ProductB,200,7,8,9
170
+ ProductC,300,9,7,8
171
+ ```
172
+
173
+ ### Example Output
174
+
175
+ ```csv
176
+ Name,Cost,Performance,Reliability,Efficiency,Topsis Score,Rank
177
+ ProductA,250,8,9,7,0.534,2
178
+ ProductB,200,7,8,9,0.628,1
179
+ ProductC,300,9,7,8,0.421,3
180
+ ```
181
+
182
+ ---
183
+
184
+ ## 🌐 Web Service Usage
185
+
186
+ 1. **Visit:** [https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)
187
+ 2. **Upload** your CSV file
188
+ 3. **Enter** weights (e.g., `1,1,1`)
189
+ 4. **Enter** impacts (e.g., `+,+,-`)
190
+ 5. **Enter** your email address
191
+ 6. **Submit** and receive results via email
192
+
193
+ ---
194
+
195
+
196
+ ## ⚠️ Common Errors
197
+
198
+ | Error | Cause | Solution |
199
+ |-------|-------|----------|
200
+ | `Input file not found` | File path is incorrect | Check file path and try again |
201
+ | `Invalid email format` | Email is malformed | Use valid email format |
202
+ | `Weights and impacts count mismatch` | Different number of weights vs impacts | Ensure equal counts |
203
+ | `Impacts must be + or -` | Invalid impact symbol | Use only `+` or `-` |
204
+ | `Weights must be numeric` | Non-numeric weight | Use only numbers |
205
+ | `All columns must be numeric` | Non-numeric criteria values | Ensure all criteria are numbers |
206
+
207
+ ---
208
+
209
+ ## 📚 How TOPSIS Works
210
+
211
+ 1. **Normalize** the decision matrix using Euclidean normalization
212
+ 2. **Weight** the normalized matrix
213
+ 3. **Identify** ideal best and worst solutions
214
+ 4. **Calculate** Euclidean distances from ideal solutions
215
+ 5. **Compute** similarity score: `S = D- / (D+ + D-)`
216
+ 6. **Rank** alternatives by score (higher is better)
217
+
218
+ ---
219
+
220
+ ## 🛠️ Technology Stack
221
+
222
+ - **Backend:** FastAPI (Python)
223
+ - **Frontend:** HTML, CSS, JavaScript
224
+ - **Email Service:** Mailjet REST API
225
+ - **Package Management:** PyPI
226
+ - **Deployment:**
227
+ - Frontend: Vercel
228
+ - Backend: Render
229
+
230
+ ---
231
+
232
+ ## 👤 Author
233
+
234
+ **Sachin Goyal**
235
+
236
+ ---
237
+
238
+ ## 🔗 Links
239
+
240
+ - **PyPI Package:** [topsis-sachingoyal-102303557](https://pypi.org/project/topsis-sachingoyal-102303557/1.0.0/)
241
+ - **Web App:** [https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)
242
+ - **GitHub:** [https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557](https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557)
243
+
244
+ ---
245
+
@@ -0,0 +1,229 @@
1
+ # TOPSIS Implementation - Sachin Goyal
2
+
3
+ [![Python](https://img.shields.io/badge/Python-3.6+-blue.svg)](https://www.python.org/)
4
+ [![PyPI](https://img.shields.io/badge/PyPI-1.0.0-green.svg)](https://pypi.org/project/topsis-sachingoyal-102303557/)
5
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+
7
+ A complete TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) implementation in Python with both **CLI** and **Web Service** interfaces.
8
+
9
+ ---
10
+
11
+ ## 🚀 Quick Start
12
+
13
+ ### 📦 Install from PyPI
14
+
15
+ ```bash
16
+ pip install topsis-sachingoyal-102303557==1.0.0
17
+ ```
18
+
19
+ ### 🌐 Try the Web Interface
20
+
21
+ Access the live web service at:
22
+ **[https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)**
23
+
24
+ Upload your CSV, enter weights and impacts, and receive results via email!
25
+
26
+ ---
27
+
28
+ ## 📁 Project Structure
29
+
30
+ ```
31
+ Topsis_SachinGoyal_102303557/
32
+
33
+ ├── topsis/ # Python package
34
+ │ ├── __init__.py
35
+ │ └── topsis.py # Core TOPSIS implementation
36
+
37
+ ├── templates/ # Web frontend
38
+ │ └── index.html # Beautiful web UI
39
+
40
+ ├── uploads/ # Temporary file storage (created automatically)
41
+
42
+ ├── main.py # FastAPI backend server
43
+ ├── data.csv # Sample input data
44
+ ├── setup.py # Package setup configuration
45
+ ├── requirements.txt # Python dependencies
46
+ ├── sample.env # Environment variables template
47
+ ├── README.md # This file
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 📋 Requirements
53
+
54
+ - **Python 3.6+**
55
+ - **Dependencies:** pandas, numpy, fastapi, mailjet-rest, python-dotenv
56
+
57
+ Install all dependencies:
58
+
59
+ ```bash
60
+ pip install -r requirements.txt
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 🔧 Setup for Local Development
66
+
67
+ ### 1. Clone the Repository
68
+
69
+ ```bash
70
+ git clone <https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557>
71
+ cd Topsis_SachinGoyal_102303557
72
+ ```
73
+
74
+ ### 2. Install Dependencies
75
+
76
+ ```bash
77
+ pip install -r requirements.txt
78
+ ```
79
+
80
+ ### 3. Configure Environment Variables
81
+
82
+ Create a `.env` file in the project root with the following:
83
+
84
+ ```env
85
+ SENDER_NAME=Your Name
86
+ SENDER_EMAIL=your-verified-email@example.com
87
+ MJ_APIKEY_PUBLIC=your-mailjet-public-key
88
+ MJ_APIKEY_PRIVATE=your-mailjet-private-key
89
+ ```
90
+
91
+ > **Note:** A `sample.env` file is provided as a template. Copy it to `.env` and fill in your credentials.
92
+
93
+ **Required Variables:**
94
+ - `SENDER_NAME` - Your name or service name
95
+ - `SENDER_EMAIL` - Verified sender email in Mailjet
96
+ - `MJ_APIKEY_PUBLIC` - Your Mailjet API public key
97
+ - `MJ_APIKEY_PRIVATE` - Your Mailjet API secret key
98
+
99
+ ### 4. Run the Backend Server
100
+
101
+ ```bash
102
+ uvicorn main:app --reload
103
+ ```
104
+
105
+ The API will be available at `http://127.0.0.1:8000`
106
+
107
+ ### 5. Open the Frontend
108
+
109
+ Navigate to `http://127.0.0.1:8000` in your browser (if serving static files) or open `templates/index.html` directly.
110
+
111
+ ---
112
+
113
+ ## 💻 CLI Usage
114
+
115
+ ### Command Syntax
116
+
117
+ ```bash
118
+ python -m topsis.topsis <InputFile> "<Weights>" "<Impacts>" <OutputFile>
119
+ ```
120
+
121
+ ### Arguments
122
+
123
+ | Argument | Description | Example |
124
+ |----------|-------------|---------|
125
+ | `InputFile` | Path to input CSV file | `data.csv` |
126
+ | `Weights` | Comma-separated numeric weights | `"1,1,1,1,2"` |
127
+ | `Impacts` | Comma-separated + or - | `"+,+,-,+,+"` |
128
+ | `OutputFile` | Path for output CSV | `result.csv` |
129
+
130
+ ### Example
131
+
132
+ ```bash
133
+ python -m topsis.topsis data.csv "1,1,1,1,2" "+,+,+,-,+" result.csv
134
+ ```
135
+
136
+ **Output:** Creates `result.csv` with two additional columns:
137
+ - `Topsis Score` (higher is better)
138
+ - `Rank` (1 = best)
139
+
140
+ ---
141
+
142
+ ## 📊 Input CSV Format
143
+
144
+ Your CSV must have:
145
+ - **First column:** Identifier (e.g., product name, model ID)
146
+ - **Remaining columns:** Numeric criteria values
147
+
148
+ ### Example Input
149
+
150
+ ```csv
151
+ Name,Cost,Performance,Reliability,Efficiency
152
+ ProductA,250,8,9,7
153
+ ProductB,200,7,8,9
154
+ ProductC,300,9,7,8
155
+ ```
156
+
157
+ ### Example Output
158
+
159
+ ```csv
160
+ Name,Cost,Performance,Reliability,Efficiency,Topsis Score,Rank
161
+ ProductA,250,8,9,7,0.534,2
162
+ ProductB,200,7,8,9,0.628,1
163
+ ProductC,300,9,7,8,0.421,3
164
+ ```
165
+
166
+ ---
167
+
168
+ ## 🌐 Web Service Usage
169
+
170
+ 1. **Visit:** [https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)
171
+ 2. **Upload** your CSV file
172
+ 3. **Enter** weights (e.g., `1,1,1`)
173
+ 4. **Enter** impacts (e.g., `+,+,-`)
174
+ 5. **Enter** your email address
175
+ 6. **Submit** and receive results via email
176
+
177
+ ---
178
+
179
+
180
+ ## ⚠️ Common Errors
181
+
182
+ | Error | Cause | Solution |
183
+ |-------|-------|----------|
184
+ | `Input file not found` | File path is incorrect | Check file path and try again |
185
+ | `Invalid email format` | Email is malformed | Use valid email format |
186
+ | `Weights and impacts count mismatch` | Different number of weights vs impacts | Ensure equal counts |
187
+ | `Impacts must be + or -` | Invalid impact symbol | Use only `+` or `-` |
188
+ | `Weights must be numeric` | Non-numeric weight | Use only numbers |
189
+ | `All columns must be numeric` | Non-numeric criteria values | Ensure all criteria are numbers |
190
+
191
+ ---
192
+
193
+ ## 📚 How TOPSIS Works
194
+
195
+ 1. **Normalize** the decision matrix using Euclidean normalization
196
+ 2. **Weight** the normalized matrix
197
+ 3. **Identify** ideal best and worst solutions
198
+ 4. **Calculate** Euclidean distances from ideal solutions
199
+ 5. **Compute** similarity score: `S = D- / (D+ + D-)`
200
+ 6. **Rank** alternatives by score (higher is better)
201
+
202
+ ---
203
+
204
+ ## 🛠️ Technology Stack
205
+
206
+ - **Backend:** FastAPI (Python)
207
+ - **Frontend:** HTML, CSS, JavaScript
208
+ - **Email Service:** Mailjet REST API
209
+ - **Package Management:** PyPI
210
+ - **Deployment:**
211
+ - Frontend: Vercel
212
+ - Backend: Render
213
+
214
+ ---
215
+
216
+ ## 👤 Author
217
+
218
+ **Sachin Goyal**
219
+
220
+ ---
221
+
222
+ ## 🔗 Links
223
+
224
+ - **PyPI Package:** [topsis-sachingoyal-102303557](https://pypi.org/project/topsis-sachingoyal-102303557/1.0.0/)
225
+ - **Web App:** [https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)
226
+ - **GitHub:** [https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557](https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557)
227
+
228
+ ---
229
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,18 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="topsis-sachin-102303557",
5
+ version="1.0.0",
6
+ author="Sachin Goyal",
7
+ description="TOPSIS decision method Python package",
8
+ long_description=open("README.md", encoding="utf-8").read(),
9
+ long_description_content_type="text/markdown",
10
+ packages=find_packages(),
11
+ install_requires=["numpy", "pandas"],
12
+ entry_points={
13
+ "console_scripts": [
14
+ "topsis=topsis.topsis:main"
15
+ ]
16
+ },
17
+ python_requires=">=3.7",
18
+ )
@@ -0,0 +1,5 @@
1
+ # Expose the main function for `from topsis import topsis`
2
+ from .topsis import topsis
3
+
4
+ __all__ = ["topsis"]
5
+
@@ -0,0 +1,82 @@
1
+ import sys
2
+ import os
3
+ import pandas as pd
4
+ import numpy as np
5
+
6
+ def error(msg):
7
+ print("Error:", msg)
8
+ sys.exit(1)
9
+
10
+ def topsis(input_file, weights, impacts, output_file):
11
+
12
+ if not os.path.isfile(input_file):
13
+ error("Input file not found")
14
+
15
+ try:
16
+ df = pd.read_csv(input_file)
17
+ except:
18
+ error("Unable to read input file")
19
+
20
+ if df.shape[1] < 3:
21
+ error("Input file must contain at least 3 columns")
22
+
23
+ data = df.iloc[:, 1:]
24
+
25
+ if not np.all(data.applymap(np.isreal)):
26
+ error("All columns from 2nd to last must contain numeric values")
27
+
28
+ weights = weights.split(',')
29
+ impacts = impacts.split(',')
30
+
31
+ if len(weights) != data.shape[1]:
32
+ error("Number of weights must be equal to number of criteria")
33
+
34
+ if len(impacts) != data.shape[1]:
35
+ error("Number of impacts must be equal to number of criteria")
36
+
37
+ for i in impacts:
38
+ if i not in ['+', '-']:
39
+ error("Impacts must be either + or -")
40
+
41
+ try:
42
+ weights = np.array(weights, dtype=float)
43
+ except:
44
+ error("Weights must be numeric")
45
+
46
+ norm = data / np.sqrt((data ** 2).sum())
47
+
48
+ weighted = norm * weights
49
+
50
+ ideal_best = []
51
+ ideal_worst = []
52
+
53
+ for i in range(len(impacts)):
54
+ if impacts[i] == '+':
55
+ ideal_best.append(weighted.iloc[:, i].max())
56
+ ideal_worst.append(weighted.iloc[:, i].min())
57
+ else:
58
+ ideal_best.append(weighted.iloc[:, i].min())
59
+ ideal_worst.append(weighted.iloc[:, i].max())
60
+
61
+ ideal_best = np.array(ideal_best)
62
+ ideal_worst = np.array(ideal_worst)
63
+
64
+ dist_best = np.sqrt(((weighted - ideal_best) ** 2).sum(axis=1))
65
+ dist_worst = np.sqrt(((weighted - ideal_worst) ** 2).sum(axis=1))
66
+
67
+ score = dist_worst / (dist_best + dist_worst)
68
+
69
+ df["Topsis Score"] = score
70
+ df["Rank"] = df["Topsis Score"].rank(ascending=False)
71
+
72
+ df.to_csv(output_file, index=False)
73
+ print("TOPSIS analysis completed successfully!")
74
+
75
+ def main():
76
+ if len(sys.argv) != 5:
77
+ error("Usage: topsis <InputFile> <Weights> <Impacts> <OutputFile>")
78
+
79
+ topsis(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
80
+
81
+ if __name__ == "__main__":
82
+ main()
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.4
2
+ Name: topsis-sachin-102303557
3
+ Version: 1.0.0
4
+ Summary: TOPSIS decision method Python package
5
+ Author: Sachin Goyal
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: numpy
9
+ Requires-Dist: pandas
10
+ Dynamic: author
11
+ Dynamic: description
12
+ Dynamic: description-content-type
13
+ Dynamic: requires-dist
14
+ Dynamic: requires-python
15
+ Dynamic: summary
16
+
17
+ # TOPSIS Implementation - Sachin Goyal
18
+
19
+ [![Python](https://img.shields.io/badge/Python-3.6+-blue.svg)](https://www.python.org/)
20
+ [![PyPI](https://img.shields.io/badge/PyPI-1.0.0-green.svg)](https://pypi.org/project/topsis-sachingoyal-102303557/)
21
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
22
+
23
+ A complete TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) implementation in Python with both **CLI** and **Web Service** interfaces.
24
+
25
+ ---
26
+
27
+ ## 🚀 Quick Start
28
+
29
+ ### 📦 Install from PyPI
30
+
31
+ ```bash
32
+ pip install topsis-sachingoyal-102303557==1.0.0
33
+ ```
34
+
35
+ ### 🌐 Try the Web Interface
36
+
37
+ Access the live web service at:
38
+ **[https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)**
39
+
40
+ Upload your CSV, enter weights and impacts, and receive results via email!
41
+
42
+ ---
43
+
44
+ ## 📁 Project Structure
45
+
46
+ ```
47
+ Topsis_SachinGoyal_102303557/
48
+
49
+ ├── topsis/ # Python package
50
+ │ ├── __init__.py
51
+ │ └── topsis.py # Core TOPSIS implementation
52
+
53
+ ├── templates/ # Web frontend
54
+ │ └── index.html # Beautiful web UI
55
+
56
+ ├── uploads/ # Temporary file storage (created automatically)
57
+
58
+ ├── main.py # FastAPI backend server
59
+ ├── data.csv # Sample input data
60
+ ├── setup.py # Package setup configuration
61
+ ├── requirements.txt # Python dependencies
62
+ ├── sample.env # Environment variables template
63
+ ├── README.md # This file
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 📋 Requirements
69
+
70
+ - **Python 3.6+**
71
+ - **Dependencies:** pandas, numpy, fastapi, mailjet-rest, python-dotenv
72
+
73
+ Install all dependencies:
74
+
75
+ ```bash
76
+ pip install -r requirements.txt
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 🔧 Setup for Local Development
82
+
83
+ ### 1. Clone the Repository
84
+
85
+ ```bash
86
+ git clone <https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557>
87
+ cd Topsis_SachinGoyal_102303557
88
+ ```
89
+
90
+ ### 2. Install Dependencies
91
+
92
+ ```bash
93
+ pip install -r requirements.txt
94
+ ```
95
+
96
+ ### 3. Configure Environment Variables
97
+
98
+ Create a `.env` file in the project root with the following:
99
+
100
+ ```env
101
+ SENDER_NAME=Your Name
102
+ SENDER_EMAIL=your-verified-email@example.com
103
+ MJ_APIKEY_PUBLIC=your-mailjet-public-key
104
+ MJ_APIKEY_PRIVATE=your-mailjet-private-key
105
+ ```
106
+
107
+ > **Note:** A `sample.env` file is provided as a template. Copy it to `.env` and fill in your credentials.
108
+
109
+ **Required Variables:**
110
+ - `SENDER_NAME` - Your name or service name
111
+ - `SENDER_EMAIL` - Verified sender email in Mailjet
112
+ - `MJ_APIKEY_PUBLIC` - Your Mailjet API public key
113
+ - `MJ_APIKEY_PRIVATE` - Your Mailjet API secret key
114
+
115
+ ### 4. Run the Backend Server
116
+
117
+ ```bash
118
+ uvicorn main:app --reload
119
+ ```
120
+
121
+ The API will be available at `http://127.0.0.1:8000`
122
+
123
+ ### 5. Open the Frontend
124
+
125
+ Navigate to `http://127.0.0.1:8000` in your browser (if serving static files) or open `templates/index.html` directly.
126
+
127
+ ---
128
+
129
+ ## 💻 CLI Usage
130
+
131
+ ### Command Syntax
132
+
133
+ ```bash
134
+ python -m topsis.topsis <InputFile> "<Weights>" "<Impacts>" <OutputFile>
135
+ ```
136
+
137
+ ### Arguments
138
+
139
+ | Argument | Description | Example |
140
+ |----------|-------------|---------|
141
+ | `InputFile` | Path to input CSV file | `data.csv` |
142
+ | `Weights` | Comma-separated numeric weights | `"1,1,1,1,2"` |
143
+ | `Impacts` | Comma-separated + or - | `"+,+,-,+,+"` |
144
+ | `OutputFile` | Path for output CSV | `result.csv` |
145
+
146
+ ### Example
147
+
148
+ ```bash
149
+ python -m topsis.topsis data.csv "1,1,1,1,2" "+,+,+,-,+" result.csv
150
+ ```
151
+
152
+ **Output:** Creates `result.csv` with two additional columns:
153
+ - `Topsis Score` (higher is better)
154
+ - `Rank` (1 = best)
155
+
156
+ ---
157
+
158
+ ## 📊 Input CSV Format
159
+
160
+ Your CSV must have:
161
+ - **First column:** Identifier (e.g., product name, model ID)
162
+ - **Remaining columns:** Numeric criteria values
163
+
164
+ ### Example Input
165
+
166
+ ```csv
167
+ Name,Cost,Performance,Reliability,Efficiency
168
+ ProductA,250,8,9,7
169
+ ProductB,200,7,8,9
170
+ ProductC,300,9,7,8
171
+ ```
172
+
173
+ ### Example Output
174
+
175
+ ```csv
176
+ Name,Cost,Performance,Reliability,Efficiency,Topsis Score,Rank
177
+ ProductA,250,8,9,7,0.534,2
178
+ ProductB,200,7,8,9,0.628,1
179
+ ProductC,300,9,7,8,0.421,3
180
+ ```
181
+
182
+ ---
183
+
184
+ ## 🌐 Web Service Usage
185
+
186
+ 1. **Visit:** [https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)
187
+ 2. **Upload** your CSV file
188
+ 3. **Enter** weights (e.g., `1,1,1`)
189
+ 4. **Enter** impacts (e.g., `+,+,-`)
190
+ 5. **Enter** your email address
191
+ 6. **Submit** and receive results via email
192
+
193
+ ---
194
+
195
+
196
+ ## ⚠️ Common Errors
197
+
198
+ | Error | Cause | Solution |
199
+ |-------|-------|----------|
200
+ | `Input file not found` | File path is incorrect | Check file path and try again |
201
+ | `Invalid email format` | Email is malformed | Use valid email format |
202
+ | `Weights and impacts count mismatch` | Different number of weights vs impacts | Ensure equal counts |
203
+ | `Impacts must be + or -` | Invalid impact symbol | Use only `+` or `-` |
204
+ | `Weights must be numeric` | Non-numeric weight | Use only numbers |
205
+ | `All columns must be numeric` | Non-numeric criteria values | Ensure all criteria are numbers |
206
+
207
+ ---
208
+
209
+ ## 📚 How TOPSIS Works
210
+
211
+ 1. **Normalize** the decision matrix using Euclidean normalization
212
+ 2. **Weight** the normalized matrix
213
+ 3. **Identify** ideal best and worst solutions
214
+ 4. **Calculate** Euclidean distances from ideal solutions
215
+ 5. **Compute** similarity score: `S = D- / (D+ + D-)`
216
+ 6. **Rank** alternatives by score (higher is better)
217
+
218
+ ---
219
+
220
+ ## 🛠️ Technology Stack
221
+
222
+ - **Backend:** FastAPI (Python)
223
+ - **Frontend:** HTML, CSS, JavaScript
224
+ - **Email Service:** Mailjet REST API
225
+ - **Package Management:** PyPI
226
+ - **Deployment:**
227
+ - Frontend: Vercel
228
+ - Backend: Render
229
+
230
+ ---
231
+
232
+ ## 👤 Author
233
+
234
+ **Sachin Goyal**
235
+
236
+ ---
237
+
238
+ ## 🔗 Links
239
+
240
+ - **PyPI Package:** [topsis-sachingoyal-102303557](https://pypi.org/project/topsis-sachingoyal-102303557/1.0.0/)
241
+ - **Web App:** [https://topsis-sachin-goyal-102303557.vercel.app/](https://topsis-sachin-goyal-102303557.vercel.app/)
242
+ - **GitHub:** [https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557](https://github.com/SachinGoyal94/Topsis_SachinGoyal_102303557)
243
+
244
+ ---
245
+
@@ -0,0 +1,10 @@
1
+ README.md
2
+ setup.py
3
+ topsis/__init__.py
4
+ topsis/topsis.py
5
+ topsis_sachin_102303557.egg-info/PKG-INFO
6
+ topsis_sachin_102303557.egg-info/SOURCES.txt
7
+ topsis_sachin_102303557.egg-info/dependency_links.txt
8
+ topsis_sachin_102303557.egg-info/entry_points.txt
9
+ topsis_sachin_102303557.egg-info/requires.txt
10
+ topsis_sachin_102303557.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ topsis = topsis.topsis:main