Skip to main content

A package for TOPSIS implementation

Project description

TOPSIS — Assignment Project ✅

Overview

A small CLI and web service implementation of the TOPSIS decision-making method. This repository includes:

  • A command-line program topsis.py to compute TOPSIS scores and ranks.
  • A Flask web service (app.py) that accepts an input CSV, weights, impacts and sends the result by email.
  • A package prepared for PyPI (naming convention: Topsis-Mehak-102303724).

Quick Start ✨

Requirements

  • Python 3.8+
  • Install required packages: pandas, numpy, flask

Install with:

pip install -r requirements.txt

CLI Usage

python topsis.py <InputDataFile> "<Weights>" "<Impacts>" <OutputResultFileName>

Example:

python topsis.py data.csv "1,1,1,2" "+,+,-,+" output-result.csv

Notes:

  • Weights and Impacts are comma-separated strings (e.g., 1,1,1,2 and +,+,-,+).
  • Impacts values must be + (benefit) or - (cost).

Validation & Error Handling ✔️

The program checks and reports errors for:

  • Wrong number of parameters (must be 4).
  • File not found.
  • Input file must have at least three columns.
  • Columns from 2nd to last must be numeric.
  • Number of weights, impacts, and numeric columns must match.
  • Impacts must be + or -.
  • Weights and impacts must be comma-separated.

Input / Output Format

  • Input: CSV with first column as identifier (name/ID) and remaining columns as numeric criteria.
  • Output: CSV with two added columns: Topsis Score and Rank.

Packaging & PyPI (Part-II) 🔧

Follow these steps to prepare and upload the package:

  1. Update setup.py and package metadata (use the naming convention Topsis-FirstName-RollNumber).
  2. Build distributions:
    python -m build
    
  3. Upload to PyPI using twine:
    python -m twine upload dist/*
    
  4. Verify by installing from PyPI:
    pip install Topsis-FirstName-RollNumber
    topsis --help
    

(See official guides on packaging and uploading to PyPI for full details.)


Web Service (Part-III)

  • Run the Flask app:
python app.py
  • Web form accepts: CSV file, weights, impacts, and recipient email.
  • The server validates input, computes results and emails the output CSV to the provided address.
  • Email format is validated and weights/impacts rules are enforced as in CLI.

Testing & Examples

  • Test the CLI with provided sample CSV files.
  • Install the built package locally and run the CLI namespace if available.
  • Use the web UI to upload sample CSVs and confirm email delivery.

Assumptions

  • First column of CSV is a unique identifier and not used in calculations.
  • We assume weights are positive numbers and impacts are + or -.
  • The user will configure valid SMTP credentials in app.py before using the email feature.

Contact / License

Include your name and roll number in setup.py metadata. Add a suitable LICENSE file before publishing.

Minimal, clear, and focused — this README follows the assignment requirements for TOPSIS implementation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topsis_mehak_102303724-1.0.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topsis_mehak_102303724-1.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file topsis_mehak_102303724-1.0.2.tar.gz.

File metadata

  • Download URL: topsis_mehak_102303724-1.0.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for topsis_mehak_102303724-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8aaa3feb1f229f96821c1e98ad47bd01ea261b03032b3f2e371d2b3cfdad5e93
MD5 9d4efe865b539d57891f51aa52b7ed33
BLAKE2b-256 6a051c51053aa9abf2511b413d274ba4247fc7c9528876e18f96774466cabeb9

See more details on using hashes here.

File details

Details for the file topsis_mehak_102303724-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_mehak_102303724-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9e1d19e01324e4af345d80914ca03f0986427f3ae7a8cd1467dac313c2f26eb7
MD5 d8e4a24d8fa3412bf7919d2da413d321
BLAKE2b-256 f38e2f02a7c8c062485d7016c1f936fba59eea35a2a8a2efe6290c9dfca34a4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page