GithubHelp home page GithubHelp logo

employeesegmentaion's Introduction

EmployeeSegmentaion

EmployeeSegmentation is a python app that categorizes the means of transport (car, public transport and bike) used by different employees.

It uses Dash and Flask for the webApp and the API. The server is managed by Waitress.

Prerequisites

In order to run the program, you need to install all the requirements listed in requirements.txt using pip

pip install -r requirements.txt

The project has been written using python 3.9 but should work with python 3.6+

Installation

There are two different launching files.

  • main.py: This file runs a development server with a debug mode that automatically reloads the webpage when the code is updated
python main.py
python waitressServer.py

Usage

The default port for the development server is the port 8050. You can change this directly in the code if you want to use a different port.

The default port for the waitress server is defined by the PORT environment variable.

Webpage

You can access the webpage by going to the root address of your server. It will automatically be redirected to the http://[yourServerAddress]/dash page which contains the webApp

Once on the webpage, you need to upload a CSV file with the following format:

employee_ID distance_in_m time_in_s CO2_in_g
1 2760 1692 31678
2 1223 983 8707
3 610 562 1762

In your CSV file, you need at least the last three columns strictly respecting the names. The data contained must be real numbers

API

The application has an API that can be accessed using the following link http://[yourServerAddress]/api

You can use two different parameters:

  • raw: The value of this parameter is a csv file written in plain text
  • link: The value of this parameter is a link to a specific CSV file that can be openly accessed

The API will return a plain text in CSV format with two more columns:

  • cat: This column contains the raw clustering done by the k-means algorithm
  • transport_mean: This column contains our interpretation of the K-means algorithm and has 3 possible values:
    • car
    • public transport
    • bike

You can find an example in the test_requests.py file

Docker

A Docker image of this project has been created in order to facilitate the deployment of the application. It can be found here. It is based on the python:3.9-slim image.

To start the docker, you need to bind the ports. As said before, the default port of the application is 8080.

If you have docker installed, you can run:

docker pull flobaudry/employee-segmentation
docker run -d -p 8050:8080 flobaudry/employee-segmentation

after that, you should be able to access the web application using this address

employeesegmentaion's People

Contributors

flobaudry avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.