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
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.
📦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
-
Schemas
There are three schemas in this application, namely :
- user ( who creates the schedule )
- tags ( saved by the user )
- schedule ( generated by the algorithm )
-
Middlewares
The authentication for private routes is provided through the auth_model middleware using JWT authentication.
-
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.
-
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.
-
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.
Welcome to the project! This guide will help you get started with setting up and running the project locally.
Before you begin, make sure you have the following prerequisites installed on your machine:
Follow these steps to install and set up the project:
-
Clone the Repository in your local machine
$ git clone https://github.com/nandurijv/schedge-backend.git $ cd schedge-backend
-
Create a virtual environment
$ python -m venv venv
For Mac OS / Linux / Ubuntu:
$ source venv/bin/activate
For Windows:
$ venv\Scripts\activate
-
Install the required packages
$ pip install -r requirements.txt
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
Fork the collection here :
We welcome contributions to improve the project! To contribute, please follow these steps:
-
Fork the repository and clone it to your local machine:
-
Create a new branch for your feature or bug fix.
-
Make your changes and commit them with descriptive commit messages:
-
Make your changes and commit them with descriptive commit messages:
-
Push your changes to your forked repository:
-
Open a pull request from your forked repository to the main repository's
main
branch. -
Describe your changes in detail and provide any necessary information or context in the pull request.
-
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.
- Follow the PEP 8 style guide for Python code.
- Maintain consistency with the existing codebase.
- Write clear and concise comments, documentation, and commit messages.
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!
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.
For any questions, feedback, or inquiries, please feel free to reach out
- Name: Nanduri Jayant Vishnu ☘️
- Email: [email protected]
- GitHub: nandurijv
- LinkedIn: Jayant Vishnu Nanduri