Code Monkey home page Code Monkey logo

schedge-backend's Introduction

Schedge-Backend

Description

Introducing our newly developed REST API 🚀 designed for seamless interaction with a time-table scheduling front-end. This API serves a range of essential functions, including user authentication, verification, and the ability to save various pre-processing parameters for the scheduling algorithm .

It enables the creation of optimized schedules based on input data while ensuring clear and easily understandable responses for debugging and input verification purposes. With this API, you can streamline your scheduling processes and enhance overall efficiency.

The implemented front-end (reactjs) for this particular backend can be found at :-

T-Gen


Technologies Used

Flask 🌶️ : A lightweight web framework for building Python applications.

Flask-Bcrypt 🔒: A Flask extension that provides password hashing and verification functionality.

Flask-Cors 🔄 : A Flask extension that adds Cross-Origin Resource Sharing (CORS) support to handle cross-domain requests.

Flask-Mail 📧 : A Flask extension for sending email messages.

Flask-RESTful 🌐 : An extension for building RESTful APIs using Flask.

Mongoengine 🍃 : A Python Object-Document Mapper (ODM) for MongoDB that provides a high-level abstraction for interacting with the database.

PyJWT 🎫 : A library for encoding and decoding JSON Web Tokens (JWT) in Python.

python-dotenv 🌳 : A Python library that allows reading variables from an environment file, typically used for managing environment configurations.

This tech stack utilizes Flask as the main framework, along with various Flask extensions for additional functionality. The project also incorporates MongoDB as the database and includes libraries for password hashing, CORS support, email sending, RESTful API development, JWT handling, and environment configuration management.

Directory Structure

📦Schedge-Backend
 ┣ 📂controllers (for routes)
 ┃ ┣ 📜__init__.py
 ┃ ┣ 📜schedule_controller.py
 ┃ ┣ 📜tag_controller.py
 ┃ ┗ 📜user_controller.py

<!-- Genetic Algorithm for Scheduling -->

 ┣ 📂geneticmodel
 ┃ ┣ 📜activity_fitness.py
 ┃ ┣ 📜average_fitness.py
 ┃ ┣ 📜crossover.py
 ┃ ┣ 📜decode.py
 ┃ ┣ 📜fitness.py
 ┃ ┣ 📜flip.py
 ┃ ┣ 📜initialise.py
 ┃ ┣ 📜main.py
 ┃ ┣ 📜mutation.py
 ┃ ┣ 📜selection.py
 ┃ ┗ 📜tag_slots.py

<!--  Genetic Algorithm for Scheduling  -->

 ┣ 📂middlewares
 ┃ ┗ 📜auth_model.py
 ┣ 📂models (functions to perform on reaching endpoints)
 ┃ ┣ 📜schedule_model.py
 ┃ ┣ 📜tag_model.py
 ┃ ┗ 📜user_model.py
 ┣ 📂schemas ( structure of the objects stored in mongodb)
 ┃ ┣ 📜schedule_schema.py
 ┃ ┣ 📜tags_schema.py
 ┃ ┗ 📜user_schema.py
 ┣ 📜.gitignore
 ┣ 📜README.md
 ┣ 📜app.py
 ┣ 📜env
 ┣ 📜package-lock.json
 ┗ 📜requirements.txt

Features

  1. Schemas

    There are three schemas in this application, namely :

    • user ( who creates the schedule )
    • tags ( saved by the user )
    • schedule ( generated by the algorithm )
  2. Middlewares

    The authentication for private routes is provided through the auth_model middleware using JWT authentication.

  3. Models

    Each route ( public or private ) when reached either through GET, POST, PUT or DELETE methods, calls different functions that need to be run. For example, CRUD operations on User, Tags or the Schedules. These functions are defined in this directory for each schema.

  4. Environment Variables

    The project makes use of some environment variables which control parameters like sender's mail, db host, mail password, port number, production environment, etc. A sample env file has been included in the root directory.

  5. Genetic Model

    The genetic model processes the input taken from the user such as the tag information and the activity list that needs to be scheduled.

Getting Started

Welcome to the project! This guide will help you get started with setting up and running the project locally.

Prerequisites

Before you begin, make sure you have the following prerequisites installed on your machine:

Installation

Follow these steps to install and set up the project:

  1. Clone the Repository in your local machine

    $ git clone https://github.com/nandurijv/schedge-backend.git
    $ cd schedge-backend
  2. Create a virtual environment

    $ python -m venv venv

    For Mac OS / Linux / Ubuntu:

    $ source venv/bin/activate

    For Windows:

    $ venv\Scripts\activate
  3. Install the required packages

    $ pip install -r requirements.txt

Usage

This API is a use case of implementing Genetic Algorithm for time table scheduling. The basic application for this api is to enable user authentication, verification and creation of a schedule based on certain info provided by the user. The sample flow of the api calls is as follows:

  • User Signs Up
  • User Verifies his mail
  • User Logs In
  • User Creates Tags of his choice
  • User Submits a list of Activities to schedule in a given time frame
  • User Gets a Schedule Generated from the list of activities using the Genetic Model
  • User can view his created Tags
  • User can view his saved Schedules

API Documentation

Fork the collection here :

Run in Postman

Contribution Guidelines

Common Instructions

We welcome contributions to improve the project! To contribute, please follow these steps:

  1. Fork the repository and clone it to your local machine:

  2. Create a new branch for your feature or bug fix.

  3. Make your changes and commit them with descriptive commit messages:

  4. Make your changes and commit them with descriptive commit messages:

  5. Push your changes to your forked repository:

  6. Open a pull request from your forked repository to the main repository's main branch.

  7. Describe your changes in detail and provide any necessary information or context in the pull request.

  8. After reviewing your changes, if everything is in order, your pull request will be merged. Otherwise, we may request further changes or provide feedback.

Please ensure that your contributions adhere to our coding conventions and guidelines. Also, make sure to include appropriate tests and ensure they pass before submitting your pull request.

Coding Conventions

  • Follow the PEP 8 style guide for Python code.
  • Maintain consistency with the existing codebase.
  • Write clear and concise comments, documentation, and commit messages.

Issue Tracker

If you encounter any bugs, issues, or have feature requests, please create an issue on the GitHub repository. Provide as much detail as possible to help us understand and address the problem.

We appreciate your contributions and efforts to improve this project. Thank you!

License

This project is licensed under the MIT License.

You are free to use, modify, and distribute this software as per the terms of the MIT License. Please see the LICENSE file for more details.

Contact Information

For any questions, feedback, or inquiries, please feel free to reach out

Acknowledgments

Button Text

Contributors

Your Name

schedge-backend's People

Contributors

dependabot[bot] avatar nandurijv avatar

Stargazers

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